@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Kanit:wght@500;600&display=swap');

:root {
  color-scheme: light;
  --ink: #17333a;
  --muted: #6b7d7c;
  --teal: #1e6970;
  --teal-dark: #123f4a;
  --sand: #f5ead5;
  --cream: #fffaf0;
  --coral: #dc6b4e;
  --line: rgba(23, 51, 58, .13);
  font-family: 'DM Sans', sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: #dce9df; }
body::before { content: ''; position: fixed; inset: 0; z-index: -1; background: linear-gradient(135deg, #dce9df 0%, #c8dfe0 52%, #f4e4c9 100%); }
.setup-overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(18, 63, 74, .72); backdrop-filter: blur(5px); }
.setup-overlay.hidden { display: none; }
.setup-card { width: min(100%, 430px); padding: 32px; color: var(--ink); background: var(--cream); border-radius: 8px; box-shadow: 0 24px 60px rgba(14, 48, 54, .3); }
.setup-card .brand-mark { margin-bottom: 20px; }
.setup-card h1 { margin-bottom: 8px; font-size: 31px; }
.setup-hint { margin: 0 0 23px; color: var(--muted); font-size: 13px; }
.setup-card > label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.setup-card select, .player-field input { width: 100%; padding: 12px; color: var(--ink); font: 500 14px 'DM Sans', sans-serif; background: #f7f0e3; border: 1px solid var(--line); border-radius: 5px; outline-color: var(--teal); }
.player-inputs { display: grid; gap: 10px; margin: 14px 0 22px; }
.player-choice-title { margin: 0 0 2px; color: var(--muted); font-size: 12px; font-weight: 700; }
.player-choice { display: flex; align-items: center; gap: 10px; padding: 12px; color: var(--ink); background: #f7f0e3; border: 1px solid var(--line); border-radius: 5px; cursor: pointer; }
.player-choice input { accent-color: var(--coral); }
.player-choice:has(input:checked) { border-color: var(--coral); background: #fff1df; }
.setup-hint a { color: var(--teal); font-weight: 700; }
.player-field { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.setup-button { box-shadow: 0 5px 0 #aa4f39; }
.app-shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 32px 0 24px; }
.topbar { display: flex; align-items: center; gap: 13px; margin-bottom: 32px; }
.brand-mark { display: grid; place-items: center; width: 45px; height: 45px; color: #fff8e6; font-size: 24px; background: var(--coral); border-radius: 12px; box-shadow: 0 7px 18px rgba(140, 66, 45, .2); }
.eyebrow { margin: 0 0 4px; color: var(--teal); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1, h2 { margin: 0; font-family: 'Kanit', sans-serif; font-weight: 600; letter-spacing: 0; }
h1 { font-size: 28px; line-height: 1; }
h2 { font-size: 23px; line-height: 1.1; }
.online-pill { margin-left: auto; padding: 9px 13px; color: var(--teal-dark); font-size: 12px; font-weight: 600; background: rgba(255, 250, 240, .66); border: 1px solid rgba(23, 51, 58, .1); border-radius: 999px; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; background: #58a875; border-radius: 50%; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(310px, .8fr); gap: 20px; }
.roll-panel, .history-panel { background: rgba(255, 250, 240, .92); border: 1px solid rgba(255, 255, 255, .72); border-radius: 8px; box-shadow: 0 17px 40px rgba(26, 74, 73, .11); }
.roll-panel { padding: clamp(24px, 5vw, 50px); }
.history-panel { display: flex; min-height: 460px; padding: 27px; flex-direction: column; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.panel-heading.compact { align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.turn-badge, .history-count { color: var(--teal); font-size: 12px; font-weight: 700; background: #e5f0e8; border-radius: 999px; }
.turn-badge { padding: 8px 11px; white-space: nowrap; }
.turn-badge strong { margin-left: 3px; }
.history-count { display: grid; width: 27px; height: 27px; place-items: center; }
.dice-stage { display: flex; align-items: center; justify-content: center; gap: clamp(14px, 4vw, 34px); padding: 52px 0 38px; }
.die-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.die-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.die { display: grid; width: clamp(100px, 18vw, 145px); aspect-ratio: 1; place-items: center; color: #fffdf5; font-family: 'Kanit', sans-serif; font-size: clamp(55px, 8vw, 80px); line-height: 1; background: var(--teal-dark); border: 7px solid #f0d39d; border-radius: 22px; box-shadow: 0 11px 0 #b98b4d, 0 18px 24px rgba(20, 58, 65, .2); }
.die.rolling { animation: shake .45s ease-in-out infinite; }
.plus { color: #9ca79d; font-family: 'Kanit', sans-serif; font-size: 30px; }
@keyframes shake { 0%, 100% { transform: rotate(0) translateY(0); } 25% { transform: rotate(-5deg) translateY(-4px); } 75% { transform: rotate(5deg) translateY(4px); } }
.total-row { display: flex; align-items: baseline; justify-content: center; gap: 12px; padding: 17px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.total-row strong { color: var(--ink); font-family: 'Kanit', sans-serif; font-size: 39px; }
.status-message { min-height: 20px; margin: 16px 0 22px; color: var(--muted); text-align: center; font-size: 13px; }
.current-player { margin: -8px 0 22px; color: var(--teal); text-align: center; font-size: 14px; }
.current-player strong { color: var(--coral); }
.status-message.alert { color: #a84d38; font-weight: 700; }
.roll-button { display: flex; width: 100%; align-items: center; justify-content: center; gap: 9px; padding: 16px 20px; color: #fffdf5; font: 700 15px 'DM Sans', sans-serif; background: var(--coral); border: 0; border-radius: 6px; box-shadow: 0 5px 0 #aa4f39; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; }
.roll-button:hover { background: #c95e43; transform: translateY(-1px); box-shadow: 0 6px 0 #aa4f39; }
.roll-button:active { transform: translateY(3px); box-shadow: 0 2px 0 #aa4f39; }
.roll-button:disabled { cursor: wait; opacity: .65; transform: none; box-shadow: 0 3px 0 #aa4f39; }
.button-icon { font-size: 20px; }
.history-list { display: flex; flex: 1; flex-direction: column; gap: 9px; margin: 17px 0; padding: 0; list-style: none; overflow: auto; }
.history-item { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 12px; padding: 12px 13px; background: #f7f0e3; border-radius: 5px; font-size: 13px; }
.history-item time { color: var(--muted); font-size: 11px; }
.history-item .dice-values { color: var(--muted); }
.history-item strong { color: var(--teal-dark); font-size: 17px; }
.empty-history { margin: auto 0; color: #9aa9a0; text-align: center; font-size: 13px; }
.server-note { margin: 0; padding-top: 14px; color: var(--muted); border-top: 1px solid var(--line); font-size: 11px; }
.server-note span { color: #58a875; }
.footer-note { padding-top: 21px; color: #6e8581; text-align: center; font-size: 11px; }
.back-link { margin-left: auto; color: var(--teal); font-size: 13px; font-weight: 700; text-decoration: none; }
.admin-panel { width: min(680px, 100%); margin: 0 auto; padding: clamp(24px, 5vw, 42px); background: rgba(255, 250, 240, .92); border-radius: 8px; box-shadow: 0 17px 40px rgba(26, 74, 73, .11); }
.add-player-form { display: flex; gap: 10px; margin: 18px 0 8px; }
.add-player-form input { min-width: 0; flex: 1; padding: 14px; color: var(--ink); font: 500 14px 'DM Sans', sans-serif; background: #f7f0e3; border: 1px solid var(--line); border-radius: 5px; }
.add-player-form .roll-button { width: auto; padding: 12px 20px; }
.admin-message { min-height: 18px; margin: 8px 0 22px; color: var(--teal); font-size: 12px; }
.list-title { padding-top: 20px; border-top: 1px solid var(--line); }
.admin-player-list { display: grid; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.admin-player-list li { display: flex; align-items: center; justify-content: space-between; padding: 13px; background: #f7f0e3; border-radius: 5px; }
.admin-player-list button { color: #a84d38; font: 600 12px 'DM Sans', sans-serif; background: transparent; border: 0; cursor: pointer; }
.empty-admin { color: var(--muted); font-size: 13px; }
@media (max-width: 720px) { .app-shell { width: min(100% - 24px, 560px); padding-top: 20px; } .topbar { margin-bottom: 22px; } .online-pill { padding: 7px 9px; font-size: 10px; } .game-layout { grid-template-columns: 1fr; } .history-panel { min-height: 300px; } .dice-stage { padding: 40px 0 30px; } }
@media (max-width: 430px) { .online-pill { display: none; } .roll-panel { padding: 22px 16px; } .die { border-width: 5px; border-radius: 16px; box-shadow: 0 7px 0 #b98b4d, 0 12px 18px rgba(20, 58, 65, .18); } .dice-stage { gap: 11px; } }
