/* 4thPeriod Games — shared styles. Expressive, Material-3-style: tonal color, big soft shapes that
   morph on interaction, spring motion. Content stays simple; the motion and color carry the personality. */
:root{
  --bg:#f5f5f5;
  --surface:#ffffff;
  --surface-2:#ebebeb;
  --surface-3:#e0e0e0;
  --ink:#111111;
  --muted:#5c5c5c;
  --faint:#8c8c8c;
  --line:#e2e2e2;
  --primary:#111111;
  --on-primary:#ffffff;
  --primary-c:#e2e2e2;
  --on-primary-c:#111111;
  --tertiary:#111111;
  --tertiary-c:#e8e8e8;
  --card:#e9e9e9;
  --on-card:#111111;
  --deep:#111111;
  --on-deep:#f2f2f2;
  --good:#1f8a4c;
  --bad:#c62828;
  --r-xs:10px; --r-s:16px; --r-m:22px; --r-l:30px; --r-xl:40px; --r-full:999px;
  --shadow-1:0 1px 2px rgba(0,0,0,.05),0 2px 8px rgba(0,0,0,.04);
  --shadow-2:0 2px 6px rgba(0,0,0,.06),0 16px 36px rgba(0,0,0,.10);
  --shadow-3:0 6px 14px rgba(0,0,0,.08),0 28px 60px rgba(0,0,0,.16);
  /* springs (step response sampled into linear()): bouncy = spatial / expressive, smooth = effects */
  --spring-bouncy:linear(0.0, 0.02, 0.07, 0.141, 0.223, 0.31, 0.397, 0.482, 0.561, 0.633, 0.698, 0.756, 0.805, 0.848, 0.883, 0.913, 0.937, 0.957, 0.972, 0.984, 0.993, 1.0, 1.005, 1.008, 1.01, 1.011, 1.011, 1.011, 1.01, 1.01, 1.009, 1.008, 1.007, 1.006, 1.005, 1.004, 1);
  --spring-smooth:linear(0, 0.014, 0.051, 0.103, 0.165, 0.233, 0.303, 0.374, 0.442, 0.507, 0.567, 0.623, 0.674, 0.721, 0.762, 0.799, 0.831, 0.859, 0.883, 0.904, 0.922, 0.938, 0.95, 0.961, 0.97, 0.977, 0.983, 0.988, 0.992, 0.995, 0.997, 0.999, 1.001, 1.002, 1.002, 1.003, 1.003, 1.003, 1.003, 1.003, 1);
  --d-bouncy:482ms; --d-smooth:430ms;
  --ease-out:cubic-bezier(0.23, 1, 0.32, 1);
  --ease:var(--ease-out);
  --display:'Bricolage Grotesque',ui-sans-serif,system-ui,sans-serif;
  --body:'Inter',ui-sans-serif,system-ui,-apple-system,'Segoe UI',sans-serif;
  /* legacy names used by admin.html */
  --tile:var(--surface-2); --radius:var(--r-m); --shadow:var(--shadow-1); --shadow-lift:var(--shadow-2);
  color-scheme:light;
}
:root[data-theme=dark]{
  --bg:#0b0b0c;--surface:#18181a;--surface-2:#222225;--surface-3:#2d2d31;--ink:#f2f2f2;--muted:#a1a1a6;--faint:#75757a;--line:#2a2a2e;
  --primary:#f2f2f2;--on-primary:#111111;--primary-c:#2b2b2f;--on-primary-c:#f2f2f2;--tertiary:#f2f2f2;--tertiary-c:#2b2b2f;
  --card:#1b1b1e;--on-card:#f2f2f2;--deep:#1b1b1e;--on-deep:#f2f2f2;
  --shadow-1:0 1px 2px rgba(0,0,0,.4);--shadow-2:0 2px 6px rgba(0,0,0,.4),0 16px 36px rgba(0,0,0,.45);--shadow-3:0 6px 14px rgba(0,0,0,.45),0 28px 60px rgba(0,0,0,.55);
  color-scheme:dark;
}
@media (prefers-color-scheme:dark){:root:not([data-theme=light]){
  --bg:#0b0b0c;--surface:#18181a;--surface-2:#222225;--surface-3:#2d2d31;--ink:#f2f2f2;--muted:#a1a1a6;--faint:#75757a;--line:#2a2a2e;
  --primary:#f2f2f2;--on-primary:#111111;--primary-c:#2b2b2f;--on-primary-c:#f2f2f2;--tertiary:#f2f2f2;--tertiary-c:#2b2b2f;
  --card:#1b1b1e;--on-card:#f2f2f2;--deep:#1b1b1e;--on-deep:#f2f2f2;
  --shadow-1:0 1px 2px rgba(0,0,0,.4);--shadow-2:0 2px 6px rgba(0,0,0,.4),0 16px 36px rgba(0,0,0,.45);--shadow-3:0 6px 14px rgba(0,0,0,.45),0 28px 60px rgba(0,0,0,.55);
  color-scheme:dark;
}}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--body);-webkit-font-smoothing:antialiased}
a{color:inherit}
button{font:inherit;color:inherit}
[hidden]{display:none!important}
:focus-visible{outline:3px solid var(--primary);outline-offset:3px;border-radius:12px}

/* buttons: pill that squishes its corners on press (shape morph), springs back on release */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:44px;padding:0 22px;border-radius:22px;border:0;background:var(--surface-2);color:var(--ink);font-weight:600;font-size:14.5px;cursor:pointer;text-decoration:none;white-space:nowrap;
  transition:border-radius var(--d-smooth) var(--spring-smooth),transform var(--d-bouncy) var(--spring-bouncy),background-color .2s ease,box-shadow .25s ease}
.btn:active{border-radius:16px;transform:scale(.96);transition-duration:120ms;transition-timing-function:var(--ease-out)}
.btn.dark,.btn.primary{background:var(--primary);color:var(--on-primary)}
.btn.tonal{background:var(--primary-c);color:var(--on-primary-c)}
.btn.block{width:100%}
.btn[disabled]{opacity:.5;pointer-events:none}
@media (hover:hover) and (pointer:fine){
  .btn:hover{background:var(--surface-3)}
  .btn.dark:hover,.btn.primary:hover{background:color-mix(in srgb,var(--primary) 84%,var(--bg))}
  .btn.tonal:hover{background:var(--surface-3)}
}
.link{background:none;border:0;padding:0;color:var(--primary);font-weight:600;text-decoration:none;cursor:pointer;font-size:13.5px}
.link:hover{text-decoration:underline;text-underline-offset:3px}

/* account chip */
.chip{position:relative}
.chip .who{display:inline-flex;align-items:center;gap:9px;height:44px;padding:0 16px 0 6px;border-radius:22px;border:0;background:var(--surface-2);cursor:pointer;font-weight:600;font-size:14px;
  transition:border-radius var(--d-smooth) var(--spring-smooth),transform var(--d-bouncy) var(--spring-bouncy),background-color .2s}
.chip .who:active{border-radius:16px;transform:scale(.96);transition-duration:120ms}
@media (hover:hover) and (pointer:fine){.chip .who:hover{background:var(--surface-3)}}
.av{width:32px;height:32px;border-radius:50%;display:grid;place-items:center;background:var(--primary);color:var(--on-primary);font-size:13px;font-weight:700;overflow:hidden;flex:none}
.av img{width:100%;height:100%;object-fit:cover}
.menu{position:absolute;right:0;top:calc(100% + 10px);min-width:232px;background:var(--surface);border-radius:var(--r-m);box-shadow:var(--shadow-3);padding:8px;z-index:50;transform-origin:top right;animation:menuIn var(--d-bouncy) var(--spring-bouncy)}
.menu .meta{padding:10px 12px 10px;font-size:12.5px;color:var(--muted);line-height:1.4}
.menu .meta b{display:block;color:var(--ink);font-size:15px}
.menu a,.menu button{display:block;width:100%;text-align:left;padding:11px 14px;border:0;background:none;border-radius:var(--r-s);font-size:14.5px;font-weight:500;cursor:pointer;text-decoration:none;transition:background-color .15s}
.menu a:hover,.menu button:hover{background:var(--surface-2)}
@keyframes menuIn{from{opacity:0;transform:scale(.9) translateY(-6px)}}

/* modal: rises in on a spring with a slight overshoot */
.scrim{position:fixed;inset:0;background:rgba(0,0,0,.4);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);display:grid;place-items:center;padding:16px;z-index:100;animation:fade .25s ease}
.modal{width:min(420px,100%);background:var(--surface);border-radius:var(--r-xl);box-shadow:var(--shadow-3);padding:30px 26px 24px;position:relative;animation:sheetIn var(--d-bouncy) var(--spring-bouncy);color:var(--ink);font-family:var(--body)}
.modal h2{font-family:var(--display);font-size:28px;font-weight:800;letter-spacing:-.025em;margin:0 0 6px}
.modal p.sub{margin:0 0 20px;color:var(--muted);font-size:14.5px;line-height:1.5}
.modal .x{position:absolute;top:16px;right:16px;width:38px;height:38px;border-radius:50%;border:0;background:var(--surface-2);cursor:pointer;display:grid;place-items:center;font-size:20px;line-height:1;transition:border-radius var(--d-smooth) var(--spring-smooth),background-color .15s}
.modal .x:hover{background:var(--surface-3);border-radius:12px}
.field{display:block;margin-bottom:12px}
.field span{display:block;font-size:12.5px;font-weight:600;color:var(--muted);margin:0 0 6px 4px}
.field input,.field textarea,.field select{width:100%;height:50px;padding:0 16px;border-radius:var(--r-s);border:0;background:var(--surface-2);font:inherit;font-size:15px;color:var(--ink);box-shadow:inset 0 0 0 1.5px transparent;transition:box-shadow .2s,background-color .2s,border-radius var(--d-smooth) var(--spring-smooth)}
.field textarea{height:124px;padding:14px 16px;resize:vertical;line-height:1.45}
.field input:focus,.field textarea:focus,.field select:focus{outline:none;background:var(--surface);box-shadow:inset 0 0 0 2px var(--primary);border-radius:var(--r-xs)}
.or{display:flex;align-items:center;gap:12px;color:var(--faint);font-size:12px;margin:16px 0}
.or::before,.or::after{content:'';flex:1;height:1px;background:var(--line)}
.err{color:var(--bad);font-size:13px;min-height:18px;margin:2px 4px 10px}
.ok{color:var(--good);font-size:13px}
.foot{margin-top:14px;text-align:center;font-size:13.5px;color:var(--muted)}
.gbtn{background:var(--surface);box-shadow:inset 0 0 0 1.5px var(--line)}
.gbtn svg{width:18px;height:18px}
.seg{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:14px}
.seg button{height:38px;padding:0 16px;border-radius:19px;border:0;background:var(--surface-2);font-size:13.5px;font-weight:600;cursor:pointer;
  transition:background-color .2s,color .2s,border-radius var(--d-smooth) var(--spring-smooth)}
.seg button[aria-pressed=true]{background:var(--primary-c);color:var(--on-primary-c);border-radius:12px}
@keyframes fade{from{opacity:0}}
@keyframes sheetIn{from{opacity:0;transform:translateY(24px) scale(.94)}}

/* toast */
.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%) translateY(140%) scale(.9);background:#1c1c1e;color:#fff;padding:12px 14px 12px 18px;border-radius:var(--r-m);font-size:14px;font-weight:500;box-shadow:var(--shadow-3);opacity:0;
  transition:opacity .2s ease,transform var(--d-bouncy) var(--spring-bouncy);z-index:120;display:flex;gap:14px;align-items:center;max-width:calc(100% - 32px)}
.toast.on{opacity:1;transform:translateX(-50%)}
.toast button{background:#f2f2f2;color:#111;border:0;border-radius:var(--r-full);padding:7px 14px;font-weight:700;font-size:13px;cursor:pointer;white-space:nowrap}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}
@media (prefers-reduced-transparency:reduce){.scrim{backdrop-filter:none;background:rgba(0,0,0,.65)}}
