/* Colors (light/dark tokens), page frame, sidebar, navigation, layout grid and form controls. */
:root {
  color-scheme: light;
  --bg: #EDF0EA;
  --surface: #FBFCFA;
  --sunken: #E3E8E1;
  --ink: #1C2A24;
  --muted: #5B6A62;
  --line: #CBD4CC;
  --accent: #2F6B57;
  --on-accent: #FFFFFF;
  --gold: #94700F;
  --gold-fill: #C9A227;
  --danger: #A8402F;
  --glow: rgba(47, 107, 87, .25);
  --gold-glow: rgba(201, 162, 39, .32);
  --display: "Cinzel", "Iowan Old Style", Georgia, serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}
/* Dark follows the system unless the sidebar's theme switch picks one (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111916;
    --surface: #1A2520;
    --sunken: #141D19;
    --ink: #E6ECE7;
    --muted: #93A29A;
    --line: #2E3D36;
    --accent: #7CC3A8;
    --on-accent: #0F1714;
    --gold: #E2BC55;
    --gold-fill: #E2BC55;
    --danger: #E5856F;
    --glow: rgba(124, 195, 168, .32);
    --gold-glow: rgba(226, 188, 85, .38);
  }
}
:root[data-theme="dark"] {
    color-scheme: dark;
  --bg: #111916;
  --surface: #1A2520;
  --sunken: #141D19;
  --ink: #E6ECE7;
  --muted: #93A29A;
  --line: #2E3D36;
  --accent: #7CC3A8;
  --on-accent: #0F1714;
  --gold: #E2BC55;
  --gold-fill: #E2BC55;
  --danger: #E5856F;
  --glow: rgba(124, 195, 168, .32);
  --gold-glow: rgba(226, 188, 85, .38);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 var(--body);
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold-fill); outline-offset: 2px; }
[hidden] { display: none !important; }

.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100%; }
.rail {
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 24px 16px; display: flex; flex-direction: column; gap: 24px;
  /* Stays put while the page scrolls. Only the tab list scrolls inside it; the bottom part stays put. */
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden;
}
.rail > nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  align-content: start; padding-bottom: 8px; }
.rail-foot { flex: none; display: grid; gap: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.brand { position: relative; display: flex; align-items: center; gap: 12px; padding: 4px 8px; border: 0; background: none;
  color: inherit; text-align: left; cursor: pointer; border-radius: 12px; -webkit-tap-highlight-color: transparent; }
.brand #botName { font: 600 1.25rem/1.1 var(--display); letter-spacing: .04em; overflow-wrap: anywhere; }
.brand .logo { position: relative; width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: var(--sunken); transition: transform .12s; }
.brand .logo img { width: 40px; height: 40px; border-radius: 50%; }
.brand .logo .tri { color: var(--gold-fill); font-size: 1.25rem; }
.brand .logo img:not([hidden]) + .tri { display: none; }
.brand:hover .logo { transform: rotate(-6deg) scale(1.04); }
.brand:active .logo { transform: scale(.9); }
.brand .logo.boop { animation: boop .45s cubic-bezier(.3, 1.6, .5, 1); }
.brand .logo.boop::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 3px solid var(--gold-fill); animation: ring .6s ease-out forwards; }
.brand .logo.spin { animation: spin .9s cubic-bezier(.3, .9, .3, 1); }
@keyframes boop { 0% { transform: scale(.85); } 45% { transform: scale(1.18) rotate(var(--tilt, 6deg)); } 100% { transform: none; } }
@keyframes ring { from { opacity: .9; transform: scale(.9); } to { opacity: 0; transform: scale(1.9); } }
@keyframes spin { from { transform: rotate(0) scale(1.1); } to { transform: rotate(720deg) scale(1); } }
.brand .combo { position: absolute; left: 40px; top: -6px; font: 800 .8125rem/1 var(--body); color: var(--gold); pointer-events: none;
  opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; }
.brand .combo.show { opacity: 1; transform: none; }
.fairy { position: fixed; z-index: 70; left: 0; top: 0; pointer-events: none; display: flex; align-items: center; gap: 8px; }
.fairy .orb { width: 14px; height: 14px; border-radius: 50%; background: #e8f6ff;
  box-shadow: 0 0 10px 4px #9fd8ff, 0 0 24px 10px rgba(120, 190, 255, .45); animation: flutter .18s ease-in-out infinite alternate; }
.fairy .say { font: 700 .8125rem/1 var(--body); color: #cfeaff; text-shadow: 0 0 6px #2a6fb0; white-space: nowrap; }
@keyframes flutter { from { transform: scale(.85); } to { transform: scale(1.1); } }
.brand .logo.glow { box-shadow: 0 0 0 2px var(--gold-fill), 0 0 22px 6px rgba(201, 162, 39, .55); transition: box-shadow .4s; }
.stats b .emo, .stats b { cursor: default; }
.spark { position: fixed; z-index: 60; pointer-events: none; width: 10px; height: 14px; left: 0; top: 0;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); will-change: transform, opacity; }
.rail label { display: grid; gap: 6px; font-size: .875rem; color: var(--muted); padding: 0 8px; }
nav { display: grid; gap: 2px; position: relative; }
nav button {
  position: relative; z-index: 1; text-align: left; padding: 10px 12px 10px 15px; border: 0; border-radius: 8px;
  background: none; cursor: pointer; font-weight: 500; color: var(--muted); transition: color .2s;
}
nav button:hover { color: var(--ink); }
nav button.sub { padding-left: 34px; font-size: .9375rem; }
nav button.sub::before { content: ""; position: absolute; left: 20px; top: 0; bottom: 0; border-left: 1px solid var(--line); }
nav button.sub::after { content: ""; position: absolute; left: 20px; top: 50%; width: 8px; border-top: 1px solid var(--line); }
/* The last branch in a group curves into its tab instead of a ├. */
nav button.sub:not(:has(+ button.sub:not([hidden])))::before { bottom: 50%; width: 8px; border-bottom: 1px solid var(--line); border-bottom-left-radius: 6px; }
nav button.sub:not(:has(+ button.sub:not([hidden])))::after { display: none; }
.navhead { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); padding: 14px 12px 4px 15px; }
.navhead:first-of-type { padding-top: 0; }
nav button[aria-current="page"] { color: var(--ink); }
nav button.off { opacity: .5; text-decoration: line-through; text-decoration-color: var(--line); }
/* Module on/off switch, next to the page title. */
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
main > section > .pagehead > h1 { margin-bottom: 0; }
.pageswitch { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--muted); cursor: pointer; flex: none; }
.pageswitch .state { min-width: 2.2em; text-align: right; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--sunken); border: 1px solid var(--line); transition: background .2s, border-color .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(22px); background: var(--on-accent); }
.switch input:focus-visible + span { outline: 2px solid var(--gold-fill); outline-offset: 2px; }
.switch input:disabled { cursor: wait; }
.offnote { background: var(--sunken); border: 1px solid var(--line); border-left: 3px solid var(--gold-fill); border-radius: 8px; padding: 12px 16px; margin-bottom: 24px; max-width: 62ch; }
.offnote button { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
/* The highlight is one element that glides to the chosen tab. */
.nav-ind {
  position: absolute; left: 0; top: 0; width: 100%; height: 0; border-radius: 8px; background: var(--sunken);
  border-left: 3px solid var(--gold-fill); opacity: 0;
  transition: transform .28s cubic-bezier(.3, .7, .2, 1), height .28s cubic-bezier(.3, .7, .2, 1), width .28s, opacity .2s;
}
main > section:not([hidden]) { animation: tab-in .26s cubic-bezier(.3, .7, .2, 1); }
main[data-dir="up"] > section:not([hidden]) { animation-name: tab-in-up; }
@keyframes tab-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes tab-in-up { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .brand .logo.boop, .brand .logo.spin, .brand .logo.boop::after { animation: none; } }
@media (prefers-reduced-motion: reduce) { .nav-ind { transition: none; } main > section:not([hidden]) { animation: none; } }
/* Members see the play and view parts of a page; settings and admin tools are hidden (and refused by the server). */
body[data-role="member"] .admin-only, body[data-role="member"] .pageswitch { display: none !important; }
.serverpick { display: grid; gap: 6px; }
.serverpick .linkish { justify-self: start; text-decoration: none; font-weight: 600; color: var(--accent); }
.serverpick .linkish:hover { text-decoration: underline; }
.linkish { background: none; border: 0; padding: 0 8px; color: var(--muted); text-decoration: underline; cursor: pointer; text-align: left; font-size: .875rem; }

main { padding: 32px clamp(16px, 4vw, 48px) 96px; width: 100%; }
main > section { max-width: 884px; }
/* Music gets two columns on wide screens: playback on the left, 24/7 and playlists on the right. */
main > #tab-music, main > #tab-economy, main > #tab-fishing, main > #tab-voice, main > #tab-gambling, main > #tab-shop, main > #tab-trivia, main > #tab-quiz, main > #tab-me, main > #tab-audit, main > #tab-say, main > #tab-settings { max-width: 1480px; }
@media (min-width: 1100px) { .cols.settings { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.cols.settings.single { grid-template-columns: minmax(0, 1fr); max-width: 620px; }
.colhead { font-size: .8125rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); margin: 0 0 2px; }
.colnote { margin-bottom: 14px; }
@media (min-width: 1280px) { .cols.side.wide-right { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); } }
.histscroll { max-height: min(72vh, 860px); overflow-y: auto; }
.toolbar select { min-width: 0; }
@media (min-width: 1280px) { .cols.side { grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); } .feedcol { position: sticky; top: 24px; } }
.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 24px; align-items: start; }
@media (min-width: 1280px) { .cols { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); } }
main > section > h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; margin-bottom: 4px; }
.lede { color: var(--muted); margin-bottom: 24px; max-width: 62ch; }

select { max-width: 100%; text-overflow: ellipsis; }
select, input[type="text"], input[type="password"], input[type="url"] {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px; min-height: 42px; width: 100%;
}
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: 9px 16px; min-height: 42px; cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.on { border-color: var(--gold-fill); color: var(--gold); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.quiet { border-color: transparent; background: none; color: var(--muted); padding: 6px 10px; min-height: 36px; font-weight: 500; }
.btn.quiet:hover { color: var(--danger); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; margin-bottom: 24px; }
.panel > h2 { font-size: 1.0625rem; font-weight: 700; margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
