/* 13花 — shared design tokens and controls (game + admin). */
@font-face { font-family: "Cinzel"; src: url("/fonts/cinzel-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("/fonts/cinzel-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("/fonts/cinzel-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("/fonts/playfair-display-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("/fonts/playfair-display-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #07090d;
  --bg-2: #0c1017;
  --panel: #11161f;
  --panel-2: #161c27;
  --line: rgba(216, 181, 106, .16);
  --line-strong: rgba(216, 181, 106, .38);
  --gold: #d8b56a;
  --gold-hi: #f7e6ad;
  --gold-lo: #9a7430;
  --ivory: #f3ecdc;
  --text: #e9e3d3;
  --muted: #98a0ae;
  --faint: #626b7a;
  --felt: #5c1322;
  --felt-hi: #82203a;
  --felt-lo: #2a070f;
  --crimson: #c2203d;
  --danger: #e0574f;
  --ok: #45c08c;
  --blue: #6aa5ff;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .55);
  --display: "Cinzel", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  --serif: "Playfair Display", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", Georgia, serif;
  --sans: "Inter", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gold-grad: linear-gradient(135deg, #fbeab4 0%, #e2bd66 38%, #b98a35 72%, #f0d58a 100%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: var(--gold); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
::selection { background: rgba(216, 181, 106, .35); }
* { scrollbar-width: thin; scrollbar-color: rgba(216, 181, 106, .28) transparent; }

.display { font-family: var(--display); letter-spacing: .08em; text-transform: uppercase; }
.gold-text {
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 42px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: rgba(216, 181, 106, .06); color: var(--gold-hi);
  font-weight: 600; font-size: 14px; letter-spacing: .02em; white-space: nowrap;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s;
  user-select: none;
}
.btn:hover { background: rgba(216, 181, 106, .14); border-color: var(--gold); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn:focus-visible, .input:focus-visible, .seg button:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.gold {
  background: var(--gold-grad); color: #2a1d05; border-color: #f7e6ad;
  box-shadow: 0 6px 22px rgba(216, 181, 106, .28), inset 0 1px 0 rgba(255, 255, 255, .6);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
}
.btn.gold:hover { filter: brightness(1.07); box-shadow: 0 8px 28px rgba(216, 181, 106, .42), inset 0 1px 0 rgba(255, 255, 255, .6); }
.btn.dark { background: #0d1118; border-color: rgba(255, 255, 255, .12); color: var(--text); }
.btn.dark:hover { border-color: var(--line-strong); }
.btn.danger { border-color: rgba(224, 87, 79, .55); color: #ffb3ad; background: rgba(224, 87, 79, .08); }
.btn.danger:hover { background: rgba(224, 87, 79, .18); border-color: var(--danger); }
.btn.sm { min-height: 32px; padding: 0 13px; font-size: 13px; }
.btn.lg { min-height: 52px; padding: 0 28px; font-size: 16px; }
.btn.block { width: 100%; }
.btn.icon { padding: 0; width: 42px; }
.btn.icon.sm { width: 32px; }

/* Inputs */
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.input, select.input {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: 12px;
  background: #0a0e14; border: 1px solid rgba(255, 255, 255, .1); color: var(--ivory);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(216, 181, 106, .16); }
textarea.input { padding: 12px 14px; min-height: 90px; resize: vertical; }

/* Segmented choice */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  min-height: 38px; padding: 0 13px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .1);
  background: #0a0e14; color: var(--text); font-weight: 500; font-size: 14px; transition: all .15s;
}
.seg button:hover { border-color: var(--line-strong); }
.seg button.on { background: rgba(216, 181, 106, .16); border-color: var(--gold); color: var(--gold-hi); }

/* Panels & modals */
.panel { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); }
.modal-back {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px;
  background: rgba(3, 5, 8, .72); backdrop-filter: blur(6px); animation: fade .18s ease;
}
.modal {
  width: min(480px, 100%); max-height: min(92dvh, 860px); overflow: auto;
  background: linear-gradient(180deg, #171d29, #0e131b); border: 1px solid var(--line-strong);
  border-radius: 20px; box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .05);
  padding: 22px; animation: rise .22s cubic-bezier(.2, .9, .3, 1.2);
}
.modal.wide { width: min(620px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { font-family: var(--display); font-size: 19px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-hi); }
.modal-body { display: grid; gap: 16px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.x { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .1); background: transparent; color: var(--muted); font-size: 18px; line-height: 1; }
.x:hover { color: var(--ivory); border-color: var(--line-strong); }
.error { color: #ffb3ad; background: rgba(224, 87, 79, .1); border: 1px solid rgba(224, 87, 79, .35); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; }

/* Toasts */
.toasts { position: fixed; z-index: 120; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100% - 24px)); pointer-events: none; }
.toast {
  pointer-events: auto; padding: 12px 16px; border-radius: 14px; background: #171d29; border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); font-size: 14px; animation: drop .25s cubic-bezier(.2, .9, .3, 1.2);
}
.toast.error { border-color: rgba(224, 87, 79, .6); color: #ffd2ce; background: #2a1414; }
.toast.win, .toast.announce { border-color: var(--gold); background: linear-gradient(180deg, #2b230f, #171d29); color: var(--gold-hi); }

.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--line-strong); color: var(--gold); }
.tag.green { border-color: rgba(69, 192, 140, .5); color: #8be0bb; }
.tag.red { border-color: rgba(224, 87, 79, .5); color: #ffb3ad; }
.tag.grey { border-color: rgba(255, 255, 255, .14); color: var(--muted); }

.star { display: inline-block; width: 1.1em; height: 1.1em; vertical-align: -0.2em; flex: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
.stars { display: inline-flex; align-items: center; gap: .32em; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gold-hi); white-space: nowrap; }

.ver { position: fixed; right: 8px; bottom: 6px; z-index: 5; font: 500 10px/1 var(--sans); color: rgba(255, 255, 255, .28); letter-spacing: .04em; pointer-events: none; }
.ver b { font-weight: 700; }
.ver .live { color: #e0574f; } .ver .prelive { color: #e5a64a; } .ver .testing { color: #3fbfb0; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes drop { from { opacity: 0; transform: translateY(-12px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
