/* ==========================================================================
   수행1센터 프롬프트 대전
   컨셉: 문장이 무기다 — 두 [비고]가 대치선을 사이에 두고 마주본다.
        화면의 주인공은 캐릭터가 아니라 문장 그 자체.
   ========================================================================== */

:root {
    /* 잉크 남색 계열 — 순수 검정이 아니다 */
    --ink:      #080B12;
    --surface:  #0F1520;
    --surface-2:#151D2B;
    --edge:     #1F2A3B;
    --edge-soft:#161F2C;

    --text:     #C3CEDE;
    --text-hi:  #EDF3FA;
    --text-dim: #6A7A91;
    --text-fade:#465469;

    /* 진영색 — 대치 구조의 핵심 */
    --sideA:    #43C5B0;   /* 청록 */
    --sideB:    #FF7E63;   /* 산호 */
    --sideC:    #B69CF5;   /* 연보라 (3파전) */
    --crown:    #F2C14E;   /* 승리 */
    --defeat:   #45536A;

    /* 라벨 자간.
       넓은 자간은 이 화면의 정체성이지만, 한글은 글리프 자체에 여백이 있어
       영문만큼 벌리면 단어가 흩어져 읽힌다("비 밀 번 호  변 경").
       한글이 들어가는 라벨·제목은 이 값을 쓰고,
       영문 전용(PROMPT WAR · ADMIN · 일차 숫자)은 넓은 자간을 그대로 지킨다. */
    --ls-label: .05em;
    --ls-title: .06em;

    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
            "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
    --r: 2px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--ink);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--sideA); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--sideA); outline-offset: 2px; }

/* 라벨 공통 — 좁고 넓은 자간의 대문자 */
.label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: var(--ls-label);
    text-transform: uppercase;
    color: var(--text-fade);
}

/* ---------- 아바타 ----------
   캐릭터 대표이미지. 원본이 원형 도안이라 원으로 자른다.
   문장이 주인공이므로 어디서도 이름보다 커지지 않는다 — 크기는 --sz 하나로만 바꾼다. */

.avatar {
    --sz: 32px;
    flex: 0 0 auto;
    width: var(--sz); height: var(--sz);
    border-radius: 50%;
    border: 1px solid var(--edge);
    background: var(--surface-2);
    object-fit: cover;
    vertical-align: middle;
}
/* 이미지가 없는 관리자 — 이름 첫 글자로 대신한다 */
.avatar.is-initial {
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--mono); font-size: calc(var(--sz) * .42);
    color: var(--text-dim); letter-spacing: 0; line-height: 1;
}
.avatar.a-xs { --sz: 24px; }
.avatar.a-sm { --sz: 28px; }
.avatar.a-md { --sz: 40px; }
.avatar.a-lg { --sz: 56px; }
.avatar.a-xl { --sz: 96px; }

/* 표·목록에서 아바타와 이름을 한 줄로 묶는다 */
.namecell { display: flex; align-items: center; gap: 8px; min-width: 0; }

/* 승자만 금색 링을 두른다 */
.side.victor .avatar,
tr.rank-1 .avatar { border-color: var(--crown); }

/* ---------- 헤더 ---------- */

.masthead { border-bottom: 1px solid var(--edge); background: var(--surface); }
.masthead-inner {
    max-width: 1240px; margin: 0 auto; padding: 13px 20px;
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand {
    font-family: var(--mono);
    font-size: 13px; letter-spacing: .2em; text-transform: uppercase;
    color: var(--text-hi); font-weight: 600;
}
.brand em { font-style: normal; color: var(--sideA); }
.brand i  { font-style: normal; color: var(--sideB); }

.masthead-right {
    margin-left: auto; display: flex; align-items: center; gap: 14px;
    font-family: var(--mono); font-size: 12px; color: var(--text-dim);
}
.who { display: inline-flex; align-items: center; gap: 7px; }
.who b { color: var(--text-hi); font-weight: 600; }
.badge-admin {
    color: var(--sideC); border: 1px solid var(--sideC); border-radius: var(--r);
    padding: 1px 6px; font-size: 10px; letter-spacing: .12em;
}
/* 관전자 표식 — 참가자가 아니므로 진영색을 쓰지 않는다 */
.badge-guest {
    color: var(--text-dim); border: 1px solid var(--edge); border-radius: var(--r);
    padding: 1px 6px; font-size: 10px; letter-spacing: .12em;
}

/* ---------- 일차 셀렉터 ---------- */

.dayline { background: var(--ink); border-bottom: 1px solid var(--edge); padding: 0 20px; }
.dayline-inner {
    max-width: 1240px; margin: 0 auto;
    display: flex; align-items: center; gap: 3px;
    overflow-x: auto; padding: 9px 0;
    /* scrollbar-color 를 빼면 브라우저 기본 밝은 스크롤바가 그려진다.
       Chrome 121+ 는 scrollbar-width 가 선언된 순간 아래 ::-webkit-scrollbar 규칙을
       통째로 무시하므로, 색은 반드시 표준 속성으로 지정해야 한다. */
    scrollbar-width: thin;
    scrollbar-color: var(--edge) transparent;
}
.dayline-inner::-webkit-scrollbar { height: 3px; }
.dayline-inner::-webkit-scrollbar-track { background: transparent; }
.dayline-inner::-webkit-scrollbar-thumb { background: var(--edge); }

.daychip {
    flex: 0 0 auto;
    font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
    min-width: 34px; text-align: center;
    padding: 4px 8px;
    color: var(--text-fade);
    border: 1px solid transparent;
    border-radius: var(--r);
    position: relative;
}
.daychip:hover { color: var(--text); text-decoration: none; border-color: var(--edge); }
.daychip.has-result { color: var(--text-dim); }
.daychip.has-result::after {
    content: ""; position: absolute; left: 50%; bottom: 1px;
    transform: translateX(-50%);
    width: 12px; height: 1px; background: var(--sideA); opacity: .5;
}
.daychip.is-active {
    color: var(--ink); background: var(--text-hi); border-color: var(--text-hi); font-weight: 700;
}
.daychip.is-active::after { background: var(--ink); opacity: 1; }

/* 아직 전투가 없는 일차 — 눌러도 빈 화면이라 잠근다 */
.daychip.is-locked { opacity: .3; cursor: default; }
.daychip.is-locked:hover { color: var(--text-fade); border-color: transparent; }
/* 잠긴 일차라도 딥링크로 들어오면 현재 위치는 보여준다 */
.daychip.is-locked.is-active { opacity: .6; }

/* ---------- 내비 ---------- */

.nav { border-bottom: 1px solid var(--edge); background: var(--ink); }
.nav-inner {
    max-width: 1240px; margin: 0 auto; padding: 0 20px;
    display: flex; gap: 0; overflow-x: auto;
}
.nav a {
    font-family: var(--mono); font-size: 11px; letter-spacing: var(--ls-label); text-transform: uppercase;
    padding: 12px 15px; color: var(--text-fade);
    border-bottom: 2px solid transparent; white-space: nowrap;
}
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.is-active { color: var(--text-hi); border-bottom-color: var(--sideB); }
.nav a.admin { color: var(--sideC); margin-left: auto; }

/* ---------- 페이지 ---------- */

main { max-width: 1240px; margin: 0 auto; padding: 30px 20px 90px; }

.pagehead {
    display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
    padding-bottom: 16px; margin-bottom: 26px;
    border-bottom: 1px solid var(--edge);
}
.pagehead h1 {
    margin: 0;
    font-family: var(--mono);
    font-size: 22px; font-weight: 700; letter-spacing: -.01em;
    color: var(--text-hi);
}
.pagehead .meta {
    font-family: var(--mono); font-size: 11.5px; color: var(--text-dim);
    display: flex; gap: 12px; flex-wrap: wrap;
}
.pagehead .meta em { font-style: normal; color: var(--text-hi); }
.pagehead .right { margin-left: auto; }

.section { margin-bottom: 40px; }
.section-head {
    display: flex; align-items: baseline; gap: 12px;
    margin-bottom: 14px; padding-bottom: 8px;
    border-bottom: 1px solid var(--edge-soft);
}
.section-head h2 {
    margin: 0; font-family: var(--mono);
    font-size: 11px; letter-spacing: var(--ls-title); text-transform: uppercase;
    color: var(--text-dim); font-weight: 600;
}
.section-head .note { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-fade); }

/* ==========================================================================
   시그니처 — 대치 카드
   ========================================================================== */

.duel {
    border: 1px solid var(--edge);
    border-radius: var(--r);
    background: var(--surface);
    margin-bottom: 14px;
    overflow: hidden;
}
.duel.mine { border-color: #2C4256; box-shadow: inset 0 0 0 1px rgba(67,197,176,.10); }
.duel.is-final { border-color: rgba(242,193,78,.4); }

.duel-head {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 9px 14px;
    border-bottom: 1px solid var(--edge);
    background: var(--surface-2);
}
.duel-seq {
    font-family: var(--mono); font-size: 10px; letter-spacing: var(--ls-label);
    color: var(--text-fade); text-transform: uppercase;
}
.duel-title { font-family: var(--mono); font-size: 12px; color: var(--text); letter-spacing: .04em; }
.duel-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* 대치 그리드: 진영 | 대치선 | 진영 */
.arena {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
}
.arena.trio { grid-template-columns: 1fr auto 1fr auto 1fr; }

.side { padding: 16px 16px 18px; min-width: 0; position: relative; }
.side.b { text-align: right; }
.arena.trio .side, .arena.trio .side.b { text-align: left; }

.side-name {
    font-size: 17px; font-weight: 700; letter-spacing: -.01em;
    color: var(--text-hi); line-height: 1.25;
}
.side-arch { font-size: 11.5px; color: var(--text-dim); margin-top: 1px; }

.side.s0 .side-name { color: var(--sideA); }
.side.s1 .side-name { color: var(--sideB); }
.side.s2 .side-name { color: var(--sideC); }
.side.defeated .side-name { color: var(--defeat); }
.side.defeated .side-arch { color: var(--text-fade); }

.side-rank {
    font-family: var(--mono); font-size: 10px; letter-spacing: var(--ls-label);
    text-transform: uppercase; color: var(--text-fade); margin-bottom: 3px;
}
.side.victor .side-rank { color: var(--crown); }

/* 아바타는 진영 정렬(.side.b 는 우측)을 그대로 따른다 */
.side .avatar { margin-bottom: 5px; }
.side.defeated .avatar { opacity: .6; }

/* [비고] — 이 게임의 무기. 화면에서 가장 큰 타이포. */
.weapon {
    margin-top: 12px;
    font-family: var(--mono);
    font-size: 15px;
    line-height: 1.75;
    color: var(--text);
    border-left: 2px solid var(--edge);
    padding-left: 12px;
    text-align: left;
}
/* 본문 span 은 인라인 — 공개분과 가려진 분이 한 문장처럼 이어진다.
   pre-wrap 은 컨테이너가 아니라 span 에만 걸어 템플릿 들여쓰기가 렌더되지 않게 한다. */
.weapon > span {
    white-space: pre-wrap;
    word-break: break-word;
}
.side.s0 .weapon { border-left-color: rgba(67,197,176,.5); }
.side.s1 .weapon { border-left-color: rgba(255,126,99,.5); }
.side.s2 .weapon { border-left-color: rgba(182,156,245,.5); }
.side.b .weapon { border-left: none; border-right: 2px solid var(--edge); padding-left: 0; padding-right: 12px; text-align: right; }
.side.b.s1 .weapon { border-right-color: rgba(255,126,99,.5); }
.arena.trio .side.b .weapon {
    border-right: none; border-left: 2px solid rgba(255,126,99,.5);
    padding-right: 0; padding-left: 12px; text-align: left;
}
.weapon.empty > span { color: var(--text-fade); font-style: italic; }

.weapon-meta {
    margin-top: 7px;
    font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
    color: var(--text-fade);
}

/* 대치선 */
.versus {
    width: 44px;
    display: flex; flex-direction: column; align-items: center;
    background:
        linear-gradient(180deg, transparent, var(--edge) 18%, var(--edge) 82%, transparent) center / 1px 100% no-repeat;
    padding: 16px 0;
}
.versus span {
    font-family: var(--mono); font-size: 10px; font-weight: 700;
    letter-spacing: .1em; color: var(--text-fade);
    background: var(--surface); padding: 5px 0; width: 100%; text-align: center;
}
.duel.is-final .versus span { color: var(--crown); }

/* ---------- 판정 ---------- */

.verdict {
    border-top: 1px solid var(--edge);
    padding: 15px 18px 17px;
    background: var(--ink);
}
.verdict .label { display: block; margin-bottom: 7px; color: var(--text-fade); }
.verdict p { margin: 0 0 8px; font-size: 14px; line-height: 1.75; color: var(--text); }
.verdict p:last-child { margin-bottom: 0; }
/* 전투 기록 — 가려진 앞부분과 공개된 뒷부분이 끊김 없이 이어진다 */
.log { font-size: 14px; line-height: 1.85; color: var(--text); }
.log > span { white-space: pre-wrap; word-break: break-word; }
.log-meta {
    margin-top: 10px; font-family: var(--mono); font-size: 10.5px;
    letter-spacing: .1em; color: var(--text-fade);
}

.reasoning {
    margin-top: 13px; padding: 11px 13px;
    border-left: 2px solid var(--crown);
    background: rgba(242,193,78,.055);
    font-size: 13px; line-height: 1.7;
}
.reasoning .label { display: block; color: var(--crown); margin-bottom: 3px; }

/* ---------- 배지 ---------- */

.tag {
    display: inline-block; font-family: var(--mono);
    font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
    padding: 2px 7px; border-radius: var(--r);
    border: 1px solid currentColor; white-space: nowrap;
}
.tag.champion { color: var(--crown); background: rgba(242,193,78,.1); }
.tag.runner   { color: var(--sideA); }
.tag.semi     { color: var(--sideC); }
.tag.out      { color: var(--text-fade); }
.tag.win      { color: var(--sideA); }
.tag.lose     { color: var(--defeat); }
.tag.neutral  { color: var(--text-dim); }
.tag.locked   { color: var(--text-fade); border-style: dashed; }

/* ---------- 표 ---------- */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
    font-family: var(--mono); font-size: 10px; letter-spacing: var(--ls-label); text-transform: uppercase;
    color: var(--text-fade); text-align: left; font-weight: 500;
    padding: 8px 11px; border-bottom: 1px solid var(--edge); white-space: nowrap;
}
td { padding: 9px 11px; border-bottom: 1px solid var(--edge-soft); vertical-align: middle; }
tbody tr:hover td { background: var(--surface); }
.num { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
tr.rank-1 td { background: rgba(242,193,78,.05); }
tr.me td { background: rgba(67,197,176,.06); }

/* ---------- 패널 ---------- */

.panel {
    background: var(--surface); border: 1px solid var(--edge);
    border-radius: var(--r); padding: 17px 19px;
}
.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

.kpi { background: var(--surface); border: 1px solid var(--edge); border-radius: var(--r); padding: 14px 16px; }
.kpi .k { font-family: var(--mono); font-size: 10px; letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--text-fade); }
.kpi .v { font-family: var(--mono); font-size: 30px; font-weight: 700; color: var(--text-hi); line-height: 1.25; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 11.5px; color: var(--text-dim); }
.kpi.accent .v { color: var(--sideA); }
.kpi.crown .v { color: var(--crown); }

/* ---------- 무기 편집기 ---------- */

.forge { border: 1px solid var(--edge); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.forge-head {
    padding: 11px 16px; border-bottom: 1px solid var(--edge); background: var(--surface-2);
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.forge-body { padding: 16px; }

textarea.weapon-input {
    width: 100%; min-height: 190px;
    background: var(--ink); border: 1px solid var(--edge); border-radius: var(--r);
    color: var(--text-hi);
    font-family: var(--mono); font-size: 16px; line-height: 1.8;
    padding: 15px; resize: vertical;
}
textarea.weapon-input:focus { border-color: var(--sideA); outline: none; }
textarea.weapon-input.over { border-color: var(--sideB); }

.gauge { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.gauge .track {
    flex: 1; min-width: 180px; height: 3px; background: var(--edge);
    border-radius: 3px; overflow: hidden; position: relative;
}
.gauge .track i { display: block; height: 100%; width: 0; background: var(--sideA); transition: width .1s linear; }
.gauge.over .track i { background: var(--sideB); }
.gauge .count { font-family: var(--mono); font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.gauge .count b { color: var(--text-hi); font-weight: 700; }
.gauge.over .count b { color: var(--sideB); }

/* ---------- 폼 ---------- */

button, .btn {
    font-family: var(--mono); font-size: 11px; letter-spacing: var(--ls-label); text-transform: uppercase;
    padding: 9px 18px; border-radius: var(--r);
    border: 1px solid var(--edge); background: var(--surface-2); color: var(--text); cursor: pointer;
}
button:hover, .btn:hover { border-color: var(--sideA); color: var(--text-hi); text-decoration: none; }
button.primary, .btn.primary { border-color: var(--sideA); color: var(--sideA); }
button.primary:hover { background: rgba(67,197,176,.1); }
button.danger { border-color: var(--sideB); color: var(--sideB); }
button:disabled { opacity: .35; cursor: not-allowed; }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
    background: var(--ink); border: 1px solid var(--edge); border-radius: var(--r);
    color: var(--text); font-family: var(--mono); font-size: 13px; padding: 8px 11px;
}
input:focus, select:focus { border-color: var(--sideA); outline: none; }
label.field { display: block; margin-bottom: 14px; }
label.field > span {
    display: block; font-family: var(--mono); font-size: 10px;
    letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--text-fade); margin-bottom: 5px;
}
label.inline { display: flex; align-items: center; gap: 8px; font-size: 13px; }

/* ---------- 알림 ---------- */

.flash {
    padding: 11px 15px; border-radius: var(--r); margin-bottom: 20px;
    font-size: 13px; border: 1px solid;
}
.flash.ok  { border-color: var(--sideA); color: var(--sideA); background: rgba(67,197,176,.07); }
.flash.err { border-color: var(--sideB); color: var(--sideB); background: rgba(255,126,99,.07); }
.flash.warn{ border-color: var(--crown); color: var(--crown); background: rgba(242,193,78,.07); }

/* ---------- 스탯 ---------- */

.stats {
    display: grid; grid-template-columns: repeat(6, minmax(0,1fr));
    gap: 1px; background: var(--edge-soft);
    border: 1px solid var(--edge); border-radius: var(--r); overflow: hidden;
}
.stat { background: var(--surface); padding: 10px; text-align: center; }
.stat .k { font-size: 10.5px; color: var(--text-dim); }
.stat .v {
    font-family: var(--mono); font-size: 20px; font-weight: 700;
    color: var(--text-hi); font-variant-numeric: tabular-nums; line-height: 1.3;
}
.stat.best .v { color: var(--crown); }

/* ---------- 스파크 ---------- */

.spark { display: inline-flex; gap: 2px; align-items: flex-end; height: 20px; }
.spark i { width: 6px; border-radius: 1px 1px 0 0; background: var(--edge); display: block; height: 18%; }
.spark i.p1 { height: 30%; background: var(--sideC); }
.spark i.p2 { height: 58%; background: var(--sideA); }
.spark i.p4 { height: 100%; background: var(--crown); }

/* ---------- 이력 타임라인 ---------- */

.timeline { border-left: 1px solid var(--edge); margin-left: 7px; }
.tl-item { position: relative; padding: 0 0 26px 24px; }
.tl-item::before {
    content: ""; position: absolute; left: -5px; top: 6px;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--ink); border: 2px solid var(--edge);
}
.tl-item.edited::before { border-color: var(--sideA); background: var(--sideA); }
.tl-head {
    display: flex; align-items: baseline; gap: 11px; flex-wrap: wrap;
    font-family: var(--mono); font-size: 11px; color: var(--text-dim); margin-bottom: 8px;
}
.tl-head .day { color: var(--text-hi); font-weight: 700; font-size: 13px; }

/* ---------- 잡다 ---------- */

.muted { color: var(--text-dim); }
.fade { color: var(--text-fade); }
.right { text-align: right; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.nowrap { white-space: nowrap; }
.empty-state {
    padding: 50px 20px; text-align: center; color: var(--text-dim);
    border: 1px dashed var(--edge); border-radius: var(--r);
    font-family: var(--mono); font-size: 12px; letter-spacing: .06em;
}
hr { border: none; border-top: 1px solid var(--edge-soft); margin: 20px 0; }

/* ---------- 로그인 ---------- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
    width: 100%; max-width: 400px; background: var(--surface);
    border: 1px solid var(--edge); border-radius: var(--r); padding: 34px 30px;
}
.login-card .brand { display: block; font-size: 14px; margin-bottom: 4px; }
.login-card .tagline {
    font-family: var(--mono); font-size: 11px; color: var(--text-fade);
    letter-spacing: var(--ls-label); margin-bottom: 26px;
}
.login-card input { width: 100%; }
/* 게스트 입장 — 로그인 폼과 한 덩어리로 보이지 않게 선으로 끊는다 */
.login-guest { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--edge-soft); }

/* ---------- 반응형 ---------- */

@media (max-width: 900px) {
    .grid.c4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .grid.c3 { grid-template-columns: 1fr; }
    .stats { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 680px) {
    .grid.c2, .grid.c4 { grid-template-columns: 1fr; }
    .arena, .arena.trio { grid-template-columns: 1fr; }
    .versus {
        width: 100%; height: 30px; flex-direction: row; padding: 0;
        background: linear-gradient(90deg, transparent, var(--edge) 18%, var(--edge) 82%, transparent) center / 100% 1px no-repeat;
    }
    .versus span { width: auto; padding: 0 12px; }
    .side.b { text-align: left; }
    .side.b .weapon {
        border-right: none; border-left: 2px solid rgba(255,126,99,.5);
        padding-right: 0; padding-left: 12px; text-align: left;
    }
    .pagehead h1 { font-size: 19px; }
    main { padding: 20px 14px 60px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   대진표 — 예선 매트릭스 + 결선 브래킷
   ========================================================================== */

/* ---------- 경기 타일 ---------- */

.tile {
    display: block;
    background: var(--surface);
    border: 1px solid var(--edge);
    border-radius: var(--r);
    padding: 0;
    overflow: hidden;
    color: inherit;
    transition: border-color .12s ease, transform .12s ease;
}
.tile:hover { text-decoration: none; border-color: var(--sideA); transform: translateY(-1px); }
.tile:focus-visible { border-color: var(--sideA); }
.tile.mine { border-color: #2C4256; box-shadow: inset 0 0 0 1px rgba(67,197,176,.12); }
.tile.final { border-color: rgba(242,193,78,.45); }

.tile-top {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 9px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--edge);
}
.tile-kind {
    font-family: var(--mono); font-size: 9.5px; letter-spacing: var(--ls-label);
    text-transform: uppercase; color: var(--text-fade);
}
.tile.trio .tile-kind { color: var(--sideC); }
.tile-flags { margin-left: auto; display: flex; gap: 4px; align-items: center; }

.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot.mine-dot { background: var(--sideA); }
.dot.lock-dot { background: transparent; border: 1px solid var(--text-fade); }

.tile-rows { display: block; padding: 3px 0; }
.tile-row {
    display: flex; align-items: baseline; gap: 8px;
    padding: 4px 9px;
}
.tile-name {
    font-size: 13.5px; font-weight: 600; color: var(--text-dim);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile-rank {
    margin-left: auto; font-family: var(--mono); font-size: 9.5px;
    letter-spacing: .1em; color: var(--text-fade);
}
.tile-row.won .tile-name { color: var(--sideA); }
.tile-row.won .tile-rank { color: var(--sideA); }
.tile-row.mid .tile-name { color: var(--text); }
.tile.final .tile-row.won .tile-name { color: var(--crown); }
.tile.final .tile-row.won .tile-rank { color: var(--crown); }

/* ---------- 예선 매트릭스 ---------- */

.rounds {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.round { display: flex; flex-direction: column; gap: 9px; }
.round-head {
    font-family: var(--mono); font-size: 10px; letter-spacing: var(--ls-title);
    text-transform: uppercase; color: var(--text-fade);
    padding-bottom: 7px; border-bottom: 1px solid var(--edge);
    margin-bottom: 2px;
}
.round-head span { color: var(--text-hi); font-weight: 700; }

.legend {
    display: flex; gap: 18px; flex-wrap: wrap; margin-top: 16px;
    font-family: var(--mono); font-size: 10.5px; color: var(--text-fade);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i.sw, .legend i.sm, .legend i.sl {
    width: 12px; height: 2px; display: inline-block; border-radius: 2px;
}
.legend i.sw { background: var(--sideA); }
.legend i.sm { background: var(--text); }
.legend i.sl { background: var(--text-fade); }

@media (max-width: 900px) {
    .rounds { grid-template-columns: 1fr; }
}

/* ==========================================================================
   가려진 텍스트 — 서버가 생성한 가짜 텍스트를 강하게 블러 처리한다.
   원문은 HTML 에 존재하지 않으므로 devtools 로도 복원할 수 없다.
   ========================================================================== */

.redacted {
    filter: blur(3.6px);
    opacity: .55;
    user-select: none;
    pointer-events: none;
    color: var(--text-dim);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ==========================================================================
   6각 레이더 차트 — SVG 를 서버에서 그린다 (JS 라이브러리 없음)
   ========================================================================== */

.radar-wrap {
    display: grid;
    grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
    gap: 24px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--edge);
    border-radius: var(--r);
    padding: 18px 20px;
}

.radar { position: relative; width: 100%; max-width: 340px; margin: 0 auto; padding: 6px 0 10px; }
.radar svg { width: 100%; height: auto; display: block; overflow: visible; }

.radar-ring    { fill: none; stroke: var(--edge-soft); stroke-width: 1; }
.radar-outline { fill: none; stroke: var(--edge); stroke-width: 1.2; }
.radar-axis    { stroke: var(--edge-soft); stroke-width: 1; }
.radar-area {
    fill: rgba(67,197,176,.18);
    stroke: var(--sideA);
    stroke-width: 1.8;
    stroke-linejoin: round;
}
.radar-node { fill: var(--sideA); }

.radar-label {
    position: absolute;
    white-space: nowrap;
    line-height: 1.25;
    pointer-events: none;
}
.radar-label b {
    display: block;
    font-size: 10.5px; font-weight: 500;
    color: var(--text-dim); letter-spacing: .02em;
}
.radar-label i {
    display: block;
    font-family: var(--mono); font-style: normal;
    font-size: 14px; font-weight: 700; color: var(--text-hi);
    font-variant-numeric: tabular-nums;
}

.radar-side { min-width: 0; }
.stat-list { display: flex; flex-direction: column; gap: 7px; }
.stat-row { display: grid; grid-template-columns: 46px 1fr 34px; align-items: center; gap: 10px; }
.stat-row .n { font-size: 12px; color: var(--text-dim); }
.stat-row .bar { height: 4px; background: var(--edge-soft); border-radius: 3px; overflow: hidden; }
.stat-row .bar i { display: block; height: 100%; background: var(--sideA); border-radius: 3px; }
.stat-row .v {
    font-family: var(--mono); font-size: 13px; font-weight: 600;
    color: var(--text-hi); text-align: right; font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
    .radar-wrap { grid-template-columns: 1fr; gap: 18px; }
}

/* 캐릭터 소개 — 문단은 서버에서 <p>, **강조** 는 <b> 로 변환된다 */
.bio { font-size: 13.5px; line-height: 1.9; }
.bio p { margin: 0 0 12px; }
.bio p:last-child { margin-bottom: 0; }
.bio b { color: var(--text-hi); font-weight: 600; }

/* 가로 스크롤 영역의 스크롤바를 어두운 테마에 맞춘다 */
.nav-inner, .table-scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--edge) transparent;
}
.nav-inner::-webkit-scrollbar,
.table-scroll::-webkit-scrollbar { height: 4px; }
.nav-inner::-webkit-scrollbar-track,
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.nav-inner::-webkit-scrollbar-thumb,
.table-scroll::-webkit-scrollbar-thumb { background: var(--edge); border-radius: 4px; }

/* ==========================================================================
   결선 브래킷 — 서버가 그린 SVG. 링크가 살아 있어 클릭하면 상세로 간다.
   ========================================================================== */

.bracket-svg-wrap {
    border: 1px solid var(--edge);
    border-radius: var(--r);
    background: var(--surface);
    padding: 16px 14px 10px;
    overflow-x: auto;
}
.bracket-svg { width: 100%; min-width: 640px; height: auto; display: block; }

.bk-col {
    font-family: var(--mono); font-size: 10px; letter-spacing: var(--ls-title);
    text-transform: uppercase; fill: var(--text-fade);
}
.bk-line { fill: none; stroke: var(--edge); stroke-width: 1.4; }

.bk-rect { fill: var(--surface-2); stroke: var(--edge); stroke-width: 1; }
.bk-rect.final { stroke: rgba(242,193,78,.45); }
.bk-box { cursor: pointer; }
.bk-box:hover .bk-rect { stroke: var(--sideA); }
.bk-box.final:hover .bk-rect { stroke: var(--crown); }
.bk-box.mine .bk-rect { stroke: #2C4256; fill: #131C29; }
.bk-box:focus-visible .bk-rect { stroke: var(--sideA); stroke-width: 2; }

.bk-kind {
    font-family: var(--mono); font-size: 9.5px; letter-spacing: var(--ls-label);
    text-transform: uppercase; fill: var(--text-fade);
}
.bk-kind.final { fill: var(--crown); }

.bk-name { font-size: 15px; font-weight: 600; fill: var(--text-dim); }
.bk-name.won   { fill: var(--sideA); }
.bk-name.champ { fill: var(--crown); }
.bk-name.lost  { fill: var(--defeat); }

.bk-mark {
    font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
    fill: var(--text-fade);
}
.bk-mark.won   { fill: var(--sideA); }
.bk-mark.champ { fill: var(--crown); }

/* 브래킷 썸네일 — 탈락자는 이름과 같이 가라앉힌다 */
.bk-ava { }
.bk-ava.lost { opacity: .38; }

.bk-crown-rect { fill: rgba(242,193,78,.08); stroke: rgba(242,193,78,.45); stroke-width: 1; }
.bk-crown-mark {
    font-family: var(--mono); font-size: 9.5px; letter-spacing: var(--ls-title); fill: var(--crown);
}
.bk-crown-name { font-size: 21px; font-weight: 700; fill: var(--crown); }
.bk-crown-arch { font-size: 11.5px; fill: var(--text-dim); }

/* ==========================================================================
   전투 기록 인라인 펼침 — :target 기반, JS 0바이트
   ========================================================================== */

.log-panel { display: none; scroll-margin-top: 20px; }
.log-panel:target { display: block; }
.log-stage:has(.log-panel:target) .log-hint { display: none; }

.log-hint {
    padding: 40px 20px; text-align: center;
    border: 1px dashed var(--edge); border-radius: var(--r);
    color: var(--text-fade);
    font-family: var(--mono); font-size: 12px; letter-spacing: .06em;
}

/* 선택된 경기 박스 강조 */
.bk-box:target .bk-rect { stroke: var(--sideA); stroke-width: 2; }

/* ==========================================================================
   도움말 모달 — :target 기반, JS 0바이트
   ========================================================================== */

.modal {
    display: none;
    position: fixed; inset: 0; z-index: 100;
}
/* 헤더는 고정, 본문만 스크롤 */
/* :target 은 헤더 링크로 열 때, is-open 은 서버가 자동으로 펼 때 */
.modal:target,
.modal.is-open {
    display: grid;
    place-items: center;
    padding: 24px 16px;
}

.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(4, 6, 11, .88);
    backdrop-filter: blur(3px);
}
.modal-card {
    position: relative;
    width: 100%;
    max-width: 720px;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--edge);
    border-radius: var(--r);
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.modal-head {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 12px;
    padding: 15px 20px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--edge);
    border-radius: var(--r) var(--r) 0 0;
}
.modal-head h2 {
    margin: 0; font-family: var(--mono);
    font-size: 13px; letter-spacing: var(--ls-title); text-transform: uppercase;
    color: var(--text-hi); font-weight: 600;
}
.modal-close {
    margin-left: auto; font-size: 22px; line-height: 1;
    color: var(--text-dim); padding: 0 6px;
}
.modal-close:hover { color: var(--text-hi); text-decoration: none; }

.modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px 22px 26px;
    font-size: 13.5px; line-height: 1.85;
    scrollbar-width: thin;
    scrollbar-color: var(--edge) transparent;
}
.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: var(--edge); border-radius: 6px; }
.modal-body h3 {
    margin: 24px 0 8px;
    font-family: var(--mono); font-size: 11px; letter-spacing: var(--ls-title);
    text-transform: uppercase; color: var(--sideA); font-weight: 600;
}
.modal-body h3:first-child { margin-top: 0; }
.modal-body p { margin: 0 0 10px; color: var(--text); }
.modal-body p.fade { color: var(--text-dim); font-size: 12.5px; }
.modal-body b { color: var(--text-hi); font-weight: 600; }

.help-flow {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin: 10px 0 12px;
}
.help-flow span {
    font-family: var(--mono); font-size: 11px;
    padding: 5px 11px; border: 1px solid var(--edge); border-radius: var(--r);
    background: var(--ink); color: var(--text);
}
.help-flow i { font-style: normal; color: var(--text-fade); }

.help-table { width: 100%; margin: 8px 0 12px; font-size: 13px; }
.help-table td {
    padding: 6px 10px 6px 0;
    border-bottom: 1px solid var(--edge-soft);
    vertical-align: top; color: var(--text-dim);
}
.help-table td:first-child { white-space: nowrap; color: var(--text); width: 1%; }
/* 포상 금액 — 오른쪽으로 몰아 자릿수를 맞춘다 */
.help-table td.prize {
    white-space: nowrap; text-align: right; width: 1%;
    color: var(--text-hi); font-variant-numeric: tabular-nums;
}

.help-points { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 12px; }

.help-list { margin: 8px 0 12px; padding-left: 18px; color: var(--text-dim); }
.help-list li { margin-bottom: 6px; }

@media (max-width: 640px) {
    .modal:target,
    .modal.is-open { padding: 12px 10px; }
    .modal-card { max-height: calc(100vh - 24px); }
    .modal-body { padding: 16px 16px 22px; }
}

/* 안내 목록 — 한 줄로 붙지 않게 항목별로 끊어 보여준다 */
.notice {
    margin: 0; padding: 14px 18px 14px 34px;
    list-style: none;
    background: var(--surface-2);
    border: 1px solid var(--edge);
    border-radius: var(--r);
    font-size: 13px; line-height: 1.75;
    color: var(--text-dim);
}
.notice li { position: relative; margin-bottom: 6px; }
.notice li:last-child { margin-bottom: 0; }
.notice li::before {
    content: "—";
    position: absolute; left: -18px;
    color: var(--text-fade);
}
.notice b { color: var(--text-hi); font-weight: 600; }

/* 도움말 목록 — fade 는 색만 흐리게, 강조는 유지 */
.help-list.fade { color: var(--text-dim); }
.help-list.fade b { color: var(--text); }

/* 성적 추이 — 열 정렬을 전부 가운데로 맞춘다 */
.trend { table-layout: fixed; }
.trend th, .trend td {
    text-align: center;
    vertical-align: middle;
    padding: 9px 6px;
    white-space: nowrap;
}
.trend thead th {
    font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
    color: var(--text-dim); text-transform: none;
}
.trend thead th:first-child,
.trend tbody th[scope=row] {
    text-align: left;
    width: 56px;
    font-family: var(--mono); font-size: 10px; letter-spacing: var(--ls-label);
    text-transform: uppercase; color: var(--text-fade); font-weight: 500;
    padding-left: 0;
}
.trend tbody th[scope=row] { border-bottom: 1px solid var(--edge-soft); }
.trend tbody tr:hover td { background: transparent; }
.trend .tag { font-size: 9.5px; padding: 1px 5px; }
.trend-pt {
    font-family: var(--mono); font-size: 14px; font-weight: 700;
    color: var(--text-fade); font-variant-numeric: tabular-nums;
}
.trend-pt.got { color: var(--text-hi); }
.trend-r1 { font-family: var(--mono); font-size: 10.5px; color: var(--text-fade); }

/* ==========================================================================
   기록 — 일자별 요약 행 + 전체 매트릭스
   ========================================================================== */

.dayrow {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    padding: 13px 16px; margin-bottom: 8px;
    background: var(--surface);
    border: 1px solid var(--edge);
    border-radius: var(--r);
    color: inherit;
    transition: border-color .12s ease;
}
.dayrow:hover { text-decoration: none; border-color: var(--sideA); }
.dayrow-day {
    font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
    color: var(--text-fade); white-space: nowrap;
}
.dayrow-day b { font-size: 15px; color: var(--text-hi); margin-left: 3px; }
.dayrow-date, .dayrow-limit {
    font-family: var(--mono); font-size: 11px; color: var(--text-fade); white-space: nowrap;
}
.dayrow-podium { display: flex; gap: 18px; flex-wrap: wrap; flex: 1; min-width: 0; }
.pod { display: flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.pod i {
    font-style: normal; font-family: var(--mono);
    font-size: 9.5px; letter-spacing: var(--ls-label); color: var(--text-fade);
}
.pod b { font-size: 14px; font-weight: 600; }
.pod.champ b  { color: var(--crown); }
.pod.runner b { color: var(--sideA); }
.pod.semi b   { color: var(--text-dim); font-weight: 500; font-size: 13px; }
.dayrow-status { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.dayrow-go { color: var(--text-fade); font-family: var(--mono); }
.dayrow:hover .dayrow-go { color: var(--sideA); }

/* 매트릭스 */
.matrix { table-layout: fixed; }
.matrix th, .matrix td { text-align: center; padding: 6px 4px; }
.matrix thead th {
    font-family: var(--mono); font-size: 11px; color: var(--text-dim);
    text-transform: none; letter-spacing: .04em;
}
.matrix thead th:first-child,
.matrix tbody th[scope=row] {
    text-align: left; width: 72px; white-space: nowrap;
    font-size: 13px; color: var(--text); font-weight: 500;
    padding-left: 0; text-transform: none; letter-spacing: 0;
}
.matrix tbody th[scope=row] { border-bottom: 1px solid var(--edge-soft); }
.matrix tbody tr:hover td { background: transparent; }

.mx {
    display: inline-block; width: 26px; line-height: 22px;
    border-radius: var(--r);
    font-family: var(--mono); font-size: 11.5px; font-weight: 600;
    font-variant-numeric: tabular-nums;
}
a.mx:hover { text-decoration: none; outline: 1px solid currentColor; }
.mx.champ  { background: rgba(242,193,78,.20);  color: var(--crown); }
.mx.runner { background: rgba(67,197,176,.18);  color: var(--sideA); }
.mx.semi   { background: rgba(182,156,245,.16); color: var(--sideC); }
.mx.out    { background: var(--edge-soft);      color: var(--text-fade); }
.mx.none   { color: var(--edge); }
.mx-sum {
    font-family: var(--mono); font-size: 13px; font-weight: 700;
    color: var(--text-hi); font-variant-numeric: tabular-nums;
}

/* ---------- 비밀번호 변경 모달 ----------
   input 에는 전역 폭 규칙이 없다 (로그인 화면만 .login-card input 으로 채운다).
   모달 안에서도 입력칸이 버튼과 같은 폭이어야 균형이 맞는다. */

#pw .modal-body input { width: 100%; }
#pw .modal-card { max-width: 400px; }
#pw .notice { font-size: 12.5px; }
#pw .pw-later { text-align: center; margin: 16px 0 0; font-size: 12px; }
#pw .pw-later a { color: var(--text-dim); }

/* 비밀번호를 바꾼 뒤 내려오는 알림 — main 과 같은 폭 */
.pwflash { max-width: 1240px; margin: 0 auto; padding: 24px 20px 0; }
