:root {
  --bg: #17120d; --panel: #2a2017; --panel2: #34281c; --line: #6b5233; --gold: #e3b765;
  --text: #f1e6d2; --muted: #b9a68a; --bad: #ff8f7a; --good: #9fe0a0; --focus: #ffd98a;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 50% -20%, #3d2c1a, var(--bg) 60%) fixed; color: var(--text); line-height: 1.5; }
a { color: var(--gold); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: var(--panel); padding: 6px 10px; z-index: 10; }

.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 16px;
  background: linear-gradient(#3a2a19, #241a10); border-bottom: 2px solid var(--line); }
.brand { font-size: 1.3rem; font-weight: bold; text-decoration: none; letter-spacing: .04em; text-shadow: 0 1px 0 #000; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav a { display: block; padding: 6px 10px; border-radius: 6px; text-decoration: none; color: var(--text); }
.nav a[aria-current="page"], .nav a:hover { background: var(--panel2); color: var(--gold); }
.userbox { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .95rem; }
.money { color: var(--gold); }
.badge { padding: 1px 8px; border-radius: 10px; background: #5a2a1c; color: #ffd0c4; font-size: .85rem; }

main { max-width: 1100px; margin: 0 auto; padding: 16px; }
main:focus { outline: none; }
h1 { font-size: 1.5rem; margin: 8px 0 12px; color: var(--gold); }
h2 { font-size: 1.15rem; margin: 16px 0 8px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin: 12px 0; }
.notice { max-width: 1100px; margin: 10px auto 0; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); }
.notice.error, .msg.error { border-color: var(--bad); color: var(--bad); }
.notice.ok, .msg.ok { border-color: var(--good); color: var(--good); }
.msg { min-height: 1.5em; margin: 6px 0; }
.muted { color: var(--muted); }
.warn { border-left: 4px solid var(--bad); padding-left: 10px; }

form.stack { display: grid; gap: 10px; max-width: 420px; }
label { display: block; font-weight: bold; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: 7px 9px; background: #1d1610; border: 1px solid var(--line); border-radius: 6px; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--bad); }
input[type=checkbox] { width: auto; }
input.qty { width: 5em; }
textarea { min-height: 10em; resize: vertical; }
textarea.short { min-height: 5em; }
button, .btn { display: inline-block; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--gold);
  background: linear-gradient(#6b4b22, #4a3214); color: var(--text); cursor: pointer; text-decoration: none; }
button.secondary { border-color: var(--line); background: var(--panel2); }
button.danger { border-color: var(--bad); background: #4a1d14; }
button:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.row > * { flex: 0 1 auto; }
.row .grow { flex: 1 1 200px; }
.hint { font-size: .85rem; color: var(--muted); font-weight: normal; }
.field-error { color: var(--bad); font-size: .9rem; font-weight: normal; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 8px; border-bottom: 1px solid #4a3a26; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: normal; font-size: .9rem; }
td.num, th.num { text-align: right; }
.grade-1 { color: #9fd0ff; } .grade-2 { color: #ffd36b; } .grade-3, .grade-4 { color: #e09bff; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 12px 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tabs button[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }

.post-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.comment { border-top: 1px solid #4a3a26; padding: 8px 0; }
.comment p { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; list-style: none; padding: 0; }
.cards li { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.album { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.card-art { aspect-ratio: 3 / 4; background: #1d1610; border: 1px solid var(--line); border-radius: 6px; display: grid; place-items: center; overflow: hidden; }
.card-art img { width: 100%; height: 100%; object-fit: contain; }
.card-art-none { color: var(--muted); font-size: 1.1rem; }
.card-title { margin: 6px 0 2px; font-weight: bold; }
.album dl { display: grid; grid-template-columns: auto auto; gap: 0 8px; margin: 0; font-size: .9rem; }
.album dt { color: var(--muted); } .album dd { margin: 0; text-align: right; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.countdown { font-variant-numeric: tabular-nums; color: var(--gold); font-weight: bold; }
.picker-results { max-height: 260px; overflow: auto; }

@media (max-width: 720px) {
  .userbox { margin-left: 0; width: 100%; }
  .sides { grid-template-columns: 1fr; }
  table.responsive, table.responsive tbody { display: block; width: 100%; }
  table.responsive thead { display: none; }
  table.responsive tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  table.responsive td { display: flex; justify-content: space-between; gap: 8px; border: 0; padding: 3px 4px; text-align: right; }
  table.responsive td::before { content: attr(data-label); color: var(--muted); text-align: left; flex: 0 0 auto; }
  table.responsive td > * { min-width: 0; overflow-wrap: anywhere; }
  .row .grow { flex-basis: 100%; }
}
