/* **게임과 같은 벌을 쓴다.** 열전은 홀로 만들어진 화면이라 푸른 먹빛
   (#0b0d14 · 파란 강조 #4a90e2)이었는데, 천하·전쟁·설전은 모두 따뜻한 갈금빛
   (#14110e · #c9a227)이다. 열전은 판 안에서 덧창으로 열리는 자리라(설전·일기토·
   천하가 iframe 으로 부른다) 빛이 튀면 다른 게임을 연 것처럼 보인다. */
:root {
    --bg-color: #14110e;
    --panel-bg: rgba(30, 26, 21, 0.72);
    --panel-border: rgba(201, 162, 39, 0.16);
    --inner-bg: rgba(0, 0, 0, 0.26);
    --text-primary: #ece4d6;
    --text-secondary: #9b9184;
    --gold: #c9a227;
    --gold-glow: rgba(201, 162, 39, 0.4);
    --accent: #c9a227;

    /* 능력치 빛깔 — 채도를 낮춰 비단·먹의 결에 앉힌다. 무력·통솔은 전쟁 화면이
       공격력·체력에 쓰는 빛(#ffb750 · #ff8074)을 그대로 물려받는다. */
    --lead-color:  #d97a6c;
    --war-color:   #e0a04a;
    --int-color:   #7fa9c9;
    --pol-color:   #a98bbf;
    --charm-color: #86b58a;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(201, 162, 39, 0.07), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(138, 106, 56, 0.10), transparent 25%);
    background-attachment: fixed;
    color: var(--text-primary);
    overflow: hidden;
}

/* **설계 해상도 한 벌로 짜고 fit.js 가 통째로 배율을 건다.**
   여태 이 화면만 창 크기에 맡겨(100vh · max-width) 있어서, 1920 에서는 양옆에
   빈 띠가 남고 덧창(.pwrap)으로 열리면 그 상자의 비에 따라 배치가 달라졌다.
   천하·전쟁과 같은 1760×990(16:9)로 못 박으면 어디서 열어도 한 픽셀도 안 움직인다.
   ⚠ 이 안에서 100vh 를 쓰지 말 것 — 화면 전체를 가리켜 배율과 이중으로 곱해진다. */
.app-container {
    display: flex;
    height: 990px;
    padding: 20px;
    gap: 20px;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.glass-panel-inner {
    background: var(--inner-bg);
    border: 1px solid rgba(255,255,255,0.03);
    border-radius: 12px;
    padding: 20px;
}

.mt-4 { margin-top: 20px; }

/* Sidebar */
.sidebar {
    width: 350px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--panel-border);
}

.sidebar-header h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--gold);
    text-shadow: 0 0 10px var(--gold-glow);
    letter-spacing: 2px;
}

.sidebar-header p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.controls input, .controls select {
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--panel-border);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Pretendard';
    outline: none;
    transition: all 0.3s;
}

.controls input:focus, .controls select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 8px var(--gold-glow);
}

.officer-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding: 10px;
}

/* 굴림막대 — 판의 결로 맞춘다(다른 화면 넷과 같은 벌이다 · #4a4034 on #191510).
   흰빛 10% 짜리 손잡이가 남아 있어 이 쪽만 결이 달랐다.

   ⚠ `::-webkit-scrollbar-button` 을 반드시 적는다. 안 적으면 크롬이 **거기만**
   제 기본꼴을 그려 옛 윈도 창의 ▲▼ 단추가 달린다(재 봄 · display 가 inline 이었다).
   ⚠ 표준 `scrollbar-width` 는 **파이어폭스에만** 준다 — 함께 적으면 요즘 크롬이
   웹킷 쪽을 통째로 무시한다(CLAUDE.md). */
@supports not selector(::-webkit-scrollbar){
  html,body{scrollbar-width:thin;scrollbar-color:#4a4034 transparent}
}
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: #191510; border-radius: 5px; }
::-webkit-scrollbar-thumb { background: #4a4034; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #c9a227; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-corner { background: transparent; }

.officer-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    margin-bottom: 4px;
}

.officer-item:hover {
    background: rgba(255,255,255,0.05);
}

.officer-item.active {
    background: linear-gradient(90deg, rgba(201, 162, 39, 0.15) 0%, transparent 100%);
    border-left: 3px solid var(--gold);
}

.item-thumb {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--inner-bg);
    margin-right: 15px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 10px;
    color: var(--text-secondary);
}

.item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* 원형으로 잘리므로 가운데가 아니라 얼굴이 있는 위쪽을 기준으로 삼는다 */
    object-position: center 20%;
}

.item-info {
    flex: 1;
}

.item-name {
    font-size: 16px;
    font-weight: 600;
}

.item-stats {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Main Content */
.main-content {
    flex: 1;
    position: relative;
}

.empty-view {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pulse-ring {
    width: 60px; height: 60px;
    border-radius: 50%;
    background: var(--gold-glow);
    animation: pulse 2s infinite;
    margin: 0 auto 20px;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 20px rgba(201, 162, 39, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(201, 162, 39, 0); }
}

.detail-view {
    height: 100%;
    overflow-y: auto;
    padding: 30px;
    animation: fadeIn 0.4s ease;
}

.hidden { display: none !important; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hero Section */
.hero-section {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    align-items: flex-end;
}

.portrait-container {
    width: 160px;
    height: 200px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--gold);
    box-shadow: 0 0 20px var(--gold-glow);
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.portrait-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.title-container h2 {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 18px;
    margin-bottom: 16px;
}

/* 이름과 자를 한 줄에 세운다 (2026-08-31 · 사용자 결정 — 「자는 지금 글꼴과
   크기를 유지한 채로 이름 옆에」). 자는 이름의 곁말이지 제 줄을 가질 만큼의
   말이 아니다. **옮기는 것은 자리뿐이다** — 글꼴도 크기도 빛깔도 그대로다.
   ⚠ **밑선으로 맞춘다**(`baseline`) — 48px 과 18px 을 가운데로 맞추면 작은
      쪽이 떠 보인다.
   ⚠ **줄바꿈을 열어 둔다**(`flex-wrap`) — 폰에서 긴 이름에 한자까지 붙으면
      자가 아랫줄로 내려간다. 이름을 밀어내는 것보다 낫다.
   ⚠ **아래 여백은 줄이 든다** — 안 옮기면 자의 `margin-bottom` 이 줄 안에서만
      살아 한줄평과의 사이가 통째로 사라진다. */
.name-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    column-gap: 14px;
    row-gap: 2px;
    margin-bottom: 16px;
}
.name-row h2, .name-row .subtitle { margin-bottom: 0; }

.meta-info {
    display: flex;
    gap: 10px;
}

.badge {
    background: rgba(255,255,255,0.1);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    border: 1px solid rgba(255,255,255,0.05);
}

/* Grids */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
}

.stats-card h3, .bio-card h3, .story-section h3 {
    font-size: 18px;
    color: var(--gold);
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(201, 162, 39, 0.3);
    padding-bottom: 8px;
}

/* Stat Bars */
.stat-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.stat-label {
    width: 40px;
    font-size: 14px;
    color: var(--text-secondary);
}

.bar-bg {
    flex: 1;
    height: 8px;
    background: rgba(0,0,0,0.5);
    border-radius: 4px;
    margin: 0 15px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.1, 0.7, 0.1, 1);
}

#bar-lead { background: linear-gradient(90deg, transparent, var(--lead-color)); box-shadow: 0 0 10px var(--lead-color); }
#bar-war { background: linear-gradient(90deg, transparent, var(--war-color)); box-shadow: 0 0 10px var(--war-color); }
#bar-int { background: linear-gradient(90deg, transparent, var(--int-color)); box-shadow: 0 0 10px var(--int-color); }
#bar-pol { background: linear-gradient(90deg, transparent, var(--pol-color)); box-shadow: 0 0 10px var(--pol-color); }
#bar-charm { background: linear-gradient(90deg, transparent, var(--charm-color)); box-shadow: 0 0 10px var(--charm-color); }

.stat-val {
    width: 30px;
    font-weight: bold;
    text-align: right;
}

/* Typography Content */
.text-content {
    line-height: 1.7;
    color: #c9d1d9;
    font-size: 15px;
}

.html-content p {
    margin-bottom: 12px;
}
.html-content ul {
    margin-left: 20px;
    margin-bottom: 12px;
}

.wiki-btn {
    display: inline-block;
    background: rgba(255,255,255,0.05);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s;
}

.wiki-btn:hover {
    background: rgba(201, 162, 39, 0.2);
    border-color: var(--gold);
    color: var(--gold);
}

/* Infobox Badges */
.infobox-badges {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.infobox-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.infobox-key {
    color: var(--text-secondary);
}
.infobox-val {
    color: var(--text-primary);
    font-weight: 500;
}
/* Footnotes */
.footnotes-content {
    font-size: 13px;
    color: var(--text-secondary);
}
.footnotes-content a {
    color: var(--accent);
    text-decoration: none;
}
.footnotes-content a:hover {
    text-decoration: underline;
}

/* Tabs UI */
.tabs-container {
    margin-top: 30px;
}
.tabs-header {
    display: flex;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
    overflow-x: auto;
}
.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 600;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
}
.tab-btn:hover {
    color: var(--text-primary);
}
.tab-btn.active {
    color: var(--gold);
    border-bottom: 2px solid var(--gold);
}
.tab-content-panel {
    display: none;
    animation: fadeIn 0.3s ease-out;
}
.tab-content-panel.active {
    display: block;
}
.section-block {
    margin-bottom: 25px;
}
.section-block h4 {
    color: var(--gold);
    margin-bottom: 10px;
    font-size: 18px;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
    padding-bottom: 5px;
}

/* ══ 좁은 화면 ══════════════════════════════════════════════════════════
   fit.js 가 물러나(html.흐름) 문서가 그냥 흐른다.
   **넓은 화면에서는 이 블록이 하나도 안 듣는다** — 판은 예전 그대로다.

   두 칸(목록 · 상세)을 위아래로 쌓는다. 목록은 화면의 절반만 쓰고 제 안에서
   구르고, 상세는 그 아래로 길게 흐른다. 그래야 목록에서 골라 곧바로 아래를
   읽어 내려갈 수 있다. 상세만 남기고 목록을 감추는 길도 있으나, 그러려면
   돌아가는 단추를 새로 두어야 해서 여기서는 쌓는 쪽을 골랐다. */
@media (max-width: 899px) {
    .app-container {
        flex-direction: column;
        height: auto;
        padding: 12px;
        gap: 12px;
    }
    .sidebar { width: auto; }
    .officer-list { max-height: 44vh; flex: none; }
    .sidebar-header { padding: 16px 14px 12px; }
    .sidebar-header h1 { font-size: 1.7rem !important; }
    .sidebar-header p { font-size: 0.95rem !important; }

    .main-content { flex: none; }
    .detail-view { height: auto; padding: 16px 14px; }
    .empty-view { position: static; padding: 34px 0; }

    /* 초상과 이름을 위아래로 — 나란히 두면 이름이 두세 자씩 끊긴다 */
    .hero-section { flex-direction: column; align-items: flex-start; gap: 14px;
                    margin-bottom: 20px; }
    .portrait-container { width: 132px; height: 165px; }

    /* 손대는 자리는 손가락만큼 — 44px 이 눈금이다.
       글씨는 16px 밑으로 두지 않는다. 그 밑이면 아이폰이 칸을 누를 때
       화면을 저 혼자 확대한다. */
    #searchInput, #sortSelect { font-size: 16px; padding: 12px 13px; }
    #돌아 { top: 16px; right: 14px; padding: 11px 16px; }

    /* 한 사람만 보러 왔으면 목록을 통째로 접는다 — 검색창·정렬·191줄이
       위를 덮어 정작 설명이 한참 아래로 밀린다. 설명만 바로 나온다. */
    html.한사람 .sidebar { display: none; }
    html.한사람 .app-container { padding: 10px; gap: 0; }
    html.한사람 .empty-view { display: none; }

    /* **글자를 폰 크기로 낮춘다.** 이름이 48px 이라 세 글자에 한자까지 붙으면
       두 줄로 접히고, 접힌 자리가 괄호 한가운데였다. 능력치도 '정치' 가
       '정 / 치' 로 끊겼다. 데스크톱 크기를 그대로 두면 이렇게 된다. */
    .title-container h2 { font-size: 27px; margin-bottom: 6px; line-height: 1.25;
                          word-break: keep-all; }
    .subtitle { font-size: 14px; margin-bottom: 12px; }
    /* 줄이 여백을 드므로 여기서도 줄에 준다 — `.name-row .subtitle`(0,2,0)이
       `.subtitle`(0,1,0)을 이기기 때문이다 */
    .name-row { column-gap: 10px; margin-bottom: 12px; }
    #d-oneliner { font-size: 0.98rem !important; margin: 8px 0 14px 0 !important; }
    .badge { font-size: 12px; padding: 5px 10px; }
    .meta-info { gap: 7px !important; }
    /* 능력치는 낱말이 안 끊기게 — 사이를 넓히는 대신 낱말을 통째로 넘긴다 */
    #d-stats { font-size: 0.98rem !important; word-break: keep-all; line-height: 1.9; }
    #d-game { font-size: 0.92rem !important; line-height: 1.85 !important; }
    .stats-card, .bio-card { padding: 15px 14px; }
    .text-content { font-size: 0.94rem; line-height: 1.75 !important; }
    .content-grid { gap: 14px !important; }
}
