:root {
  --ink: #1f3028;
  --muted: #748078;
  --paper: #f6f5f0;
  --card: rgba(255,255,255,.82);
  --green: #23734f;
  --green-dark: #185b3d;
  --green-pale: #e4f0e8;
  --red: #bd4d44;
  --gold: #d99a37;
  --line: #e6e9e3;
  --shadow: 0 16px 50px rgba(37, 60, 44, .09);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.page-glow { position: fixed; z-index: -1; width: 360px; height: 360px; border-radius: 50%; filter: blur(80px); opacity: .3; pointer-events: none; }
.glow-one { background: #d2e7d7; top: -190px; right: -120px; }
.glow-two { background: #f4dfbb; bottom: -240px; left: -150px; opacity: .22; }
.app-shell { width: min(100%, 560px); min-height: 100vh; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 20px max(34px, env(safe-area-inset-bottom)); }
.loading { min-height: 70vh; display: grid; place-content: center; justify-items: center; color: var(--muted); gap: 12px; }
.spinner { width: 26px; height: 26px; border: 3px solid #dce5dc; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.topbar { display: flex; align-items: center; justify-content: space-between; margin: 3px 0 28px; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 800; letter-spacing: -.04em; font-size: 17px; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; background: var(--green); color: white; border-radius: 13px; font-size: 19px; box-shadow: 0 6px 16px #23734f40; }
.user-pill { max-width: 180px; padding: 8px 11px; border: 1px solid #e4e9e2; background: rgba(255,255,255,.67); border-radius: 99px; color: var(--muted); font-size: 12px; }
.user-pill select { max-width: 130px; border: 0; background: transparent; color: var(--ink); font-weight: 700; outline: 0; }
.eyebrow { color: var(--green); text-transform: uppercase; letter-spacing: .14em; font-weight: 700; font-size: 10px; margin: 0 0 9px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -.045em; }
h1 { font-size: clamp(32px, 8vw, 43px); line-height: 1.05; margin-bottom: 14px; }
h2 { font-size: 25px; line-height: 1.15; margin-bottom: 10px; }
h3 { font-size: 17px; margin: 0 0 5px; }
.subcopy { max-width: 410px; color: var(--muted); line-height: 1.58; font-size: 14px; }
.hero { position: relative; overflow: hidden; min-height: 226px; border-radius: 27px; padding: 28px 25px; color: #fff; background: radial-gradient(circle at 87% 14%, #4f956b 0, transparent 31%), linear-gradient(135deg, #173e2c, #26714e); box-shadow: 0 22px 45px #19573729; margin: 22px 0 18px; }
.hero::after { content: '✦'; position: absolute; right: 20px; bottom: -44px; font-size: 190px; font-family: Georgia, serif; opacity: .12; transform: rotate(-15deg); }
.hero h2 { max-width: 310px; font-size: 26px; margin: 3px 0 9px; }
.hero p { color: #d9e8dd; font-size: 13px; line-height: 1.5; max-width: 310px; margin-bottom: 20px; }
.hero .eyebrow { color: #c1e3cc; }
.hero .btn-primary { background: #fff; color: var(--green-dark); position: relative; z-index: 1; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin: 12px 0 30px; }
.btn { display: inline-flex; min-height: 49px; align-items: center; justify-content: center; gap: 8px; padding: 12px 17px; border-radius: 15px; border: 1px solid transparent; font-weight: 700; font-size: 14px; transition: transform .15s, background .15s, box-shadow .15s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--green); color: white; box-shadow: 0 8px 17px #23734f24; }
.btn-primary:hover { background: var(--green-dark); }
.btn-secondary { background: white; border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { background: #f8faf7; }
.btn-text { background: transparent; color: var(--green); border: 0; min-height: auto; padding: 8px 0; }
.btn-danger { background: #fff2ef; color: var(--red); }
.btn-wide { width: 100%; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 25px 0 11px; }
.section-head h2 { font-size: 18px; margin: 0; }
.section-head span { font-size: 12px; color: var(--muted); }
.game-list { display: grid; gap: 11px; }
.game-card { display: flex; gap: 13px; align-items: center; padding: 15px; border: 1px solid #e9ebe6; border-radius: 19px; background: var(--card); box-shadow: 0 7px 25px #293e3010; width: 100%; text-align: left; color: inherit; }
.game-card:hover { border-color: #bed4c4; transform: translateY(-1px); }
.game-icon { flex: 0 0 auto; width: 43px; height: 43px; display: grid; place-items: center; font-size: 21px; background: #f6ead7; border-radius: 15px; }
.game-copy { flex: 1; min-width: 0; }
.game-copy strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-copy small { color: var(--muted); display: block; margin-top: 4px; font-size: 11px; }
.chevron { color: #a4b0a7; font-size: 22px; }
.empty { text-align: center; padding: 30px 22px; border-radius: 20px; border: 1px dashed #d5ddd5; color: var(--muted); font-size: 13px; line-height: 1.55; }
.empty .empty-icon { font-size: 32px; margin-bottom: 8px; }
.screen-head { display: flex; align-items: center; gap: 11px; margin: 0 0 21px; }
.back { flex: 0 0 auto; width: 39px; height: 39px; border: 1px solid var(--line); border-radius: 13px; background: white; color: var(--ink); font-size: 19px; }
.screen-head h1 { font-size: 25px; margin: 0; }
.screen-head .eyebrow { margin-bottom: 3px; }
.panel { background: var(--card); border: 1px solid #e7eae4; border-radius: 21px; padding: 19px; box-shadow: 0 9px 28px #2b3d3010; margin-bottom: 13px; }
.panel-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 13px; }
.panel-title h3 { margin-bottom: 3px; }
.panel-title p { color: var(--muted); font-size: 12px; margin: 0; line-height: 1.45; }
.field { display: grid; gap: 7px; margin: 15px 0; }
.field label { color: #536159; font-size: 12px; font-weight: 700; }
.field input, .field textarea, .field select { width: 100%; min-height: 47px; padding: 12px 13px; color: var(--ink); background: #fbfcfa; border: 1px solid #e2e8e1; border-radius: 13px; outline: none; transition: border .15s, box-shadow .15s; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #8db79a; box-shadow: 0 0 0 3px #4e96621d; }
.field textarea { min-height: 83px; resize: vertical; line-height: 1.45; }
.field small { color: #89938c; font-size: 11px; line-height: 1.4; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; color: #56625a; font-size: 12px; line-height: 1.4; }
.check-row input { accent-color: var(--green); margin: 2px 0 0; }
.check-row strong { display: block; color: var(--ink); margin-bottom: 2px; }
.code-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #edf5ef; border: 1px dashed #b6d2bd; border-radius: 17px; padding: 14px 15px; }
.code-box small { display: block; color: #66806d; font-size: 10px; margin-bottom: 4px; }
.code { letter-spacing: .17em; font-weight: 800; font-size: 21px; color: var(--green-dark); }
.copy-btn { background: #fff; border: 1px solid #dce8df; color: var(--green-dark); border-radius: 11px; padding: 10px 12px; font-size: 11px; font-weight: 700; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.meta-tile { background: #fafbf8; border: 1px solid #edf0ea; border-radius: 14px; padding: 12px; }
.meta-tile small { display: block; color: var(--muted); font-size: 10px; margin-bottom: 4px; }
.meta-tile strong { font-size: 13px; }
.player-list { display: grid; gap: 8px; }
.player-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #eff1ed; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; background: #e7efe8; color: var(--green-dark); border-radius: 12px; font-size: 14px; font-weight: 800; }
.player-name { flex: 1; font-size: 13px; font-weight: 600; }
.player-state { font-size: 10px; color: var(--muted); }
.player-state.ready { color: var(--green); }
.badge { border-radius: 99px; padding: 7px 10px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.badge-open { background: #fff4df; color: #96621c; }
.badge-drawn { background: #e5f3e8; color: var(--green-dark); }
.notice { padding: 13px 14px; border-radius: 14px; background: #fff8e9; color: #79613a; font-size: 12px; line-height: 1.5; margin: 12px 0; }
.notice.success { background: #edf6ef; color: #356246; }
.assignment { background: linear-gradient(135deg, #1d5439, #297a53); color: white; border-radius: 23px; padding: 23px; box-shadow: 0 14px 32px #1f69422e; }
.assignment .eyebrow { color: #bee5ca; }
.assignment h2 { font-size: 28px; margin: 0 0 5px; }
.assignment p { color: #dfefe3; line-height: 1.5; font-size: 13px; margin-bottom: 0; }
.gift-hints { display: grid; gap: 10px; margin-top: 14px; }
.hint { background: rgba(255,255,255,.11); border: 1px solid rgba(255,255,255,.1); border-radius: 15px; padding: 13px; }
.hint small { display: block; color: #c9e6d1; font-size: 10px; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .08em; }
.hint p { margin: 0; white-space: pre-wrap; }
.toast { position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translate(-50%, 18px); opacity: 0; pointer-events: none; padding: 12px 17px; border-radius: 14px; background: #23392d; color: #fff; box-shadow: var(--shadow); font-size: 13px; transition: .22s; z-index: 10; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.inline-link { color: var(--green); text-decoration: none; font-weight: 700; }
.footer-note { text-align: center; color: #9aa39b; font-size: 10px; padding: 20px 10px 4px; }
.error-screen { text-align: center; padding-top: 19vh; }
.error-screen .empty-icon { font-size: 48px; margin-bottom: 16px; }

@media (max-width: 390px) {
  .app-shell { padding-left: 15px; padding-right: 15px; }
  .hero { padding: 24px 20px; }
  .panel { padding: 16px; }
  .two-fields { gap: 8px; }
}
