/* =========================================
   Glossary Detail V2
   검색 직접 진입 사용자를 위한 dark editorial reading page
   ========================================= */

#page-term-detail {
    --term-page-bg: #08090c;
    --term-surface: #111318;
    --term-surface-raised: #16181d;
    --term-border: #292c33;
    --term-border-strong: #383b43;
    --term-text: #f4f4f5;
    --term-body: #d2d5db;
    --term-muted: #9297a1;
    --term-accent: #e10600;
    background: var(--term-page-bg);
    color: var(--term-text);
}

.term-detail-page {
    min-height: 100vh;
    padding: 1.4rem 0 4.5rem;
}

.term-detail-shell {
    width: 100%;
    max-width: 58rem;
    padding-inline: 1.25rem;
}

.detail-content-wrapper {
    position: relative;
    overflow: hidden;
}

/* SPA clone animation의 루트는 유지하되, 한 장짜리 카드처럼 보이지 않게 한다. */
.term-detail-card {
    position: relative;
    width: min(100%, 50rem);
    margin: 0 auto;
    background: transparent;
    border: 0;
    border-radius: 0;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    margin: 0 0 1.15rem;
    color: var(--term-muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.back-btn:hover,
.back-btn:focus-visible {
    color: var(--term-text);
}

.back-btn:focus-visible {
    outline: 2px solid var(--term-accent);
    outline-offset: 3px;
    border-radius: 0.25rem;
}

/* =========================================
   Term Hero — Category → Term → Description
   ========================================= */

.term-detail-hero {
    padding: 1.4rem 0 2.65rem;
    border-bottom: 1px solid var(--term-border);
}

.term-category-badge {
    display: inline-block;
    margin: 0 0 0.85rem;
    padding: 0;
    background: transparent;
    color: #ef4444;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    line-height: 1.4;
    text-transform: uppercase;
}

.term-title-ko {
    max-width: 46rem;
    margin: 0;
    color: #ffffff;
    font-size: clamp(2.35rem, 7vw, 4.25rem);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.term-title-en {
    margin: 0.65rem 0 0;
    color: var(--term-muted);
    font-size: clamp(1rem, 2vw, 1.2rem);
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.term-description {
    max-width: 44rem;
    margin: 1.8rem 0 0;
    color: var(--term-body);
    font-size: clamp(1.02rem, 1.8vw, 1.12rem);
    letter-spacing: -0.01em;
    line-height: 1.88;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

/* =========================================
   Technical Media
   IMAGE / DIAGRAM / VIDEO / imageUrl fallback
   ========================================= */

.term-media-slot {
    max-width: 100%;
}

.term-media-slot:empty {
    display: none;
}

.term-media-slot > .term-media,
.term-media-slot > .term-media-image-wrap:not([style*="display"]) {
    margin-top: 2.5rem;
}

.term-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin-bottom: 0;
    overflow: hidden;
    background: #0b0d11;
    border: 1px solid var(--term-border-strong);
    border-radius: 0.7rem;
}

.term-media-video,
.term-media-diagram {
    display: block;
    width: 100%;
    height: 100%;
}

.term-media-video {
    object-fit: cover;
}

.term-media-diagram {
    max-width: 100%;
    padding: 0.4rem;
    box-sizing: border-box;
    object-fit: contain;
}

.term-media-diagram-wrap {
    background: #0b0f14;
    cursor: zoom-in;
}

.term-media-image-wrap {
    position: relative;
    display: block;
    max-width: 100%;
    margin-bottom: 0;
    overflow: hidden;
    background: #0b0d11;
    border: 1px solid var(--term-border-strong);
    border-radius: 0.7rem;
    cursor: zoom-in;
}

.term-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 560px;
    margin: 0;
    object-fit: contain;
}

.term-media-zoom-btn {
    position: absolute;
    right: 0.65rem;
    bottom: 0.65rem;
    z-index: 2;
    min-height: 36px;
    padding: 0.4rem 0.72rem;
    color: #e5e7eb;
    background: rgba(8, 9, 12, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: zoom-in;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.term-media-zoom-btn:hover,
.term-media-zoom-btn:focus-visible {
    color: #ffffff;
    background: rgba(8, 9, 12, 0.96);
    border-color: var(--term-accent);
}

.term-media-zoom-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* =========================================
   Race Case Study
   ========================================= */

.term-realcase-slot:empty {
    display: none;
}

.term-realcase-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 1rem;
    max-width: 100%;
    margin-top: 3rem;
    padding: 1.55rem 1.65rem 1.65rem;
    background: var(--term-surface);
    border: 1px solid var(--term-border);
    border-top: 3px solid var(--term-accent);
    border-radius: 0.65rem;
}

.term-realcase-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    background: #1b1d23;
    border: 1px solid #30333b;
    border-radius: 0.5rem;
    font-size: 1.05rem;
    line-height: 1;
}

.term-realcase-body {
    min-width: 0;
}

.term-realcase-label {
    margin: 0 0 0.55rem;
    color: #ef4444;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    line-height: 1.4;
    text-transform: uppercase;
}

.term-realcase-title {
    margin: 0 0 0.7rem;
    color: var(--term-text);
    font-size: clamp(1.08rem, 2.3vw, 1.3rem);
    font-weight: 750;
    letter-spacing: -0.02em;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.term-realcase-content {
    margin: 0;
    color: #c8cbd2;
    font-size: 1rem;
    line-height: 1.85;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.term-structured-cases {
    display: grid;
    gap: 1.15rem;
}

.term-structured-cases .term-realcase-card + .term-realcase-card {
    margin-top: 0;
}

.term-structured-case-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem;
    margin-bottom: 0.55rem;
}

.term-structured-case-heading .term-realcase-label {
    margin-bottom: 0;
}

.term-structured-case-type {
    flex: 0 0 auto;
    padding: 0.28rem 0.55rem;
    color: #f3f4f6;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.03em;
}

.term-structured-case-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: -0.15rem 0 0.85rem;
}

.term-structured-case-meta span {
    padding: 0.28rem 0.5rem;
    color: #b9bdc7;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid #30333b;
    border-radius: 0.4rem;
    font-size: 0.75rem;
    line-height: 1.3;
}

.term-structured-case-reason,
.term-structured-case-links {
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.term-structured-case-reason strong,
.term-structured-case-links strong {
    display: block;
    margin-bottom: 0.45rem;
    color: #f3f4f6;
    font-size: 0.78rem;
    font-weight: 750;
}

.term-structured-case-reason p {
    margin: 0;
    color: #aeb3be;
    font-size: 0.9rem;
    line-height: 1.65;
    white-space: pre-line;
}

.term-structured-case-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.term-structured-case-chip {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0.38rem 0.68rem;
    color: #d9dce3;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid #353842;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 650;
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.term-structured-case-chip:hover,
.term-structured-case-chip:focus-visible {
    color: #ffffff;
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--term-accent);
}

.term-structured-case-chip:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* =========================================
   Race Context & Viewing Tips / FAQ
   ========================================= */

.term-faq-slot:empty {
    display: none;
}

.term-faq-section {
    max-width: 100%;
    margin-top: 3.15rem;
    padding-top: 2.25rem;
    border-top: 1px solid var(--term-border);
}

.term-faq-heading,
.related-terms-heading {
    margin: 0;
    padding-left: 0.7rem;
    border-left: 3px solid var(--term-accent);
    color: var(--term-text);
    font-size: clamp(1.18rem, 2.5vw, 1.38rem);
    font-weight: 750;
    letter-spacing: -0.02em;
    line-height: 1.4;
}

.term-faq-caption {
    margin: 0.45rem 0 1.2rem 0.85rem;
    color: var(--term-muted);
    font-size: 0.78rem;
    letter-spacing: 0.045em;
    line-height: 1.5;
}

.term-faq-list {
    display: flex;
    flex-direction: column;
    margin-top: 0.2rem;
    border-top: 1px solid var(--term-border);
}

.term-faq-item {
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--term-border);
    border-radius: 0;
    overflow: hidden;
    transition: background-color 0.2s ease;
}

.term-faq-item[open] {
    background: #0d0f14;
}

.term-faq-question {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 58px;
    padding: 0.95rem 0.85rem;
    color: #eceef2;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.55;
    list-style: none;
    cursor: pointer;
    overflow-wrap: anywhere;
}

.term-faq-question::-webkit-details-marker {
    display: none;
}

.term-faq-question::before {
    content: '+';
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    color: #f87171;
    border: 1px solid #4a2a2a;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.term-faq-item[open] .term-faq-question::before {
    content: '−';
    border-color: var(--term-accent);
    transform: rotate(180deg);
}

.term-faq-question:hover {
    color: #ffffff;
}

.term-faq-question:focus-visible {
    outline: 2px solid var(--term-accent);
    outline-offset: -2px;
}

.term-faq-answer {
    padding: 0 1rem 1.35rem 3.05rem;
    color: #c9ccd3;
    font-size: 0.98rem;
    line-height: 1.85;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

/* =========================================
   Related Terms — 개념 확장
   ========================================= */

.related-terms-section.related-terms-top,
.related-terms-section {
    margin: 3.15rem 0 0;
    padding: 2.25rem 0 2.15rem;
    border-top: 1px solid var(--term-border);
    border-bottom: 1px solid var(--term-border);
}

.related-terms-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.15rem;
}

.related-term-chip {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0.48rem 0.85rem;
    background: var(--term-surface);
    border: 1px solid var(--term-border);
    border-radius: 999px;
    color: #d9dce2;
    font-size: 0.86rem;
    font-weight: 650;
    line-height: 1.35;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.related-term-chip:hover,
.related-term-chip:focus-visible {
    color: #ffffff;
    background: var(--term-surface-raised);
    border-color: var(--term-accent);
}

.related-term-chip:focus-visible {
    outline: 2px solid var(--term-accent);
    outline-offset: 2px;
}

/* =========================================
   Semantic Relations — "같이 이해하면 좋은 개념"
   기존 related-terms-section의 heading/border/spacing을 그대로 상속하고,
   카드 grid만 이 블록에서 추가한다. 새 색상 시스템 없이 기존 다크 팔레트를 재사용한다.
   ========================================= */

.semantic-relations-caption {
    margin: 0.6rem 0 0;
    color: var(--term-muted);
    font-size: 0.86rem;
    line-height: 1.5;
}

.semantic-relations-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: 1.15rem;
}

.semantic-relation-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.1rem 1.15rem;
    background: var(--term-surface);
    border: 1px solid var(--term-border);
    border-radius: 0.6rem;
    color: var(--term-body);
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.semantic-relation-card:hover,
.semantic-relation-card:focus-visible {
    background: var(--term-surface-raised);
    border-color: var(--term-accent);
    transform: translateY(-2px);
}

.semantic-relation-card:focus-visible {
    outline: 2px solid var(--term-accent);
    outline-offset: 2px;
}

.semantic-relation-type {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    padding: 0.18rem 0.55rem;
    background: rgba(225, 6, 0, 0.12);
    border: 1px solid rgba(225, 6, 0, 0.35);
    border-radius: 999px;
    color: #ff8a80;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.semantic-relation-target {
    margin-top: 0.3rem;
    color: #ffffff;
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.35;
}

.semantic-relation-target-en {
    margin-top: -0.2rem;
    color: var(--term-muted);
    font-size: 0.78rem;
}

.semantic-relation-reason {
    margin-top: 0.4rem;
    color: var(--term-body);
    font-size: 0.87rem;
    line-height: 1.55;
}

.semantic-relation-arrow {
    align-self: flex-end;
    margin-top: 0.3rem;
    color: var(--term-muted);
    font-size: 0.95rem;
    transition: color 0.2s ease, transform 0.15s ease;
}

.semantic-relation-card:hover .semantic-relation-arrow,
.semantic-relation-card:focus-visible .semantic-relation-arrow {
    color: var(--term-accent);
    transform: translateX(2px);
}

/* =========================================
   Discover — 사이트 내 다른 콘텐츠 탐색
   ========================================= */

.detail-content-wrapper.is-inline-search-open {
    overflow: visible;
}

.term-inline-search-block {
    margin: 2.5rem 0 1.5rem;
    padding: 1.35rem 1.4rem 1.45rem;
    background: #0d0f14;
    border: 1px solid var(--term-border);
    border-radius: 0.65rem;
}

.term-inline-search-label {
    margin: 0 0 0.8rem;
    color: #d9dce2;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.5;
}

.term-search-row {
    display: flex;
    align-items: stretch;
    gap: 0.65rem;
}

.term-search-row .term-inline-search {
    flex: 1 1 76%;
}

.term-inline-search {
    position: relative;
}

.term-inline-search.is-open {
    z-index: 20;
}

.term-inline-search-icon {
    position: absolute;
    top: 50%;
    left: 1rem;
    color: var(--term-muted);
    pointer-events: none;
    transform: translateY(-50%);
}

.term-inline-search-input {
    width: 100%;
    min-height: 48px;
    padding: 0.78rem 1rem 0.78rem 2.75rem;
    background: var(--term-surface);
    border: 1px solid var(--term-border-strong);
    border-radius: 0.5rem;
    color: var(--term-text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.term-inline-search-input::placeholder {
    color: #777c86;
}

.term-inline-search-input:focus,
.term-inline-search-input[aria-expanded="true"] {
    background: var(--term-surface-raised);
    border-color: var(--term-accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.1);
}

.term-inline-search-results {
    position: absolute;
    top: calc(100% - 1px);
    right: 0;
    left: 0;
    z-index: 30;
    max-height: 23rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #17191f;
    border: 1px solid var(--term-accent);
    border-top: 0;
    border-radius: 0 0 0.5rem 0.5rem;
    box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.38);
    scrollbar-width: thin;
    scrollbar-color: #4a4d55 transparent;
}

.term-inline-search-results[hidden] {
    display: none;
}

.term-inline-search-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
    width: 100%;
    min-height: 3.85rem;
    padding: 0.7rem 1rem 0.7rem 1.15rem;
    background: none;
    border: 0;
    border-top: 1px solid var(--term-border);
    color: var(--term-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.term-inline-search-item:first-child {
    border-top: 0;
}

.term-inline-search-item:hover,
.term-inline-search-item:focus-visible,
.term-inline-search-item.is-active {
    background: #20232a;
    outline: none;
}

.term-inline-search-item:hover .term-inline-search-item-term,
.term-inline-search-item:focus-visible .term-inline-search-item-term,
.term-inline-search-item.is-active .term-inline-search-item-term {
    color: var(--term-accent);
}

.term-inline-search-item-copy {
    min-width: 0;
}

.term-inline-search-item-term,
.term-inline-search-item-eng {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.term-inline-search-item-term {
    font-size: 0.98rem;
    font-weight: 750;
    line-height: 1.3;
    transition: color 0.15s ease;
}

.term-inline-search-item-eng {
    margin-top: 0.13rem;
    color: var(--term-muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

.term-inline-search-item-arrow {
    color: var(--term-accent);
    font-size: 1.05rem;
    font-weight: 700;
}

.term-inline-search-empty {
    margin: 0;
    padding: 1rem 1.15rem;
    color: var(--term-muted);
    font-size: 0.9rem;
    text-align: center;
}

.term-calendar-btn {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 0.48rem;
    min-height: 48px;
    padding: 0.78rem 1.05rem;
    background: #17191f;
    border: 1px solid var(--term-border-strong);
    border-radius: 0.5rem;
    color: #f2f3f5;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.term-calendar-btn-icon {
    font-size: 1rem;
}

.term-calendar-btn-arrow {
    color: #ef4444;
    transition: transform 0.2s ease;
}

.term-calendar-btn:hover,
.term-calendar-btn:focus-visible {
    color: #ffffff;
    background: rgba(225, 6, 0, 0.1);
    border-color: var(--term-accent);
}

.term-calendar-btn:hover .term-calendar-btn-arrow,
.term-calendar-btn:focus-visible .term-calendar-btn-arrow {
    transform: translateX(2px);
}

.term-calendar-btn:focus-visible {
    outline: 2px solid var(--term-accent);
    outline-offset: 2px;
}

@media (max-width: 520px) {
    .term-inline-search-results {
        max-height: min(21rem, calc(100vh - 10rem));
    }

    .term-inline-search-item {
        min-height: 3.55rem;
        padding: 0.62rem 0.85rem 0.62rem 1rem;
    }

    .term-inline-search-item-term {
        font-size: 0.92rem;
    }

    .term-inline-search-item-eng {
        font-size: 0.78rem;
    }
}

/* =========================================
   Previous / Next Navigation
   모바일은 swipe를 유지하고 floating controls는 콘텐츠를 가리지 않도록 숨긴다.
   ========================================= */

.nav-arrow {
    display: none;
}

@media (min-width: 768px) {
    .nav-arrow {
        position: fixed;
        top: 50%;
        z-index: 100;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 58px;
        color: #b9bdc6;
        background: rgba(17, 19, 24, 0.92);
        border: 1px solid var(--term-border-strong, #383b43);
        border-radius: 0.55rem;
        font-size: 1.15rem;
        text-decoration: none;
        transform: translateY(-50%);
        backdrop-filter: blur(8px);
        transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    }

    .nav-arrow.prev {
        left: max(1rem, calc(50% - 31rem));
    }

    .nav-arrow.next {
        right: max(1rem, calc(50% - 31rem));
    }

    .nav-arrow:hover,
    .nav-arrow:focus-visible {
        color: #ffffff;
        background: #17191f;
        border-color: var(--term-accent, #e10600);
        transform: translateY(-50%) translateY(-2px);
    }

    .nav-arrow:focus-visible {
        outline: 2px solid var(--term-accent, #e10600);
        outline-offset: 3px;
    }
}

/* =========================================
   Swipe hint / Loading
   ========================================= */

.swipe-hint {
    display: none;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 9, 12, 0.84);
    border-radius: 0.7rem;
    backdrop-filter: blur(4px);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: var(--term-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes swipeHintPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.04); }
}

@keyframes swipeHintFadeOut {
    from { opacity: 1; }
    to { opacity: 0; pointer-events: none; }
}

/* =========================================
   Media Lightbox
   ========================================= */

.term-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.term-lightbox[hidden] {
    display: none;
}

.term-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
}

.term-lightbox-close,
.term-lightbox-zoom-toggle {
    position: absolute;
    top: 0.75rem;
    z-index: 2;
    width: 44px;
    height: 44px;
    color: #ffffff;
    background: rgba(17, 19, 24, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.term-lightbox-close {
    right: 0.75rem;
}

.term-lightbox-zoom-toggle {
    left: 0.75rem;
    font-size: 1.35rem;
}

.term-lightbox-close:hover,
.term-lightbox-close:focus-visible,
.term-lightbox-zoom-toggle:hover,
.term-lightbox-zoom-toggle:focus-visible {
    background: var(--term-accent, #e10600);
    border-color: var(--term-accent, #e10600);
}

.term-lightbox-close:focus-visible,
.term-lightbox-zoom-toggle:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.term-lightbox-viewport {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
    overflow: auto;
    background: #0b0f14;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0.55rem;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.term-lightbox-image {
    display: block;
    width: auto;
    max-width: min(1100px, 92vw);
    max-height: 86vh;
    object-fit: contain;
    cursor: zoom-in;
}

.term-lightbox.is-zoomed .term-lightbox-viewport {
    display: block;
    width: min(1100px, 92vw);
    height: 86vh;
    cursor: grab;
}

.term-lightbox.is-zoomed .term-lightbox-viewport.is-panning {
    cursor: grabbing;
}

.term-lightbox.is-zoomed .term-lightbox-image {
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    margin: 0 auto;
    cursor: inherit;
    user-select: none;
    -webkit-user-select: none;
}

/* =========================================
   Responsive
   ========================================= */

@media (max-width: 767px) {
    .term-detail-page {
        padding-top: 1rem;
    }

    .term-detail-shell {
        padding-inline: 1rem;
    }

    .term-detail-card {
        width: 100%;
    }

    .semantic-relations-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .swipe-hint {
        display: block;
        margin-top: 1.15rem;
        padding: 0.5rem 1rem;
        color: var(--term-muted);
        font-size: 0.8rem;
        text-align: center;
        animation: swipeHintPulse 1s ease-in-out 3, swipeHintFadeOut 0.8s ease-out 4s forwards;
    }
}

@media (max-width: 520px) {
    .term-detail-page {
        padding-bottom: 3.25rem;
    }

    .back-btn {
        margin-bottom: 0.75rem;
        font-size: 0.78rem;
    }

    .term-detail-hero {
        padding: 1.1rem 0 2rem;
    }

    .term-category-badge {
        margin-bottom: 0.65rem;
        font-size: 0.68rem;
    }

    .term-title-ko {
        font-size: clamp(2rem, 11vw, 2.8rem);
        line-height: 1.1;
    }

    .term-title-en {
        margin-top: 0.45rem;
        font-size: 0.96rem;
    }

    .term-description {
        margin-top: 1.35rem;
        font-size: 1rem;
        line-height: 1.78;
    }

    .term-media-slot > .term-media,
    .term-media-slot > .term-media-image-wrap:not([style*="display"]) {
        margin-top: 1.85rem;
    }

    .term-media {
        aspect-ratio: 4 / 3;
        border-radius: 0.55rem;
    }

    .term-media-diagram-wrap {
        aspect-ratio: 16 / 9;
    }

    .term-media-diagram {
        padding: 0.2rem;
    }

    .term-media-image-wrap {
        border-radius: 0.55rem;
    }

    .term-media-zoom-btn {
        right: 0.45rem;
        bottom: 0.45rem;
        min-height: 36px;
        padding: 0.36rem 0.62rem;
        font-size: 0.72rem;
    }

    .term-realcase-card {
        grid-template-columns: 1fr;
        gap: 0.65rem;
        margin-top: 2.15rem;
        padding: 1.15rem 1rem 1.25rem;
    }

    .term-realcase-badge {
        width: 2rem;
        height: 2rem;
        font-size: 0.95rem;
    }

    .term-realcase-label {
        margin-bottom: 0.4rem;
        font-size: 0.67rem;
    }

    .term-realcase-title {
        margin-bottom: 0.55rem;
        font-size: 1.08rem;
        line-height: 1.42;
    }

    .term-realcase-content {
        font-size: 0.96rem;
        line-height: 1.76;
    }

    .term-structured-case-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.45rem;
    }

    .term-structured-case-meta {
        margin-top: 0;
    }

    .term-faq-section,
    .related-terms-section.related-terms-top,
    .related-terms-section {
        margin-top: 2.25rem;
        padding-top: 1.7rem;
    }

    .related-terms-section.related-terms-top,
    .related-terms-section {
        padding-bottom: 1.65rem;
    }

    .semantic-relations-grid {
        grid-template-columns: 1fr;
        gap: 0.7rem;
    }

    .semantic-relation-card {
        padding: 0.9rem 1rem 1rem;
    }

    .term-faq-heading,
    .related-terms-heading {
        padding-left: 0.6rem;
        font-size: 1.14rem;
    }

    .term-faq-caption {
        margin: 0.35rem 0 0.8rem 0.7rem;
        font-size: 0.74rem;
    }

    .term-faq-question {
        gap: 0.6rem;
        min-height: 54px;
        padding: 0.85rem 0.35rem;
        font-size: 0.94rem;
        line-height: 1.5;
    }

    .term-faq-question::before {
        width: 1.35rem;
        height: 1.35rem;
        font-size: 0.92rem;
    }

    .term-faq-answer {
        padding: 0 0.35rem 1.1rem 2.3rem;
        font-size: 0.94rem;
        line-height: 1.78;
    }

    .related-terms-chips {
        gap: 0.5rem;
        margin-top: 0.9rem;
    }

    .related-term-chip {
        min-height: 40px;
        padding: 0.45rem 0.72rem;
        font-size: 0.82rem;
    }

    .term-inline-search-block {
        margin-top: 1.9rem;
        margin-bottom: 1.2rem;
        padding: 1.05rem 0.9rem 1rem;
    }

    .term-inline-search-label {
        margin-bottom: 0.65rem;
        font-size: 0.9rem;
    }

    .term-search-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
    }

    .term-inline-search-input {
        font-size: 0.92rem;
    }

    .term-calendar-btn {
        width: 100%;
    }

    .term-lightbox {
        padding: 0;
    }

    .term-lightbox-viewport {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border: 0;
        border-radius: 0;
    }

    .term-lightbox-image {
        max-width: 100%;
        max-height: 100%;
    }

    .term-lightbox.is-zoomed .term-lightbox-viewport {
        width: 100%;
        height: 100%;
    }

    .term-lightbox.is-zoomed .term-lightbox-image {
        width: 220%;
        height: auto;
    }

    .term-lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
    }

    .term-lightbox-zoom-toggle {
        top: 0.5rem;
        left: 0.5rem;
    }
}

@media (max-width: 380px) {
    .term-detail-shell {
        padding-inline: 0.85rem;
    }

    .term-title-ko {
        font-size: 1.95rem;
    }

    .term-description,
    .term-realcase-content,
    .term-faq-answer {
        overflow-wrap: anywhere;
    }
}

@media (prefers-reduced-motion: reduce) {
    .back-btn,
    .nav-arrow,
    .term-media-zoom-btn,
    .term-faq-item,
    .term-faq-question::before,
    .related-term-chip,
    .term-structured-case-chip,
    .term-inline-search-input,
    .term-inline-search-item,
    .term-calendar-btn,
    .term-calendar-btn-arrow,
    .term-lightbox-close,
    .term-lightbox-zoom-toggle {
        transition: none;
    }

    .swipe-hint,
    .spinner {
        animation: none;
    }

    /* 자동재생 정지는 term-detail.js가 담당하고, 컨트롤 노출 시 전체 프레임을 보인다. */
    .term-media-video {
        object-fit: contain;
    }
}
