/* NTCH Conan TCG. NTCH Co brand book: Day Deck / Night Deck, Fredoka + Mitr. */
:root {
  --bg: #FBF3E4; --surface: #FFFFFF; --raised: #FFF1E6; --ink: #3B2850; --mute: #6B5A7E; --line: #E4D6E8;
  --accent: #DD7246; --accent-text: #A8431C; --lilac: #714F8B; --gold: #F5BD66; --good: #1E7D4F; --bad: #B3261E; --warn: #8A5200;
  --cw: 104px; --ch: calc(var(--cw) * 1.4);
  --c-blue: #2F6FD6; --c-green: #2A9A58; --c-white: #9AA3B5; --c-red: #D14343; --c-yellow: #D9A514; --c-black: #2B2F38;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #130D1A; --surface: #1E1529; --raised: #2A1E3A; --ink: #F3EAF7; --mute: #B9A8C6; --line: #3D2D52;
    --accent-text: #F5BD66; --good: #58C08B; --bad: #F0796F; --warn: #E5A14A; --c-black: #9AA0B0; --c-white: #D5DBE6; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #130D1A; --surface: #1E1529; --raised: #2A1E3A; --ink: #F3EAF7; --mute: #B9A8C6; --line: #3D2D52;
  --accent-text: #F5BD66; --good: #58C08B; --bad: #F0796F; --warn: #E5A14A; --c-black: #9AA0B0; --c-white: #D5DBE6; color-scheme: dark; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 "Fredoka", "Mitr", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
h1 { font-size: 26px; margin: 6px 0 4px; } h2 { font-size: 18px; margin: 0 0 8px; } h3 { font-size: 15px; margin: 12px 0 4px; }
small, .mute { color: var(--mute); }
header.top { background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 4px 16px; position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.hub { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin-left: -7px; border-radius: 10px; }
.brand { font-weight: 600; font-size: 17px; color: var(--ink); text-decoration: none; }
.brand span { color: var(--accent-text); }
nav.site { display: flex; gap: 4px; margin-left: auto; }
nav.site a { padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--ink); }
nav.site a.on { background: var(--lilac); color: #fff; }
main { max-width: 1240px; margin: 0 auto; padding: 14px 16px 30px; }
footer { color: var(--mute); font-size: 12.5px; text-align: center; padding: 10px 16px 28px; max-width: 900px; margin: 0 auto; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.row + .row { margin-top: 10px; }
input[type=text], input[type=search], input[type=number], select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; min-width: 0; max-width: 100%; }
textarea { width: 100%; min-height: 140px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.btn { background: var(--raised); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; min-height: 36px; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.sm { padding: 3px 10px; min-height: 30px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.on { background: var(--lilac); border-color: var(--lilac); color: #fff; }
.chip { display: inline-block; background: var(--raised); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; font-size: 12.5px; white-space: nowrap; }
.chip.good { border-color: var(--good); color: var(--good); } .chip.bad { border-color: var(--bad); color: var(--bad); } .chip.hot { background: var(--lilac); border-color: var(--lilac); color: #fff; }
.note { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13.5px; margin: 8px 0; }
.note.err { border-color: var(--bad); color: var(--bad); } .note.ok { border-color: var(--good); color: var(--good); } .note.warn { border-color: var(--warn); color: var(--warn); }
.note ul { margin: 0; padding-left: 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.tile { display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.tile:hover { border-color: var(--accent); }
.tile b { font-size: 19px; display: block; }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--cw), 1fr)); gap: 8px; }
.card { width: 100%; aspect-ratio: 5 / 7; border-radius: 8px; border: 3px solid var(--c-white); background: var(--surface); position: relative; overflow: hidden; display: flex; flex-direction: column;
  padding: 3px 5px; font-size: 11px; line-height: 1.2; text-align: left; cursor: pointer; color: var(--ink); user-select: none; -webkit-user-select: none; }
.card.c-blue { border-color: var(--c-blue); } .card.c-green { border-color: var(--c-green); } .card.c-white { border-color: var(--c-white); } .card.c-red { border-color: var(--c-red); }
.card.c-yellow { border-color: var(--c-yellow); } .card.c-black { border-color: var(--c-black); }
.card.d-blue { border-right-color: var(--c-blue); border-bottom-color: var(--c-blue); } .card.d-green { border-right-color: var(--c-green); border-bottom-color: var(--c-green); }
.card.d-white { border-right-color: var(--c-white); border-bottom-color: var(--c-white); } .card.d-red { border-right-color: var(--c-red); border-bottom-color: var(--c-red); }
.card.d-yellow { border-right-color: var(--c-yellow); border-bottom-color: var(--c-yellow); } .card.d-black { border-right-color: var(--c-black); border-bottom-color: var(--c-black); }
.card .lv { font-weight: 700; font-size: 12px; background: var(--ink); color: var(--bg); border-radius: 50%; width: 20px; height: 20px; display: grid; place-items: center; flex: none; }
.card .ty { position: absolute; top: 5px; right: 5px; font-size: 9.5px; color: var(--mute); }
.card .nm { flex: 1; margin-top: 3px; font-weight: 600; overflow: hidden; word-break: break-word; }
.card .st { display: flex; justify-content: space-between; font-size: 10.5px; font-weight: 700; gap: 2px; }
.card .st .lp { color: var(--good); } .card .st .ap { color: var(--bad); }
.card .tag { position: absolute; left: 3px; bottom: 19px; font-size: 9px; background: var(--good); color: #fff; border-radius: 4px; padding: 0 3px; }
.card img.art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--surface); }
.card:has(img.art) { border-width: 0; padding: 0; } .card:has(img.art) .tag { bottom: 4px; } .card:has(img.art) .n { bottom: 4px; }
.detail { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 14px; align-items: start; }
.detail .pic img { width: 100%; border-radius: 10px; display: block; }
.detail:not(:has(.pic img)) { grid-template-columns: minmax(0, 1fr); }
details > summary { cursor: pointer; color: var(--mute); margin-top: 8px; }
@media (max-width: 560px) { .detail { grid-template-columns: minmax(0, 1fr); } .detail .pic { max-width: 200px; margin: 0 auto; } }
.card.down { background: repeating-linear-gradient(45deg, #3B2850, #3B2850 6px, #714F8B 6px, #714F8B 12px); border-color: #2a1c3a; color: #fff; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; cursor: default; }
.card .n { position: absolute; right: 3px; bottom: 15px; background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 0 6px; }
.dlg { position: fixed; inset: 0; z-index: 50; background: #0008; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; overflow-y: auto; }
.dlg[hidden] { display: none; }
.dbox { background: var(--surface); border-radius: 16px; padding: 16px; width: 760px; max-width: 100%; }
.dbox .txt { white-space: pre-wrap; background: var(--bg); border-radius: 8px; padding: 8px 10px; margin: 6px 0; font-size: 14px; }
.dbox dl { margin: 6px 0; } .dbox dt { font-weight: 600; margin-top: 8px; } .dbox dd { margin: 2px 0 0; color: var(--mute); }
.acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* decks */
.cols { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 12px; align-items: start; }
.drow { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); padding: 4px 0; font-size: 14px; }
.drow .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 11px; height: 11px; border-radius: 50%; flex: none; background: var(--c-white); }
.dot.c-blue { background: var(--c-blue); } .dot.c-green { background: var(--c-green); } .dot.c-red { background: var(--c-red); } .dot.c-yellow { background: var(--c-yellow); } .dot.c-black { background: var(--c-black); }

/* play */
.play, .prompt { --cw: 86px; }
.play { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 10px; align-items: start; }
.prompt { background: var(--surface); border: 2px solid var(--accent); border-radius: 12px; padding: 8px 12px; margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; position: sticky; top: 54px; z-index: 10; }
.prompt > span { flex: 1 1 240px; }
.mat { background: var(--raised); border: 2px solid var(--line); border-radius: 14px; padding: 8px; margin-bottom: 8px; }
.mat.active { border-color: var(--accent); }
.mhead { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; font-size: 13.5px; }
.zones { display: grid; gap: 6px; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "case scene scene deck" "partner file evidence removed" "hand hand hand hand"; }
.zone { background: var(--surface); border: 1px dashed var(--line); border-radius: 10px; padding: 3px 6px 6px; min-width: 0; }
.zone > i { font-style: normal; font-size: 11.5px; color: var(--mute); display: block; margin-bottom: 2px; white-space: nowrap; }
.zc { display: flex; gap: 5px; align-items: center; overflow-x: auto; min-height: var(--ch); }
.zc .cw { flex: none; width: var(--cw); height: var(--ch); display: flex; align-items: center; justify-content: center; }
.zc .cw.sleep { width: var(--ch); } .zc .cw.sleep .card { transform: rotate(90deg); } .zc .cw.stun .card { transform: rotate(180deg); }
.zc .card { width: var(--cw); height: var(--ch); aspect-ratio: auto; flex: none; }
.zc.stack .cw + .cw { margin-left: calc(var(--cw) * -0.7); }
.zc.stack .cw.sleep + .cw { margin-left: 4px; }
.z-case { grid-area: case; } .z-scene { grid-area: scene; } .z-deck { grid-area: deck; } .z-partner { grid-area: partner; } .z-file { grid-area: file; } .z-evidence { grid-area: evidence; } .z-removed { grid-area: removed; } .z-hand { grid-area: hand; }
.card.pick { outline: 3px dashed var(--accent); outline-offset: 1px; } .card.sel { outline: 4px solid var(--accent); transform: translateY(-5px); } .card.can { box-shadow: 0 0 0 2px var(--gold); }
.log { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; position: sticky; top: 54px; }
.log ol { list-style: none; margin: 0; padding: 0; max-height: 70vh; overflow-y: auto; font-size: 12.5px; }
.log li { padding: 3px 0; border-bottom: 1px solid var(--line); } .log li.turn { font-weight: 700; color: var(--accent-text); } .log li.end, .log li.good { font-weight: 700; color: var(--good); }
.menu { position: fixed; z-index: 40; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px #0005; padding: 10px; width: 320px; max-width: calc(100vw - 16px); max-height: 80vh; overflow-y: auto; }
.menu[hidden] { display: none; }
.menu .txt { white-space: pre-wrap; font-size: 12.5px; background: var(--bg); border-radius: 6px; padding: 5px 7px; margin: 6px 0; }
.menu button.mi { display: block; width: 100%; text-align: left; background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; margin-top: 5px; }
.menu .why { font-size: 12.5px; color: var(--warn); margin-top: 4px; }
@media (max-width: 900px) { .cols, .play { grid-template-columns: minmax(0, 1fr); } .log { position: static; } .log ol { max-height: 200px; } }
@media (max-width: 640px) { :root { --cw: 84px; } .play, .prompt { --cw: 58px; } .card { font-size: 9.5px; border-width: 2px; padding: 2px 3px; } .card .ty { display: none; } .card .lv { width: 16px; height: 16px; font-size: 10.5px; }
  .zones { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "scene scene scene scene" "case partner deck removed" "file file evidence evidence" "hand hand hand hand"; } nav.site a { padding: 6px 9px; } }
