/* ==========================================================================
   FZU DOCTOR // app pages (archive, ranking, gate, migrate)
   ========================================================================== */
body.app {
  background:
    radial-gradient(60% 40% at 85% -5%, rgba(255, 229, 0, .06), transparent 70%),
    radial-gradient(50% 40% at 0% 0%, rgba(58, 212, 255, .05), transparent 70%),
    linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px) 0 0 / 100% 48px,
    var(--bg);
  background-attachment: fixed;
}
.app-main { padding-top: calc(var(--topbar-h) + clamp(28px, 4vw, 56px)); padding-bottom: 80px; min-height: 80vh; }

.app-head { display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 12px clamp(16px, 3vw, 36px); margin-bottom: clamp(24px, 3vw, 40px); padding-bottom: 22px; border-bottom: 1px solid var(--line); position: relative; }
.app-head::after { content: ""; position: absolute; left: 0; bottom: -2px; width: 64px; height: 3px; background: var(--y); }
.app-head__idx { font: 800 clamp(44px, 6vw, 84px)/.8 var(--f-en); font-stretch: 125%; color: transparent; -webkit-text-stroke: 1px var(--line-3); letter-spacing: -.03em; }
.app-head__meta { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 10px; }
.app-head h1 { font-size: clamp(30px, 4vw, 52px); }
.app-head__ctl { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.app-head__ctl .select { width: auto; min-height: 40px; padding: 8px 12px; font-size: 12px; }

.app-grid { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: clamp(16px, 2vw, 28px); align-items: start; }
.side { display: grid; gap: 16px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.card { padding: 18px; }
.card__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.card__head .mono { font-size: 10px; letter-spacing: .16em; }
.note { margin: 10px 0 12px; font-size: 12px; line-height: 1.7; color: var(--fg-3); }

.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { position: relative; padding: 10px 12px; font-size: 13px; color: var(--fg-2); }
.tabs button[aria-selected="true"] { color: var(--fg); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--y); }
.howto { counter-reset: s; display: grid; gap: 10px; margin-bottom: 14px; }
.howto li { counter-increment: s; position: relative; padding-left: 28px; font-size: 12.5px; line-height: 1.7; color: var(--fg-1); }
.howto li::before { content: counter(s, decimal-leading-zero); position: absolute; left: 0; top: 1px; font: 600 11px/1.6 var(--f-mono); color: var(--y); }
.howto a { color: var(--y); border-bottom: 1px dashed rgba(255, 229, 0, .5); word-break: break-all; }
.howto a.mono { font-size: 11.5px; }
.textarea { font-size: 12px; }

.roles { display: grid; gap: 8px; margin: 0 0 12px; }
.roles button { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; text-align: left; border: 1px solid var(--line-2); transition: border-color .2s, background .2s; }
.roles button:hover, .roles button[aria-pressed="true"] { border-color: var(--y); background: rgba(255, 229, 0, .05); }
.roles b { font-size: 13px; }
.roles small { font: 500 10px/1.4 var(--f-mono); color: var(--fg-3); letter-spacing: .08em; }

.term {
  margin: 12px 0 0; max-height: 220px; overflow: auto; padding: 10px 12px;
  background: #050607; border: 1px solid var(--line); color: var(--fg-2);
  font: 400 11px/1.65 var(--f-mono); white-space: pre-wrap; word-break: break-all;
}
.term .ok { color: var(--ok); } .term .bad { color: var(--red); } .term .y { color: var(--y); }

.drop { display: grid; gap: 8px; place-items: center; text-align: center; padding: 34px 16px; border: 1px dashed var(--line-3); cursor: pointer; transition: border-color .2s, background .2s; }
.drop:hover, .drop.is-over { border-color: var(--y); background: rgba(255, 229, 0, .04); }
.drop b { font-size: 14px; }
.drop span { font-size: 12px; color: var(--fg-3); line-height: 1.6; }

.team-join { display: grid; gap: 12px; }
.team-in__who { font-size: 13px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.team-in__btns { display: flex; flex-wrap: wrap; gap: 8px; }
.switch { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; font-size: 13px; color: var(--fg-1); cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { position: relative; width: 34px; height: 18px; border: 1px solid var(--line-3); transition: background .2s, border-color .2s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; background: var(--fg-2); transition: transform .25s var(--ease-out), background .2s; }
.switch input:checked + span { border-color: var(--y); background: rgba(255, 229, 0, .12); }
.switch input:checked + span::after { transform: translateX(16px); background: var(--y); }
.switch input:focus-visible + span { outline: 2px solid var(--y); outline-offset: 2px; }
.linkbtn { margin-top: 10px; font-size: 12px; color: var(--fg-3); border-bottom: 1px dashed var(--line-3); }
.linkbtn:hover { color: var(--red); border-color: var(--red); }

/* board ------------------------------------------------------------------- */
.board { min-width: 0; }
.empty { display: grid; place-items: center; gap: 12px; padding: clamp(60px, 10vw, 120px) 20px; text-align: center; border: 1px dashed var(--line-2); background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .012) 0 12px, transparent 12px 24px); }
.empty__code { font-size: 12px; letter-spacing: .4em; color: var(--y); }
.empty .h-zh { font-size: clamp(22px, 2.6vw, 32px); }
.dash { display: grid; gap: 22px; }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.kpi { position: relative; display: grid; gap: 6px; align-content: start; padding: 16px 16px 14px; background: var(--bg-1); min-width: 0; }
.kpi b { font: 600 clamp(22px, 2.3vw, 32px)/1 var(--f-mono); letter-spacing: -.01em; white-space: nowrap; }
.kpi small { font-size: 11.5px; color: var(--fg-3); }
.kpi--hl::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--y); }

.luck { display: grid; grid-template-columns: auto 1fr; gap: 18px 28px; align-items: center; padding: 20px 22px; overflow: hidden; }
.luck__dial { position: relative; width: 132px; height: 132px; }
.luck__dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.luck__dial b { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; font: 700 30px/1 var(--f-mono); }
.luck__dial b small { display: block; margin-top: 6px; font: 500 9.5px/1 var(--f-mono); letter-spacing: .2em; color: var(--fg-3); }
.luck__txt h3 { font-size: clamp(18px, 1.8vw, 24px); font-weight: 900; line-height: 1.4; }
.luck__txt p { margin-top: 8px; font-size: 13px; color: var(--fg-2); line-height: 1.8; }
.luck__txt .tag { margin-right: 8px; }

.block { display: grid; gap: 12px; }
.block__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.block__head .mono { font-size: 10.5px; letter-spacing: .1em; }
.block.two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.pities { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.pity { padding: 16px; border: 1px solid var(--line); background: var(--bg-1); display: grid; gap: 12px; min-width: 0; }
.pity__top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.pity__name { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pity__name small { margin-left: 8px; font: 500 9.5px/1 var(--f-mono); letter-spacing: .12em; color: var(--fg-3); }
.pity__cnt { font: 700 26px/1 var(--f-mono); }
.pity__cnt small { font-size: 11px; color: var(--fg-3); font-weight: 500; }
.pity__bar { position: relative; height: 8px; background: rgba(255, 255, 255, .06); }
.pity__bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--ok), var(--y) 60%, var(--o)); }
.pity__bar u { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--fg-3); }
.pity__meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-size: 11.5px; color: var(--fg-3); }
.pity__meta b { display: block; margin-top: 3px; font: 600 14px/1 var(--f-mono); color: var(--fg); }
.pity__six { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; font-size: 12px; border: 1px solid var(--line-2); white-space: nowrap; }
.chip b { font: 600 11px/1 var(--f-mono); }
.chip.g b { color: var(--ok); } .chip.m b { color: var(--y); } .chip.b b { color: var(--red); }

.chart { padding: 16px; min-width: 0; }
.chart canvas { width: 100%; height: 220px; margin-top: 10px; }

.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.six {
  position: relative; display: grid; gap: 4px; padding: 12px 12px 10px; overflow: hidden;
  background: linear-gradient(135deg, rgba(255, 122, 26, .16), rgba(255, 122, 26, .02) 60%), var(--bg-1);
  border: 1px solid rgba(255, 122, 26, .3);
}
.six::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--c6, var(--o)); }
.six b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.six span { font: 500 10px/1.4 var(--f-mono); color: var(--fg-3); letter-spacing: .06em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.six em { position: absolute; right: 10px; top: 10px; font: 700 18px/1 var(--f-mono); font-style: normal; color: var(--c6, var(--o)); }
.six.is-new::before { content: "NEW"; position: absolute; right: 10px; bottom: 10px; font: 700 8.5px/1 var(--f-mono); padding: 2px 4px; background: var(--y); color: #000; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { position: sticky; top: 0; padding: 10px 12px; text-align: left; font: 500 10px/1 var(--f-mono); letter-spacing: .16em; color: var(--fg-3); background: var(--bg-2); border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tr.r6 td:nth-child(2) { color: var(--r6); font-weight: 700; }
.table tr.r5 td:nth-child(2) { color: var(--r5); }
.table tr.r4 td:nth-child(2) { color: var(--r4); }
.table td.mono { font-size: 12px; color: var(--fg-2); }
.seg--sm button { padding: 7px 11px; font-size: 10.5px; }

/* ranking ----------------------------------------------------------------- */
.rank-ctl { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.lb { padding: 18px; }
.lb__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.lb__head h3 { font-size: 20px; font-weight: 900; }
.lb__head small { font: 500 10px/1 var(--f-mono); letter-spacing: .16em; color: var(--fg-3); }
.lb ol { display: grid; }
.lb li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.lb li:last-child { border-bottom: 0; }
.lb li i { font: 700 13px/1 var(--f-mono); font-style: normal; color: var(--fg-3); }
.lb li:nth-child(1) i { color: var(--y); } .lb li:nth-child(2) i { color: var(--fg-1); } .lb li:nth-child(3) i { color: var(--o); }
.lb li b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb li span { font: 600 14px/1 var(--f-mono); }
.lb li small { display: block; margin-top: 3px; font: 400 11px/1.3 var(--f-body); color: var(--fg-3); }
.lb .none { padding: 18px 0; font-size: 13px; color: var(--fg-3); }

.report { margin-top: clamp(40px, 6vw, 72px); }
.rep { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 20px; }
.rep__hero { padding: clamp(20px, 3vw, 36px); background: linear-gradient(140deg, #14161a, #0b0c0e); border: 1px solid var(--line); position: relative; overflow: hidden; }
.rep__hero::before { content: ""; position: absolute; right: -40px; top: -40px; width: 220px; height: 220px; background: repeating-linear-gradient(-45deg, rgba(255, 229, 0, .1) 0 10px, transparent 10px 20px); transform: rotate(8deg); }
.rep__month { font: 800 clamp(48px, 7vw, 96px)/.85 var(--f-en); font-stretch: 125%; letter-spacing: -.03em; }
.rep__month span { color: var(--y); }
.rep__lines { margin-top: 22px; display: grid; gap: 10px; font-size: clamp(14px, 1.25vw, 17px); line-height: 1.75; color: var(--fg-1); }
.rep__lines b { color: var(--fg); font-family: var(--f-mono); }
.rep__lines em { font-style: normal; color: var(--y); font-weight: 700; }
.rep__side { display: grid; gap: 12px; align-content: start; }
.rep__stat { display: grid; grid-template-columns: 1fr auto; align-items: baseline; padding: 14px 16px; border: 1px solid var(--line); background: var(--bg-1); }
.rep__stat b { font: 600 22px/1 var(--f-mono); }
.rep__sixes { display: flex; flex-wrap: wrap; gap: 6px; }
.rep canvas { width: 100%; height: 160px; }

/* gate / migrate ---------------------------------------------------------- */
.gate { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: calc(var(--topbar-h) + 20px) var(--gutter) 40px; }
.gate__box { width: min(520px, 100%); padding: clamp(24px, 4vw, 40px); position: relative; }
.gate__box .h-zh { font-size: clamp(26px, 3vw, 36px); margin: 14px 0 10px; }
.gate__box form { display: grid; gap: 14px; margin-top: 22px; }
.gate__err { min-height: 1.4em; font-size: 12.5px; color: var(--red); }
.gate__scan { position: absolute; left: 0; right: 0; height: 2px; top: 0; background: linear-gradient(90deg, transparent, var(--y), transparent); animation: scan 2.6s var(--ease-io) infinite; opacity: .7; }
@keyframes scan { 0% { top: 0; } 50% { top: calc(100% - 2px); } 100% { top: 0; } }
.mig-list { display: grid; gap: 6px; margin: 16px 0; max-height: 260px; overflow: auto; }
.mig-list li { display: flex; justify-content: space-between; gap: 12px; font: 400 12px/1.5 var(--f-mono); color: var(--fg-2); padding: 6px 10px; border: 1px solid var(--line); }
.mig-list li b { color: var(--fg); font-weight: 500; }
.footer--slim { padding: 0 0 28px; }
.footer--slim .footer__legal { margin-top: 0; }

/* responsive -------------------------------------------------------------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .app-grid { grid-template-columns: 1fr; }
  .side { position: static; }
  .block.two, .rep { grid-template-columns: 1fr; }
  .app-head { grid-template-columns: auto 1fr; }
  .app-head__ctl { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .luck { grid-template-columns: 1fr; justify-items: start; }
  .pities { grid-template-columns: 1fr; }
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table td:nth-child(5), .table th:nth-child(5) { display: none; }
}
