/* Ink and gold: near-black page, cream text, gilt accents. The pixel theme at the end of this file sets the pixel font and square, hard-edged look. */
:root {
  color-scheme: dark;
  --bg: #121110;
  --surface: #1b1a17;
  --surface-2: #24221e;
  --text: #efe6d2;
  --muted: #9b9282;
  --border: #36322b;
  --border-strong: #4d4639;
  --gold: #c9a24a;
  --gold-hover: #d8b25c;
  --on-gold: #1b1508;
  --danger: #d9826b;
  --live: #6fbf8a;
  --speaking: #4ade80;
  --radius: 3px;
  /* Type scale: use these instead of one-off sizes */
  --fs-xs: .8rem;     /* timestamps, small labels */
  --fs-sm: .875rem;   /* secondary text, hints, form labels, chips */
  --fs-md: .95rem;    /* compact body text */
  --fs-lg: 1.05rem;   /* reading text, tabs */
  --fs-title: 1.15rem; /* card titles */
  /* Cards */
  --pad-card: 1rem 1.15rem;
  --gap-card: 1.25rem; /* space between stacked cards */
  --on-live: #0d1a10;
  --serif: 'IM Fell English', 'Iowan Old Style', Georgia, serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 var(--serif);
}
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 400; color: var(--text); }
h2 { margin: 0; font-size: 1.5rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; color: var(--muted); }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

a { color: var(--gold); }
a:hover { color: var(--gold-hover); }
::selection { background: var(--gold); color: var(--on-gold); }

/* Controls */
button, input, textarea, select { font: inherit; color: inherit; }
button {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: .4rem .9rem;
  cursor: pointer;
}
button:hover { border-color: var(--gold); }
button.primary { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
button.primary:hover { background: var(--gold-hover); border-color: var(--gold-hover); }
button.danger { color: var(--danger); }
button.danger:hover { border-color: var(--danger); }
button:disabled { opacity: .5; cursor: default; }
button:disabled:hover { border-color: var(--border-strong); }
button.link {
  background: none; border: 0; padding: 0; color: var(--gold);
  text-decoration: underline; cursor: pointer;
}
input, textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: .45rem .65rem;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { min-height: 6rem; resize: vertical; }
/* Sliders: thin track that fills gold up to the value (--fill is set by app.js) */
input[type="range"] {
  -webkit-appearance: none; appearance: none; padding: 0; border: 0; height: 1.25rem;
  background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--gold) var(--fill, 0%), var(--border-strong) var(--fill, 0%));
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--border-strong); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--gold); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin-top: -6px;
  border-radius: 50%; background: var(--gold); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--gold);
}
input[type="range"]::-moz-range-thumb {
  width: 10px; height: 10px; border-radius: 50%; background: var(--gold); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--gold);
}
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--gold), 0 0 0 5px rgb(201 162 74 / .35); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 1px var(--gold), 0 0 0 5px rgb(201 162 74 / .35); }
input[type="range"]:disabled { opacity: .4; cursor: default; }
input[type="date"], input[type="time"] { color-scheme: dark; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Header */
.top { background: var(--surface); border-bottom: 1px solid var(--border); padding-top: 1.5rem; }
.campaign-name {
  margin: 0; font-size: 2.1rem; font-weight: 400; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; /* a long name is cut off with … */
}
.campaign-name.unnamed { color: var(--muted); }
.tabs { display: flex; gap: .25rem; margin-top: .75rem; }
.tabs a {
  padding: .45rem 1rem; color: var(--muted); text-decoration: none;
  border-bottom: 2px solid transparent; font-size: var(--fs-lg);
}
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); border-bottom-color: var(--gold); }

#hub-view main { padding-top: 1.75rem; padding-bottom: 2rem; }
.panel-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.panel-head h2 { margin-right: auto; }

/* Cards */
.list { display: flex; flex-direction: column; gap: .75rem; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.1rem; cursor: pointer; text-align: left; width: 100%; display: block;
}
a.card { color: inherit; text-decoration: none; }
.card:hover { border-color: var(--gold); }
.card h3 { margin: 0 0 .2rem; color: var(--text); font-size: 1.2rem; }
.card .meta, .meta { color: var(--muted); font-size: var(--fs-sm); }
.card .body { margin-top: .5rem; white-space: pre-wrap; }
.card .clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.tag { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 .55rem; font-size: var(--fs-sm); }
.tag.upcoming { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.empty { color: var(--muted); text-align: center; padding: 2.5rem 1rem; border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* Dialogs */
dialog {
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text);
  width: min(560px, calc(100vw - 32px)); padding: 1.25rem 1.5rem;
}
dialog::backdrop { background: rgb(0 0 0 / .6); }
dialog h2 { border-bottom: 1px solid var(--border); padding-bottom: .5rem; }
#editor-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: 1rem 0; }
#editor-fields label, #sound-form label { display: flex; flex-direction: column; gap: .25rem; font-size: var(--fs-sm); color: var(--muted); }
#editor-fields label.full { grid-column: 1 / -1; }
#sound-form label { margin: .9rem 0; }
.dialog-actions { display: flex; gap: .5rem; align-items: center; }
.spacer { flex: 1; }

/* Small screens: sign-in, campaigns, status */
.narrow { max-width: 520px; padding-top: 3rem; padding-bottom: 3rem; }
.narrow h1 { font-size: 2.1rem; margin: 0 0 1rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.row input { flex: 1 1 200px; width: auto; }
.foot-line { margin-top: 2rem; }

/* Footer */
.foot { color: var(--muted); font-size: var(--fs-sm); display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; padding-bottom: 1rem; border-top: 1px solid var(--border); padding-top: 1rem; }
/* Leave room so the floating voice bar doesn't cover the links */
body.voice-bar-on .foot { padding-bottom: 5rem; }
.foot-links { display: flex; gap: 1rem; margin-left: auto; }

/* Text helpers */
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.error { color: var(--danger); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; color: var(--gold); }

/* Session detail */
.back { display: inline-block; margin-bottom: 1rem; text-decoration: none; }
.detail-recap { white-space: pre-wrap; margin: 1rem 0; font-size: var(--fs-lg); }

/* Voice chat */
.voice-card {
  margin-bottom: var(--gap-card); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--pad-card);
}
/* Every card title looks the same, with a rule under its heading row */
.voice-card h3, .cal-card h3, .chat-card h3, .profile-card h3 { margin: 0; color: var(--text); font-size: var(--fs-title); }
.voice-card > .panel-head, .cal-card > .panel-head, .chat-card > .panel-head, .dm-card > .panel-head {
  border-bottom: 1px solid var(--border); padding-bottom: .5rem; margin-bottom: .75rem;
}
.dm-card > .panel-head { margin-bottom: 0; }
.voice-members { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .5rem; }
.voice-members li { display: flex; align-items: center; gap: .6rem; }
.avatar {
  width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--gold); color: var(--on-gold); font: 1rem var(--serif);
}
.muted-member .avatar { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border-strong); }
.peer-volume { margin-left: auto; width: 7rem; }

/* Soundboard */
/* Sections of the voice card: Campaign voice always shows; the rest fold */
.vc-section { border-top: 1px solid var(--border); padding: .7rem 0; }
.vc-section:last-child { padding-bottom: 0; }
.vc-section.vc-main { border-top: 0; padding-top: 0; }
.vc-section[hidden] { display: none; }
.vc-title {
  margin: 0; font-size: var(--fs-xs); font-weight: normal; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.vc-main .vc-title { margin-bottom: .6rem; }
.vc-section summary {
  display: flex; align-items: baseline; gap: .6rem; cursor: pointer; list-style: none; padding: .15rem 0;
}
.vc-section summary::-webkit-details-marker { display: none; }
.vc-section summary::before {
  content: '▸'; color: var(--gold); font-size: .85rem; width: .7rem; flex: none; transition: transform .15s;
}
.vc-section[open] summary::before { transform: rotate(90deg); }
.vc-section summary:hover .vc-title { color: var(--text); }
.vc-sum { margin-left: auto; font-size: var(--fs-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.vc-body { padding-top: .7rem; }
.vc-tools { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.vc-tools .volume { margin-right: auto; }
.vc-note { margin: 0 0 .7rem; }
@media (prefers-reduced-motion: reduce) { .vc-section summary::before { transition: none; } }
/* Your mic: a gear beside "Voice chat" opens a small settings panel */
.voice-card { position: relative; }
.voice-head h3 { margin-right: auto; }
.icon-btn {
  display: grid; place-items: center; width: 2rem; height: 2rem; padding: 0;
  border-radius: 50%; border: 1px solid transparent; background: none; color: var(--muted);
}
.icon-btn svg { width: 1.15rem; height: 1.15rem; fill: currentColor; transition: transform .3s; }
.icon-btn:hover, .icon-btn[aria-expanded="true"] { color: var(--gold); border-color: var(--border-strong); }
.mic-gear[aria-expanded="true"] svg { transform: rotate(60deg); }
@media (prefers-reduced-motion: reduce) { .icon-btn svg { transition: none; } }
.mic-settings {
  position: absolute; z-index: 12; top: 3.1rem; right: .9rem; width: min(22rem, calc(100% - 1.8rem));
  background: var(--surface); border: 1px solid var(--gold); border-radius: var(--radius);
  padding: .9rem 1rem; box-shadow: 0 8px 28px rgb(0 0 0 / .55);
  display: flex; flex-direction: column; gap: .7rem;
}
.mic-settings[hidden] { display: none; }
.mic-settings p { margin: 0; }
.mic-pick { display: flex; flex-direction: column; gap: .25rem; font-size: var(--fs-sm); color: var(--muted); }
.mic-mode { border: 0; margin: 0; padding: 0; display: flex; gap: 1.2rem; flex-wrap: wrap; }
.mic-mode label { display: flex; align-items: center; gap: .4rem; cursor: pointer; }
.mic-mode input { width: auto; accent-color: var(--gold); }
.mic-clean { border: 0; margin: .2rem 0 0; padding: .7rem 0 0; border-top: 1px solid var(--border); display: grid; gap: .15rem; }
.mic-clean label { display: flex; align-items: center; gap: .45rem; cursor: pointer; }
.mic-clean input { width: auto; accent-color: var(--gold); }
.mic-clean p { margin: 0 0 .45rem 1.6rem; }
#ptt-key-row[hidden] { display: none; }
.ptt-key { min-width: 4.5rem; font-family: var(--mono, ui-monospace, monospace); }
.ptt-key.on { border-color: var(--gold); color: var(--gold); }
/* Hold to talk: lights green while your mic is live */
.ptt-btn { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ptt-btn.on { background: var(--live); border-color: var(--live); color: var(--on-live); }
.volume { display: flex; align-items: center; gap: .4rem; font-size: var(--fs-sm); color: var(--muted); }
.volume input { width: 6rem; }
.sound-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.sound { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.sound button { border: 0; border-radius: 0; background: var(--surface-2); }
.sound:hover { border-color: var(--gold); }
.sound-play { transition: background .15s, color .15s; }
.sound-play.flash { background: var(--gold); color: var(--on-gold); }
.sound-del { color: var(--muted); padding: .4rem .55rem; border-left: 1px solid var(--border-strong) !important; }
.sound-del:hover { color: var(--danger); }
#sound-hint { margin: .75rem 0 0; }

/* Voice bar (fixed at the bottom while in voice and viewing a session) */
.voice-bar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px));
  display: flex; align-items: center; gap: .6rem;
  background: var(--surface); border: 1px solid var(--gold); border-radius: var(--radius);
  padding: .5rem .75rem; box-shadow: 0 6px 24px rgb(0 0 0 / .5);
}
.voice-bar[hidden] { display: none; }
.voice-bar .dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--live); flex: none; }
.voice-bar a { overflow: hidden; text-overflow: ellipsis; text-decoration: none; }

.toast {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: var(--radius);
  max-width: calc(100vw - 32px); z-index: 10;
}
.toast[hidden] { display: none; }

@media (max-width: 520px) {
  #editor-fields { grid-template-columns: 1fr; }
  .campaign-name { font-size: 1.6rem; }
  .foot-links { margin-left: 0; }
}

/* Availability calendar */
.cal-card {
  margin-bottom: var(--gap-card); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--pad-card);
}

.cal-nav { display: flex; align-items: center; gap: .5rem; }
.cal-nav span { min-width: 9rem; text-align: center; }
.cal-nav button { padding: .05rem .65rem; font-size: 1.1rem; }
.cal-nav { margin-left: auto; } /* the month changer sits at the right end */
.cal-sub { font-family: var(--pixel); font-weight: 400; font-size: var(--fs-sm); color: var(--muted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { text-align: center; font-size: var(--fs-xs); color: var(--muted); padding-bottom: 2px; }
.cal-cell {
  min-height: 4.6rem; padding: .3rem .35rem; text-align: left;
  display: flex; flex-direction: column; gap: 3px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
}
.cal-cell:disabled { opacity: .35; cursor: default; }
.cal-cell { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; } /* long press shows who's free, not a text menu */
.cal-cell.all-free { background: color-mix(in srgb, var(--gold) 16%, var(--bg)); border-color: var(--gold); }
.cal-cell.selected { outline: 2px solid var(--gold); outline-offset: 1px; }
.cal-cell.today .cal-num { color: var(--gold); text-decoration: underline; }
.cal-top { display: flex; align-items: center; gap: .3rem; }
.cal-num { font-size: .95rem; line-height: 1; }
.cal-session { width: .45rem; height: .45rem; background: var(--gold); transform: rotate(45deg); }
.cal-mine { margin-left: auto; font: .85rem/1 system-ui, sans-serif; color: var(--gold); }
.cal-mine.maybe { color: var(--muted); }
.cal-dots { display: flex; flex-wrap: wrap; gap: 2px; margin-top: auto; }
.cal-dot {
  width: 1.15rem; height: 1.15rem; border-radius: 50%; display: grid; place-items: center;
  font-size: .7rem; line-height: 1; background: var(--gold); color: var(--on-gold);
}
.cal-dot.maybe { background: none; border: 1px dashed var(--gold); color: var(--gold); }
.cal-dot.more { background: var(--surface-2); color: var(--muted); }
.cal-count { display: none; font-size: var(--fs-xs); color: var(--muted); margin-top: auto; }
.cal-error { grid-column: 1 / -1; }
.cal-day { margin-top: .9rem; border-top: 1px solid var(--border); padding-top: .75rem; display: flex; flex-direction: column; gap: .25rem; }
.cal-day-head { color: var(--gold); }
.cal-key { display: inline-block; min-width: 5.5rem; color: var(--muted); }
.cal-key.free { color: var(--gold); }
@media (max-width: 600px) {
  .cal-cell { min-height: 3.2rem; padding: .25rem; }
  .cal-dots { display: none; }
  .cal-count { display: block; }
  .cal-nav span { min-width: 7rem; }
}

/* Home: next session */
.next-card {
  background: var(--surface); border: 1px solid var(--gold); border-radius: var(--radius);
  padding: var(--pad-card); margin-bottom: var(--gap-card);
}
.next-label { color: var(--muted); font-size: var(--fs-md); }
.next-card h2 { font-size: 1.7rem; margin: .1rem 0 .15rem; }
.next-card h2 a { color: var(--text); text-decoration: none; }
.next-card h2 a:hover { color: var(--gold); }
.next-plan { margin: .6rem 0 0; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.next-free { margin-top: .6rem; color: var(--muted); }
.gold { color: var(--gold); }
.next-actions { margin-top: .9rem; }
/* The heading, with + New session on the same line at the right */
.next-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.next-head h2 { margin-right: auto; min-width: 0; }
.next-head .next-new { flex: none; margin-left: auto; } /* stays on the right even when a long title pushes it onto its own line */
.later-list:not(:empty) { margin: -.25rem 0 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); }
.later-head { padding: .45rem .9rem; color: var(--muted); font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; border-bottom: 1px solid var(--border); }
.later-item {
  display: flex; justify-content: space-between; gap: 1rem; padding: .45rem .9rem;
  color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border);
}
.later-item:last-child { border-bottom: 0; }
.later-item:hover { background: var(--surface); }

/* Voice card on the session page */
#detail-panel .voice-card { margin-top: var(--gap-card); }

/* History */
.history-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: -.25rem 0 1rem; }
.history-tools input { flex: 0 1 18rem; margin-left: auto; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.card-head h3 { margin: 0; }
.card-head .meta { white-space: nowrap; }

@media (max-width: 520px) {
  .next-card h2 { font-size: 1.4rem; }
  .history-tools input { flex: 1 1 100%; margin-left: 0; }
  .card-head { flex-direction: column; gap: 0; }
  .later-item { flex-direction: column; gap: 0; }
}

/* Notes panel (slides in from the right) */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 20;
  width: min(420px, 100vw); display: flex; flex-direction: column; gap: .75rem;
  background: var(--surface); border-left: 1px solid var(--gold);
  padding: 1rem 1.1rem; box-shadow: -8px 0 32px rgb(0 0 0 / .5);
}
.drawer[hidden] { display: none; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.drawer-head h2 { font-size: 1.4rem; }
.drawer-head a { text-decoration: none; }
.drawer-tools { display: flex; gap: .4rem; flex: none; }
/* Session notes | My notes */
.drawer-tabs { display: flex; gap: .2rem; margin-bottom: .2rem; }
.drawer-tabs button {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none;
  padding: .2rem .55rem; font-size: var(--fs-lg); color: var(--muted);
}
.drawer-tabs button:hover { color: var(--text); }
.drawer-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--gold); }
.drawer-view { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .75rem; }
.drawer-view[hidden] { display: none; }
/* The shared page inside the panel */
.drawer-view .nb-page { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .6rem; padding: 0; border: 0; background: none; }
.drawer-view .nb-head input { font-size: 1.1rem; }
.drawer-view .nb-view, .drawer-view #nb-body { flex: 1; min-height: 0; overflow-y: auto; resize: none; }
.drawer-view .nb-toolbar { gap: .35rem; }
.drawer-view .nb-format button { padding: .15rem .45rem; }
#nb-elsewhere[hidden] { display: none; }
.drawer-tools button { font-size: var(--fs-sm); padding: .25rem .6rem; }
.drawer-tools button[data-notes="close"] { font-size: 1.3rem; line-height: 1; padding: .2rem .6rem; }
.drawer-tools button[hidden] { display: none; }
/* In the floating window, the panel fills it */
body.pip-notes { margin: 0; background: var(--surface); }
.pip-notes .drawer { position: static; width: auto; height: 100vh; border-left: 0; box-shadow: none; }
.drawer textarea { flex: 1; resize: none; min-height: 0; font-size: var(--fs-lg); line-height: 1.6; }
.drawer-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.drawer-foot [hidden] { display: none; }
@media (min-width: 900px) {
  /* Leave room so the page isn't hidden behind the panel */
  body.notes-open #hub-view { margin-right: 420px; }
  body.notes-open .voice-bar { left: calc(50% - 210px); }
}

/* Chat (under the voice panel) */
.chat-card {
  margin-bottom: var(--gap-card); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--pad-card);
}

/* The chat card is sized by app.js (sizeChat) to reach the bottom of the
   window; the message list takes whatever height is left. */
.chat-card { display: flex; flex-direction: column; min-height: 18rem; }
.chat-log { flex: 1 1 auto; min-height: 6rem; overflow-y: auto; display: flex; flex-direction: column; padding-right: .25rem; }
.chat-empty { margin: auto 0; text-align: center; }
/* Few messages sit at the bottom, next to the message box, like other chat apps */
.chat-log > .chat-msg:first-child { margin-top: auto; }
.chat-msg { padding: .35rem 0 0; }
.chat-msg.grouped { padding-top: .05rem; }
.chat-meta { display: flex; align-items: baseline; gap: .5rem; }
.chat-name { color: var(--gold); }
.chat-msg.mine .chat-name { color: var(--text); }
.chat-meta time { font-size: var(--fs-xs); color: var(--muted); }
.chat-line { display: flex; align-items: flex-start; gap: .4rem; }
.chat-body { white-space: pre-wrap; overflow-wrap: anywhere; flex: 1; }
.chat-msg.pending .chat-body { color: var(--muted); }
.chat-del { visibility: hidden; border: 0; background: none; color: var(--muted); padding: 0 .3rem; line-height: 1.4; }
.chat-msg:hover .chat-del, .chat-del:focus-visible { visibility: visible; }
.chat-del:hover { color: var(--danger); }
/* Reactions */
/* The React button sits at the bottom left of each message. On a message with
   no reactions it floats there while you hover, so the chat doesn't jump. */
.chat-msg { position: relative; }
.chat-log { padding-bottom: 1rem; }
.react-row { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin: .25rem 0 .1rem; }
.react-row.no-reactions { position: absolute; left: 0; bottom: -.95rem; margin: 0; z-index: 2; }
.react-add {
  visibility: hidden; padding: 0 .5rem; border-radius: 999px; font-size: var(--fs-sm); line-height: 1.5; white-space: nowrap;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border-strong);
}
.chat-msg:hover .react-add, .react-add:focus-visible { visibility: visible; }
.react-add:hover { color: var(--gold); border-color: var(--gold); }
/* Touch screens can't hover: the button is always shown, in its own line */
@media (hover: none) {
  .react-add { visibility: visible; }
  .react-row.no-reactions { position: static; margin: .25rem 0 .1rem; }
}
.react-chip {
  display: inline-flex; align-items: center; gap: .3rem; padding: .05rem .5rem; border-radius: 999px;
  font-size: var(--fs-sm); line-height: 1.5; color: var(--muted); background: var(--bg); border: 1px solid var(--border-strong);
}
.react-chip span { font-size: 1rem; line-height: 1; }
.react-chip:hover { border-color: var(--gold); }
.react-chip.mine { color: var(--text); border-color: var(--gold); background: color-mix(in srgb, var(--gold) 16%, var(--bg)); }
.react-picker {
  position: fixed; z-index: 16; display: flex; gap: .15rem; padding: .3rem;
  background: var(--surface); border: 1px solid var(--gold); border-radius: 999px; box-shadow: 0 8px 28px rgb(0 0 0 / .55);
}
.react-picker[hidden] { display: none; }
.react-picker button { border: 0; background: none; padding: .25rem .35rem; border-radius: 50%; font-size: 1.25rem; line-height: 1; transition: transform .1s; }
.react-picker button:hover, .react-picker button:focus-visible { background: var(--surface-2); transform: scale(1.2); }
@media (prefers-reduced-motion: reduce) { .react-picker button { transition: none; } }
.chat-form { display: flex; gap: .5rem; margin-top: .75rem; }
.chat-form input { flex: 1; }
@media (hover: none) { .chat-del { visibility: visible; } }

/* Pictures */
img.pic { object-fit: cover; padding: 0; }
.avatar.sm { width: 1.4rem; height: 1.4rem; font-size: .75rem; }
.avatar.xs { width: 1.35rem; height: 1.35rem; font-size: .75rem; }
.avatar.xl { width: 6.5rem; height: 6.5rem; font-size: 2.6rem; }
img.cal-dot.maybe { opacity: .6; outline: 1px dashed var(--gold); outline-offset: 1px; border: 0; }
.chat-meta .avatar { align-self: center; }
.tab-profile { display: inline-flex; align-items: center; gap: .4rem; }
.tab-profile .avatar { flex: none; }

/* Profile tab */
#profile-panel h2 { margin-bottom: 1rem; }
.profile-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--pad-card); margin-bottom: var(--gap-card); display: flex; flex-direction: column; gap: 1.25rem;
}
.profile-pic { display: flex; align-items: center; gap: 1.25rem; }
.profile-pic p { margin: .5rem 0 0; max-width: 28rem; }
.profile-form { border-top: 1px solid var(--border); padding-top: 1.1rem; max-width: 28rem; }
.profile-form label { display: flex; flex-direction: column; gap: .25rem; color: var(--muted); font-size: var(--fs-sm); }
.profile-form p { margin: .3rem 0 1rem; }
@media (max-width: 520px) {
  .profile-pic { flex-direction: column; align-items: flex-start; }
}

/* Pictures and GIFs in chat */
.chat-content { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; }
.chat-media {
  display: block; padding: 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); overflow: hidden; cursor: zoom-in; max-width: min(100%, 320px);
}
.chat-media:hover { border-color: var(--gold); }
.chat-media img { display: block; max-width: 100%; max-height: 260px; width: auto; height: auto; }
.chat-media.loading { width: min(100%, 240px); max-height: 260px; cursor: default; }
.chat-tool { padding: .4rem .65rem; font-size: var(--fs-md); }
.chat-form { flex-wrap: wrap; }
.chat-form input[name="body"] { flex: 1 1 10rem; }

.gif-picker {
  margin-top: .75rem; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--bg); padding: .6rem;
}
.gif-picker[hidden] { display: none; }
.gif-results {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 4px;
  max-height: 16rem; overflow-y: auto; margin: .5rem 0;
}
.gif-item { padding: 0; border: 1px solid transparent; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); aspect-ratio: 1; }
.gif-item:hover, .gif-item:focus-visible { border-color: var(--gold); }
.gif-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gif-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.gif-credit { font: 600 .7rem/1 system-ui, sans-serif; letter-spacing: .04em; color: var(--text); opacity: .85; }

/* Full-size picture: centered, as large as fits the window (small GIFs are scaled up too) */
.lightbox {
  width: fit-content; height: fit-content; max-width: none; max-height: none; margin: auto; padding: 0;
  border: 0; background: transparent; overflow: visible; cursor: zoom-out;
}
.lightbox:focus, .lightbox:focus-visible { outline: none; }
.lightbox::backdrop { background: rgb(0 0 0 / .85); }
.lightbox img { display: block; width: min(92vw, 1200px); height: 88vh; object-fit: contain; }

/* Picture editor */
.crop-dialog { width: min(380px, calc(100vw - 32px)); }
.crop-dialog h2 { margin-bottom: .25rem; }
.crop-dialog > p { margin: 0 0 .9rem; }
.crop-dialog [hidden] { display: none; }
.crop-frame {
  position: relative; width: min(300px, 100%); aspect-ratio: 1; margin: 0 auto;
  overflow: hidden; background: var(--surface);
}
.crop-frame canvas {
  display: block; width: 100%; height: 100%; touch-action: none; cursor: grab;
}
.crop-frame canvas:active { cursor: grabbing; }
.crop-frame canvas:focus-visible { outline: none; }
/* Keyboard focus thickens the circle itself rather than boxing the square */
.crop-frame:has(canvas:focus-visible)::after { outline: 4px solid var(--gold-hover); }
/* Dim everything outside the circle that others will see */
.crop-frame::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  /* Fade everything outside the circle into the dialog, so only the circle reads */
  box-shadow: 0 0 0 999px rgb(27 26 23 / .86); outline: 2px solid var(--gold); outline-offset: -2px;
}
.crop-zoom[hidden] { display: none; }
.crop-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin: 0 0 .9rem;
  padding: .55rem .75rem; border: 1px solid var(--border-strong); border-left: 3px solid var(--gold); border-radius: 0;
}
.crop-note[hidden] { display: none; }
.crop-note span { flex: 1 1 12rem; }
.crop-note button { padding: .25rem .7rem; }
.crop-zoom { display: flex; align-items: center; gap: .6rem; margin: 1rem auto; width: min(300px, 100%); color: var(--muted); }
.crop-zoom input { flex: 1; }

/* Calendar hover card */
.cal-hover {
  position: fixed; z-index: 15; width: 15rem; max-width: calc(100vw - 16px);
  background: var(--surface); border: 1px solid var(--gold); border-radius: var(--radius);
  padding: .65rem .8rem; box-shadow: 0 8px 28px rgb(0 0 0 / .55); pointer-events: none;
}
.cal-hover[hidden] { display: none; }
.cal-hover-head { color: var(--gold); }
.cal-hover-session { font-size: var(--fs-sm); margin-top: .1rem; }
.cal-hover-group { margin-top: .5rem; }
.cal-hover-label { font-size: var(--fs-sm); color: var(--muted); border-bottom: 1px solid var(--border); padding-bottom: .15rem; margin-bottom: .3rem; }
.cal-hover-label.free { color: var(--gold); }
.cal-hover ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.cal-hover li { display: flex; align-items: center; gap: .45rem; font-size: var(--fs-md); }
.cal-hover li .avatar { flex: none; }

/* Green glow on whoever is talking in voice */
.voice-members li .avatar { transition: box-shadow .12s ease-out; }
.voice-members li.speaking .avatar {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--speaking), 0 0 14px 3px rgb(74 222 128 / .55);
}
@media (prefers-reduced-motion: reduce) { .voice-members li .avatar { transition: none; } }

/* Shared notebook (Notes tab) */
#notebook-panel > .panel-head h2 { margin-right: .5rem; }
#notebook-panel > .panel-head .muted { margin-right: auto; }
@media (max-width: 600px) { .nb-search { width: 100%; } }
/* Page tabs: every tab draws its own bottom edge except the selected one,
   which opens into the page below. (No overlap tricks, so a long row of
   tabs can scroll sideways without a stray scrollbar.) */
.nb-tabs { display: flex; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.nb-tabs::after { content: ''; flex: 1 0 1rem; border-bottom: 1px solid var(--border-strong); }
.nb-tabs[hidden] { display: none; }
.nb-tab, .nb-add {
  flex: none; border: 1px solid transparent; border-bottom-color: var(--border-strong);
  border-radius: var(--radius) var(--radius) 0 0;
  background: none; color: var(--muted); padding: .4rem .9rem; max-width: 14rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nb-tab:hover { color: var(--text); border-color: transparent transparent var(--border-strong); }
.nb-tab[aria-selected="true"] {
  color: var(--text); background: var(--surface);
  border-color: var(--border-strong) var(--border-strong) transparent;
}
.nb-add { color: var(--gold); }
.nb-add:hover { color: var(--gold-hover); border-color: transparent transparent var(--border-strong); }
.nb-page {
  background: var(--surface); border: 1px solid var(--border-strong); border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .75rem;
}
.nb-page[hidden] { display: none; }
.nb-head { display: flex; gap: .75rem; align-items: center; }
.nb-head input { flex: 1; font-size: 1.35rem; padding: .3rem .5rem; background: transparent; border-color: transparent; }
.nb-head input:hover { border-color: var(--border-strong); }
.nb-head input:focus { border-color: var(--gold); background: var(--bg); }
#nb-body { min-height: 26rem; font-size: var(--fs-lg); line-height: 1.65; resize: vertical; }
#nb-body[hidden], .nb-view[hidden], .nb-format[hidden], .nb-results[hidden] { display: none; }
/* Formatting bar */
.nb-toolbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.nb-format { display: flex; gap: .3rem; flex-wrap: wrap; }
.nb-format button { padding: .2rem .6rem; font-size: var(--fs-sm); }
.nb-mode { margin-left: auto; }
/* A page as it reads */
.nb-view {
  min-height: 26rem; padding: .6rem .8rem; font-size: var(--fs-lg); line-height: 1.65; cursor: text;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); overflow-wrap: anywhere;
}
.nb-view > :first-child { margin-top: 0; }
.nb-view p { margin: 0 0 .8rem; }
.nb-view .nb-h { color: var(--gold); margin: 1.1rem 0 .4rem; font-weight: 400; }
.nb-view h3.nb-h { font-size: 1.45rem; }
.nb-view h4.nb-h { font-size: 1.2rem; }
.nb-view h5.nb-h { font-size: var(--fs-lg); color: var(--text); }
.nb-view .nb-list { margin: 0 0 .8rem; padding-left: 1.4rem; }
.nb-view .nb-check { list-style: none; margin-left: -1.4rem; }
.nb-view .nb-check label { display: inline-flex; gap: .45rem; align-items: baseline; cursor: pointer; }
.nb-view .nb-check input { width: auto; accent-color: var(--gold); transform: translateY(1px); }
.nb-view .nb-check.done span { color: var(--muted); text-decoration: line-through; }
.nb-view code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; color: var(--gold); }
.nb-view strong { color: #fff6df; font-weight: 700; }
/* Search */
.nb-search { width: min(18rem, 100%); margin-left: auto; }
/* Your private notes on the Notes tab */
.nb-tab-mine { color: var(--muted); }
.nb-mine { display: flex; flex-direction: column; gap: 1rem; padding-top: 1rem; }
.nb-mine[hidden] { display: none; }
.nb-mine > p { margin: 0; }
.nb-mine-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--pad-card); display: flex; flex-direction: column; gap: .6rem; }
.nb-mine-item h3 { margin: 0; font-size: var(--fs-title); }
.nb-mine-item h3 a { color: var(--text); text-decoration: none; }
.nb-mine-item h3 a:hover { color: var(--gold); }
.nb-mine-body { min-height: 0; max-height: 16rem; overflow-y: auto; cursor: default; }
.nb-results { display: flex; flex-direction: column; gap: .5rem; }
.nb-results > p { margin: 0; }
.nb-result {
  display: grid; grid-template-columns: auto 1fr; gap: .1rem .6rem; padding: .6rem .8rem; color: var(--text); text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.nb-result:hover { border-color: var(--gold); color: var(--text); }
.nb-result-kind { font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); align-self: center; }
.nb-result-title { color: var(--gold); }
.nb-result-snip { grid-column: 1 / -1; font-size: var(--fs-sm); color: var(--muted); }
.nb-result mark { background: rgb(201 162 74 / .3); color: var(--text); border-radius: 2px; padding: 0 1px; }
.nb-foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.nb-typing { color: var(--live); }
.nb-typing[hidden] { display: none; }
.nb-conflict {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem;
  padding: .55rem .75rem; border: 1px solid var(--border-strong); border-left: 3px solid var(--gold); border-radius: 0;
}
.nb-conflict[hidden] { display: none; }
.nb-conflict span { flex: 1 1 14rem; }
.nb-conflict button { padding: .25rem .7rem; }
#nb-empty[hidden] { display: none; }
#nb-empty p { margin: 0 0 1rem; }
@media (max-width: 520px) {
  #nb-body, .nb-view { min-height: 18rem; }
  .nb-head { flex-wrap: wrap; }
}

/* "Not free" answers */
.cal-mine.busy { color: var(--danger); }
.cal-key.busy, .cal-hover-label.busy, .busy-text { color: var(--danger); }

/* ---------- The d20 beside the campaign's name ---------- */
.title-row { display: flex; align-items: center; gap: .6rem; }
.title-row .campaign-name { flex: 0 1 auto; min-width: 0; }
.d20 {
  position: relative; top: -4px; flex: none; width: 2.5rem; height: 2.5rem; /* sits a little above the name's middle */
  padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer;
}
.d20:hover { border: 0; }
.d20 canvas.pix { display: block; width: 100%; height: 100%; image-rendering: pixelated; transition: filter .2s; }
.d20:hover canvas.pix { filter: brightness(1.25); }
.d20-num { display: none; } /* app.js draws the number into the die */
/* Rolling: the die tumbles while the number flickers */
.d20.rolling canvas.pix { animation: d20-tumble .7s cubic-bezier(.2, .7, .3, 1); }
@keyframes d20-tumble {
  0% { transform: rotate(0) scale(1); }
  35% { transform: rotate(300deg) scale(1.25); }
  100% { transform: rotate(720deg) scale(1); }
}
/* A natural 20 glows gold */
.d20.crit canvas.pix { filter: drop-shadow(0 0 6px var(--gold)) drop-shadow(0 0 14px rgb(201 162 74 / .6)); }
@media (prefers-reduced-motion: reduce) {
  .d20.rolling canvas.pix { animation: none; }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Private voice room and the DM ---------- */
.dm-guests { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-top: .9rem; }
.chip {
  border-radius: 999px; padding: .15rem .7rem; font-size: var(--fs-sm);
  color: var(--muted); border: 1px solid var(--border-strong); background: none;
}
.chip::before { content: '+ '; }
.chip.on { color: var(--text); border-color: var(--gold); background: color-mix(in srgb, var(--gold) 16%, transparent); }
.chip.on::before { content: '✓ '; color: var(--gold); }
.dm-card { gap: .75rem; }

.dm-line { margin: 0; }
.dm-line .avatar { display: inline-grid; vertical-align: middle; margin-right: .3rem; }
.dm-card form { align-items: flex-end; }
.dm-card form[hidden] { display: none; }
.dm-pick { display: flex; flex-direction: column; gap: .3rem; flex: 1; min-width: 12rem; }

/* ---------- Music in voice, and the DM's player list ---------- */
.music-now { margin: 0 0 .75rem; }
.music-folder-name { margin: .9rem 0 .3rem; }
.music-list { margin: 0; padding-left: 1.6rem; max-height: 11rem; overflow-y: auto; color: var(--muted); }
.music-list li { padding: .1rem 0; }
.music-list button.link { color: var(--text); text-decoration: none; text-align: left; }
.music-list button.link:hover { text-decoration: underline; }
.music-list button.link.on { color: var(--gold); }
.music-list button.link:disabled { color: var(--muted); text-decoration: none; }
.dm-players { border-top: 1px solid var(--border); padding-top: 1rem; display: flex; flex-direction: column; gap: .75rem; }
.dm-delete h4 { color: var(--danger); }
.dm-players[hidden] { display: none; }

.dm-players ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.dm-players li { display: flex; align-items: center; gap: .6rem; }
.dm-players li button { margin-left: auto; }
.dm-players p { margin: 0; }

/* ---------- Runestone pillars beside the Home page (wide screens only) ---------- */
#hub-view { position: relative; z-index: 1; }
.runestones { display: none; position: fixed; inset: 0; pointer-events: none; z-index: 0; }
@media (min-width: 1180px) {
  body.home-active .runestones { display: block; }
}
/* Centered in the empty space beside the 960px page, from just under the header
   to the bottom of the window. app.js sets --rs-top so they start below the
   header, and grow to the full height of the window once it scrolls away. */
.runestone {
  position: absolute; top: var(--rs-top, 20px); bottom: 20px; width: 66px;
  filter: drop-shadow(0 10px 22px rgb(0 0 0 / .55));
}
.runestone-left { left: calc((100vw - 960px) / 4 - 33px); }
.runestone-right { right: calc((100vw - 960px) / 4 - 33px); }

/* The side art is drawn by app.js as pixel art: a canvas filling each piece,
   blown up with square pixels. */
.runestone canvas.pix, .torch canvas.pix, .bookcase canvas.pix, .lavafall canvas.pix, .lavalake canvas.pix {
  position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated;
}

/* ---------- Falling notes beside the History tab (wide screens only) ---------- */
/* A few loose parchment pages drift down the empty space beside the 960px
   page, behind it. Each note is three nested pieces, each with its own motion,
   so it moves like falling paper:
     .fnote       falls at a steady pace
     .fnote-sway  swings side to side like a pendulum, dipping through the
                  middle of each swing and tilting the way it's moving
     .fnote-page  the paper itself, slowly turning over in the air
   Every note has its own size, speed and swing, so they never line up. */
.falling-notes { display: none; position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
@media (min-width: 1180px) {
  body.history-active .falling-notes { display: block; }
}
.fnote {
  position: absolute; top: -90px; width: var(--w); height: calc(var(--w) * 1.25);
  opacity: var(--o, .75); perspective: 300px;
  animation: fnote-fall var(--d) linear var(--delay) infinite;
}
.fnote-sway {
  display: block; width: 100%; height: 100%;
  animation: fnote-sway var(--st) var(--delay) infinite alternate;
}
.fnote-page {
  display: block; position: relative; width: 100%; height: 100%;
  background: no-repeat center / 100% 100%; image-rendering: pixelated; /* app.js paints each page as a pixel sprite */
  animation: fnote-turn var(--tt, 9s) ease-in-out var(--delay) infinite alternate;
}
.fnote-page i, .fnote-page b { display: none; } /* the sprite has the writing, folded corner and seal */
/* left/right: where the note sits in the side space. --d: seconds to fall.
   --sx, --sr, --st: how far it swings, how much it tilts, and how long a swing takes. */
.fnote-l1 { left: calc((100vw - 960px) / 4 - 30px); --w: 44px; --d: 24s; --delay: -4s; --sx: 16px; --sr: 16deg; --st: 3.1s; --tt: 8s; --still: 20vh; }
.fnote-l2 { left: calc((100vw - 960px) / 4 - 6px); --w: 32px; --d: 35s; --delay: -22s; --o: .5; --sx: 16px; --sr: 22deg; --st: 2.6s; --tt: 11s; --still: 58vh; }
.fnote-l3 { left: calc((100vw - 960px) / 4 - 20px); --w: 26px; --d: 44s; --delay: -37s; --o: .35; --sx: 12px; --sr: 26deg; --st: 2.2s; --tt: 7s; --still: 84vh; }
.fnote-r1 { right: calc((100vw - 960px) / 4 - 28px); --w: 40px; --d: 28s; --delay: -15s; --sx: 17px; --sr: 14deg; --st: 3.4s; --tt: 10s; --still: 34vh; }
.fnote-r2 { right: calc((100vw - 960px) / 4 - 4px); --w: 30px; --d: 39s; --delay: -31s; --o: .45; --sx: 15px; --sr: 24deg; --st: 2.4s; --tt: 6.5s; --still: 70vh; }
.fnote-r3 { right: calc((100vw - 960px) / 4 - 18px); --w: 36px; --d: 31s; --delay: -8s; --o: .65; --sx: 18px; --sr: 18deg; --st: 2.9s; --tt: 12s; --still: 10vh; }
.fnote-r4 { right: calc((100vw - 960px) / 4 - 10px); --w: 24px; --d: 47s; --delay: -19s; --o: .3; --sx: 11px; --sr: 28deg; --st: 2s; --tt: 8.5s; --still: 90vh; }
@keyframes fnote-fall {
  from { transform: translateY(0); }
  to { transform: translateY(calc(100vh + 180px)); }
}
/* One swing, played forwards then backwards. The note speeds up into the
   middle, where it sits lowest, and slows as it rises to each side. */
@keyframes fnote-sway {
  0% { transform: translate(calc(var(--sx) * -1), -7px) rotate(calc(var(--sr) * -1)); animation-timing-function: ease-in; }
  50% { transform: translate(0, 7px) rotate(0deg); animation-timing-function: ease-out; }
  100% { transform: translate(var(--sx), -7px) rotate(var(--sr)); }
}
@keyframes fnote-turn {
  from { transform: rotateX(-28deg) rotateY(-34deg); }
  to { transform: rotateX(24deg) rotateY(38deg); }
}
/* Still: the notes hang where they are */
@media (prefers-reduced-motion: reduce) {
  .fnote { animation: none; top: var(--still); }
  .fnote-sway { animation: none; transform: rotate(calc(var(--sr) * -.5)); }
  .fnote-page { animation: none; }
}

/* ---------- Torches beside the campaigns page (wide screens only) ---------- */
/* Each torch is a 48×83 pixel sprite at 4 px a pixel, with its wall glow
   around the flame, centred in the space beside the 520px-wide page. */
#campaigns-view { position: relative; z-index: 1; }
.torches { display: none; position: fixed; inset: 0; pointer-events: none; z-index: 0; }
@media (min-width: 1000px) {
  body.campaigns-active .torches { display: block; }
}
.torch { position: absolute; top: 88px; width: 192px; height: 332px; } /* 8 art pixels (32px) of headroom for the glow */
.torch-left { left: calc((100vw - 520px) / 4 - 96px); }
.torch-right { right: calc((100vw - 520px) / 4 - 96px); }

/* ---------- Lavafalls and a lava lake on the Profile tab (wide screens only) ---------- */
/* The art is as tall as the page and scrolls with it: lava pours from just
   under the header (--lava-top) to a lake along the bottom of the page
   (--page-h). app.js sets both and draws everything. */
.lavafalls {
  display: none; position: absolute; left: 0; right: 0; top: 0; height: var(--page-h, 100vh);
  overflow: hidden; pointer-events: none; z-index: 0;
}
@media (min-width: 1180px) {
  body.profile-active .lavafalls { display: block; }
  body.profile-active #hub-view { padding-bottom: 100px; } /* room for the lake below the page */
}
.lavafall { position: absolute; top: var(--lava-top, 120px); bottom: 72px; width: 120px; } /* 20 art pixels wide */
.lavafall-left { left: calc((100vw - 960px) / 4 - 60px); }
.lavafall-right { right: calc((100vw - 960px) / 4 - 60px); }
.lavalake { position: absolute; left: 0; right: 0; bottom: 0; height: 96px; } /* 16 art pixels deep */

/* ---------- Bookcases beside the Notes tab (wide screens only) ---------- */
/* A tall bookcase fills the empty space on each side of the 960px page, from
   just under the header (--rs-top, set by app.js) to the bottom of the window.
   It gets wider on wider windows. app.js fills the shelves with books. */
.bookcases { display: none; position: fixed; inset: 0; pointer-events: none; z-index: 0; }
@media (min-width: 1180px) {
  body.notes-active .bookcases { display: block; }
}
.bookcase {
  --bc-w: clamp(92px, calc((100vw - 960px) / 2 - 36px), 210px);
  position: absolute; top: var(--rs-top, 20px); bottom: 20px; width: var(--bc-w);
  display: flex; flex-direction: column;
  filter: drop-shadow(0 10px 22px rgb(0 0 0 / .55));
}
.bookcase-left { left: calc((100vw - 960px) / 4 - var(--bc-w) / 2); }
.bookcase-right { right: calc((100vw - 960px) / 4 - var(--bc-w) / 2); }


/* ---------- Links that look like buttons (Open Roll20) ---------- */
a.button {
  display: inline-block; background: var(--surface); color: var(--text); text-decoration: none;
  border: 1px solid var(--border-strong); border-radius: var(--radius); padding: .4rem .9rem;
}
a.button:hover { border-color: var(--gold); color: var(--text); }

/* ---------- Calendar: schedule a day ---------- */
.cal-schedule { margin-top: .6rem; }
.cal-tap-hint { margin: .5rem 0 0; }
.cal-best .link { margin-left: .35rem; }

/* ---------- In voice now (header) ---------- */
.tabs { align-items: center; }
.voice-now {
  margin-left: auto; display: inline-flex; align-items: center; gap: .45rem;
  padding: .2rem .7rem .2rem .55rem; border-radius: 999px; font-size: var(--fs-sm);
  background: none; border: 1px solid var(--border-strong); color: var(--text);
}
.voice-now[hidden] { display: none; }
.voice-now:hover { border-color: var(--live); }
.voice-now .dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--live); flex: none; }
.voice-now-faces { display: inline-flex; }
.voice-now-faces .avatar { margin-left: -.35rem; border: 2px solid var(--surface); box-sizing: content-box; }
.voice-now-faces .avatar:first-child { margin-left: 0; }
/* Narrow screens: the tabs fill the row, so it drops onto its own line below them */
@media (max-width: 600px) {
  .tabs { flex-wrap: wrap; }
  .voice-now { margin: .1rem 0 .5rem; }
}
/* Phones: five tabs share one row, so they get tighter */
@media (max-width: 480px) {
  .tabs { gap: 0; justify-content: space-between; }
  .tabs a { padding: .45rem .3rem; font-size: .9rem; }
  .tabs .voice-now { flex-basis: 100%; justify-content: center; }
}

/* ---------- Unread chat ---------- */
.tabs a.unread { position: relative; }
.tabs a.unread::after {
  content: ''; position: absolute; top: .45rem; right: .4rem; width: .45rem; height: .45rem;
  border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px var(--surface);
}
.next-unread { margin: .4rem 0 0; }
/* A session with unread chat */
.unread-dot { display: inline-block; width: .45rem; height: .45rem; margin-left: .45rem; vertical-align: middle; border-radius: 50%; background: var(--gold); }
.chat-notify { margin-left: auto; }

/* ---------- Sessions tab ---------- */
#current-session:not(:empty) { margin-bottom: var(--gap-card); }
#current-session .vc-title, .past-title { margin: 0 0 .5rem; }
.current-card { border-color: var(--gold); }

/* ---------- Sign in ---------- */
.auth-form { display: flex; flex-direction: column; gap: .8rem; margin-top: 1rem; }
.auth-form[hidden] { display: none; }
.auth-form label { display: flex; flex-direction: column; gap: .25rem; font-size: var(--fs-sm); color: var(--muted); }
.auth-form h2 { margin: 0; }
.auth-form > .primary { align-self: flex-start; padding: .45rem 1.3rem; }
.auth-switch { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: .2rem; }
.auth-switch button {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none;
  padding: .35rem .9rem; color: var(--muted); font-size: var(--fs-lg);
}
.auth-switch button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--gold); }
.auth-extra { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: 0; }
#auth-confirm[hidden], #auth-hint[hidden] { display: none; }
#auth-msg { margin-top: 1rem; }

/* ---------- Start-time poll (session page) ---------- */
.time-poll {
  margin: 1rem 0; padding: var(--pad-card);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.time-poll > p { margin: .35rem 0 .6rem; }
.tp-list { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; gap: .4rem; }
.tp-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.tp-vote {
  display: inline-flex; align-items: center; gap: .55rem; min-width: 12rem;
  padding: .35rem .7rem; background: var(--bg); border: 1px solid var(--border-strong);
}
.tp-vote.mine { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, var(--bg)); }
.tp-check {
  display: inline-grid; place-items: center; width: 1.1rem; height: 1.1rem; flex: none;
  border: 1px solid var(--border-strong); border-radius: var(--radius); font-size: var(--fs-sm); line-height: 1; color: var(--on-gold);
}
.tp-vote.mine .tp-check { background: var(--gold); border-color: var(--gold); }
.tp-time { font-size: var(--fs-md); color: var(--text); }
.tp-count { margin-left: auto; font-size: var(--fs-sm); color: var(--muted); }
.tp-count.gold { color: var(--gold); }
.tp-names { min-width: 0; }
.tp-row.chosen .tp-vote { box-shadow: 0 0 0 1px var(--gold); }
.tp-chosen { color: var(--on-gold); background: var(--gold); border-color: var(--gold); }
.tp-dm { margin-left: auto; display: inline-flex; align-items: center; gap: .5rem; }
.tp-dm .icon-btn { width: 1.8rem; height: 1.8rem; padding: 0; font-size: 1.05rem; line-height: 1; }
.tp-add { gap: .5rem; margin-top: .4rem; }
.time-poll .tp-add select { width: 9.5rem; flex: 0 0 auto; }
.tp-text { gap: .5rem; margin-top: .75rem; }
.tp-prompt { margin-top: .4rem; font-size: var(--fs-sm); }
.tp-time, .tp-count { white-space: nowrap; }
@media (max-width: 560px) {
  .tp-row { gap: .3rem .6rem; padding-bottom: .35rem; }
  .tp-vote { min-width: 0; flex: 1 1 100%; }
}

/* Who's online: chips above the campaign voice room, and dots in the DM's player list */
.online { margin-bottom: .8rem; }
.online p { margin: 0 0 .4rem; }
.online-row { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem .9rem; }
.online-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; }
.online-chip.off { opacity: .45; }
.online-dot { width: .5rem; height: .5rem; border-radius: 50%; flex: none; background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.online-dot.on, .online-chip.on .online-dot { background: var(--live); box-shadow: none; }

/* ======================================================================
   Pixel theme
   The site's look to match its pixel art: a pixel font for headings, tabs,
   buttons and labels (reading text stays in the old-print serif), square
   corners, 2px borders, hard drop shadows instead of soft ones, bevelled
   buttons that press in, and square dots. Everything is in this block, so
   the theme can be changed in one place.
   ====================================================================== */
:root {
  --pixel: 'Tiny5', 'Pixelify Sans', ui-monospace, monospace; /* Tiny5 is loaded with only its digits, so letters come from Pixelify Sans */
  --radius: 0;
  --px-shadow: 4px 4px 0 rgb(0 0 0 / .45);         /* panels */
  --px-pop: 6px 6px 0 rgb(0 0 0 / .6);             /* things that float above the page */
  --px-bevel: inset -2px -2px 0 rgb(0 0 0 / .32), inset 2px 2px 0 rgb(255 255 255 / .07);
}

/* Type: headings, the campaign name, tabs, buttons and small labels */
h1, h2, h3, h4, .campaign-name, .tabs a, button, a.button, .tag, .chip, .react-chip,
.vc-title, .later-head, .nb-result-kind, .voice-now, legend, #cal-month {
  font-family: var(--pixel);
}
h2 { font-weight: 600; letter-spacing: .02em; }
h3, h4 { font-weight: 500; }
.campaign-name { font-weight: 600; font-size: 2rem; letter-spacing: .02em; }
.d20 { top: 0; } /* the pixel font sits lower than the serif did, so the die no longer needs lifting */
.tabs a { font-size: 1rem; }
button, a.button { font-size: .95rem; }
.vc-title, .later-head, .nb-result-kind { letter-spacing: .12em; }
button.link { font-family: inherit; font-size: inherit; } /* links inside text stay in the text's font */

/* Square everything that was round, except people's pictures */
.chip, .react-chip, .react-picker, .react-picker button, .voice-now, .cal-mine,
.dot, .voice-bar .dot, .voice-now .dot, .unread-dot, .online-dot, .icon-btn,
.react-add, .tab-badge { border-radius: 0; }

/* 2px borders on panels, controls and chips */
button, a.button, input:not([type="range"]), select, textarea, dialog,
.card, .profile-card, .voice-card, .cal-card, .next-card, .chat-card, .nb-page, .nb-mine-item,
.later-list:not(:empty), .time-poll, .tp-vote, .tag, .chip, .react-chip, .react-add, .voice-now,
.mic-settings, .react-picker, .gif-picker, .cal-hover, .sound, .empty {
  border-width: 2px;
}

/* Hard shadows: panels sit on the page, pop-ups float above it */
.card, .profile-card, .voice-card, .cal-card, .next-card, .chat-card, .nb-page, .nb-mine-item,
.later-list:not(:empty) { box-shadow: var(--px-shadow); }
dialog, .mic-settings, .react-picker, .gif-picker, .cal-hover { box-shadow: var(--px-pop); }
dialog::backdrop { background: rgb(0 0 0 / .6); }

/* Buttons: bevelled, and pressed in while clicked */
button:not(.link):not(.icon-btn):not(.d20):not(.tp-vote) { box-shadow: var(--px-bevel); }
button:not(.link):not(.d20):not(:disabled):active { transform: translate(1px, 1px); box-shadow: inset 2px 2px 0 rgb(0 0 0 / .35); }
a.button { box-shadow: var(--px-bevel); }
input:not([type="range"]), select, textarea { box-shadow: inset 2px 2px 0 rgb(0 0 0 / .35); }

/* Sliders: a square thumb on a flat 4px track */
input[type="range"]::-webkit-slider-runnable-track { border-radius: 0; }
input[type="range"]::-moz-range-track, input[type="range"]::-moz-range-progress { border-radius: 0; }
input[type="range"]::-webkit-slider-thumb { border-radius: 0; }
input[type="range"]::-moz-range-thumb { border-radius: 0; }

/* The active tab gets a thicker, pixel-sharp underline */
.tabs a { border-bottom-width: 3px; }

/* People's pictures: a pixel circle, 16 steps across. The mask cuts the
   picture (or the initial on gold) to the stepped shape. */
:root { --px-circle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' shape-rendering='crispEdges'%3E%3Crect x='5' y='0' width='6' height='1'/%3E%3Crect x='3' y='1' width='10' height='1'/%3E%3Crect x='2' y='2' width='12' height='1'/%3E%3Crect x='1' y='3' width='14' height='1'/%3E%3Crect x='1' y='4' width='14' height='1'/%3E%3Crect x='0' y='5' width='16' height='1'/%3E%3Crect x='0' y='6' width='16' height='1'/%3E%3Crect x='0' y='7' width='16' height='1'/%3E%3Crect x='0' y='8' width='16' height='1'/%3E%3Crect x='0' y='9' width='16' height='1'/%3E%3Crect x='0' y='10' width='16' height='1'/%3E%3Crect x='1' y='11' width='14' height='1'/%3E%3Crect x='1' y='12' width='14' height='1'/%3E%3Crect x='2' y='13' width='12' height='1'/%3E%3Crect x='3' y='14' width='10' height='1'/%3E%3Crect x='5' y='15' width='6' height='1'/%3E%3C/svg%3E"); }
.avatar {
  border-radius: 0;
  -webkit-mask: var(--px-circle) center / 100% 100% no-repeat;
  mask: var(--px-circle) center / 100% 100% no-repeat;
}
/* The calendar's faces too. "Maybe" can't use a dashed outline (the mask
   would cut it to a square's corners), so it's the same face, faded. */
.cal-dot {
  border-radius: 0;
  -webkit-mask: var(--px-circle) center / 100% 100% no-repeat;
  mask: var(--px-circle) center / 100% 100% no-repeat;
}
.cal-dot.maybe { border: 0; background: rgb(201 162 74 / .3); color: var(--gold); opacity: 1; }
img.cal-dot.maybe { background: none; opacity: .5; outline: 0; }
/* The mask would cut off a box-shadow, so whoever is talking gets a stepped
   green ring that follows the shape (drop-shadows on the wrapper around it) */
.voice-members li .avatar { box-shadow: none; }
.voice-members li.speaking .avatar { box-shadow: none; }
.voice-members .avatar-ring { display: grid; flex: none; transition: filter .12s ease-out; }
.voice-members li.speaking .avatar-ring {
  filter: drop-shadow(2px 0 0 var(--speaking)) drop-shadow(-2px 0 0 var(--speaking))
    drop-shadow(0 2px 0 var(--speaking)) drop-shadow(0 -2px 0 var(--speaking))
    drop-shadow(0 0 6px rgb(74 222 128 / .55));
}
@media (prefers-reduced-motion: reduce) { .voice-members .avatar-ring { transition: none; } }
/* The picture editor shows the same pixel circle: dimmed outside, a thin gold stepped edge */
.crop-frame::after {
  border-radius: 0; box-shadow: none; outline: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' shape-rendering='crispEdges'%3E%3Cg fill='rgb%2827%2C26%2C23%29' fill-opacity='.86'%3E%3Crect x='0' y='0' width='1' height='1'/%3E%3Crect x='0' y='1' width='1' height='1'/%3E%3Crect x='0' y='2' width='1' height='1'/%3E%3Crect x='0' y='3' width='1' height='1'/%3E%3Crect x='0' y='4' width='1' height='1'/%3E%3Crect x='0' y='11' width='1' height='1'/%3E%3Crect x='0' y='12' width='1' height='1'/%3E%3Crect x='0' y='13' width='1' height='1'/%3E%3Crect x='0' y='14' width='1' height='1'/%3E%3Crect x='0' y='15' width='1' height='1'/%3E%3Crect x='1' y='0' width='1' height='1'/%3E%3Crect x='1' y='1' width='1' height='1'/%3E%3Crect x='1' y='2' width='1' height='1'/%3E%3Crect x='1' y='13' width='1' height='1'/%3E%3Crect x='1' y='14' width='1' height='1'/%3E%3Crect x='1' y='15' width='1' height='1'/%3E%3Crect x='2' y='0' width='1' height='1'/%3E%3Crect x='2' y='1' width='1' height='1'/%3E%3Crect x='2' y='14' width='1' height='1'/%3E%3Crect x='2' y='15' width='1' height='1'/%3E%3Crect x='3' y='0' width='1' height='1'/%3E%3Crect x='3' y='15' width='1' height='1'/%3E%3Crect x='4' y='0' width='1' height='1'/%3E%3Crect x='4' y='15' width='1' height='1'/%3E%3Crect x='11' y='0' width='1' height='1'/%3E%3Crect x='11' y='15' width='1' height='1'/%3E%3Crect x='12' y='0' width='1' height='1'/%3E%3Crect x='12' y='15' width='1' height='1'/%3E%3Crect x='13' y='0' width='1' height='1'/%3E%3Crect x='13' y='1' width='1' height='1'/%3E%3Crect x='13' y='14' width='1' height='1'/%3E%3Crect x='13' y='15' width='1' height='1'/%3E%3Crect x='14' y='0' width='1' height='1'/%3E%3Crect x='14' y='1' width='1' height='1'/%3E%3Crect x='14' y='2' width='1' height='1'/%3E%3Crect x='14' y='13' width='1' height='1'/%3E%3Crect x='14' y='14' width='1' height='1'/%3E%3Crect x='14' y='15' width='1' height='1'/%3E%3Crect x='15' y='0' width='1' height='1'/%3E%3Crect x='15' y='1' width='1' height='1'/%3E%3Crect x='15' y='2' width='1' height='1'/%3E%3Crect x='15' y='3' width='1' height='1'/%3E%3Crect x='15' y='4' width='1' height='1'/%3E%3Crect x='15' y='11' width='1' height='1'/%3E%3Crect x='15' y='12' width='1' height='1'/%3E%3Crect x='15' y='13' width='1' height='1'/%3E%3Crect x='15' y='14' width='1' height='1'/%3E%3Crect x='15' y='15' width='1' height='1'/%3E%3C/g%3E%3Cpath d='M0 10v1M0 11h1M0 5h1M0 5v1M0 6v1M0 7v1M0 8v1M0 9v1M1 11v1M1 12v1M1 13h1M1 3h1M1 3v1M1 4v1M10 0h1M10 16h1M11 0v1M11 15h1M11 15v1M11 1h1M12 15h1M12 1h1M13 14h1M13 14v1M13 1v1M13 2h1M14 13h1M14 13v1M14 2v1M14 3h1M15 11h1M15 11v1M15 12v1M15 3v1M15 4v1M15 5h1M16 10v1M16 5v1M16 6v1M16 7v1M16 8v1M16 9v1M2 13v1M2 14h1M2 2h1M2 2v1M3 14v1M3 15h1M3 1h1M3 1v1M4 15h1M4 1h1M5 0h1M5 0v1M5 15v1M5 16h1M6 0h1M6 16h1M7 0h1M7 16h1M8 0h1M8 16h1M9 0h1M9 16h1' fill='none' stroke='%23c9a24a' stroke-width='.12' stroke-linecap='square'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.crop-frame:has(canvas:focus-visible)::after {
  outline: 0; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' shape-rendering='crispEdges'%3E%3Cg fill='rgb%2827%2C26%2C23%29' fill-opacity='.86'%3E%3Crect x='0' y='0' width='1' height='1'/%3E%3Crect x='0' y='1' width='1' height='1'/%3E%3Crect x='0' y='2' width='1' height='1'/%3E%3Crect x='0' y='3' width='1' height='1'/%3E%3Crect x='0' y='4' width='1' height='1'/%3E%3Crect x='0' y='11' width='1' height='1'/%3E%3Crect x='0' y='12' width='1' height='1'/%3E%3Crect x='0' y='13' width='1' height='1'/%3E%3Crect x='0' y='14' width='1' height='1'/%3E%3Crect x='0' y='15' width='1' height='1'/%3E%3Crect x='1' y='0' width='1' height='1'/%3E%3Crect x='1' y='1' width='1' height='1'/%3E%3Crect x='1' y='2' width='1' height='1'/%3E%3Crect x='1' y='13' width='1' height='1'/%3E%3Crect x='1' y='14' width='1' height='1'/%3E%3Crect x='1' y='15' width='1' height='1'/%3E%3Crect x='2' y='0' width='1' height='1'/%3E%3Crect x='2' y='1' width='1' height='1'/%3E%3Crect x='2' y='14' width='1' height='1'/%3E%3Crect x='2' y='15' width='1' height='1'/%3E%3Crect x='3' y='0' width='1' height='1'/%3E%3Crect x='3' y='15' width='1' height='1'/%3E%3Crect x='4' y='0' width='1' height='1'/%3E%3Crect x='4' y='15' width='1' height='1'/%3E%3Crect x='11' y='0' width='1' height='1'/%3E%3Crect x='11' y='15' width='1' height='1'/%3E%3Crect x='12' y='0' width='1' height='1'/%3E%3Crect x='12' y='15' width='1' height='1'/%3E%3Crect x='13' y='0' width='1' height='1'/%3E%3Crect x='13' y='1' width='1' height='1'/%3E%3Crect x='13' y='14' width='1' height='1'/%3E%3Crect x='13' y='15' width='1' height='1'/%3E%3Crect x='14' y='0' width='1' height='1'/%3E%3Crect x='14' y='1' width='1' height='1'/%3E%3Crect x='14' y='2' width='1' height='1'/%3E%3Crect x='14' y='13' width='1' height='1'/%3E%3Crect x='14' y='14' width='1' height='1'/%3E%3Crect x='14' y='15' width='1' height='1'/%3E%3Crect x='15' y='0' width='1' height='1'/%3E%3Crect x='15' y='1' width='1' height='1'/%3E%3Crect x='15' y='2' width='1' height='1'/%3E%3Crect x='15' y='3' width='1' height='1'/%3E%3Crect x='15' y='4' width='1' height='1'/%3E%3Crect x='15' y='11' width='1' height='1'/%3E%3Crect x='15' y='12' width='1' height='1'/%3E%3Crect x='15' y='13' width='1' height='1'/%3E%3Crect x='15' y='14' width='1' height='1'/%3E%3Crect x='15' y='15' width='1' height='1'/%3E%3C/g%3E%3Cpath d='M0 10v1M0 11h1M0 5h1M0 5v1M0 6v1M0 7v1M0 8v1M0 9v1M1 11v1M1 12v1M1 13h1M1 3h1M1 3v1M1 4v1M10 0h1M10 16h1M11 0v1M11 15h1M11 15v1M11 1h1M12 15h1M12 1h1M13 14h1M13 14v1M13 1v1M13 2h1M14 13h1M14 13v1M14 2v1M14 3h1M15 11h1M15 11v1M15 12v1M15 3v1M15 4v1M15 5h1M16 10v1M16 5v1M16 6v1M16 7v1M16 8v1M16 9v1M2 13v1M2 14h1M2 2h1M2 2v1M3 14v1M3 15h1M3 1h1M3 1v1M4 15h1M4 1h1M5 0h1M5 0v1M5 15v1M5 16h1M6 0h1M6 16h1M7 0h1M7 16h1M8 0h1M8 16h1M9 0h1M9 16h1' fill='none' stroke='%23d8b25c' stroke-width='.24' stroke-linecap='square'/%3E%3C/svg%3E");
}

/* Player tab: magic items and attunement */
.player-help { margin: -.5rem 0 1rem; }
.owner-block { margin-bottom: 1.5rem; }
.owner-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.owner-head h3 { margin: 0 auto 0 0; }
.attune-row { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .75rem; margin-bottom: .75rem; }
.attune-slots { display: inline-flex; gap: 6px; }
.attune-slots .slot { width: 16px; height: 16px; border: 2px solid var(--border-strong); background: var(--bg); transform: rotate(45deg); margin: 0 3px; }
.attune-slots .slot.full { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 8px rgb(201 162 74 / .6); }
.attune-count, .attune-limit, .item-badge, .item-label, .item-count, .item-recharge { font-family: var(--pixel); }
.attune-count { color: var(--muted); font-size: var(--fs-sm); word-spacing: .25em; }
.attune-limit { font-size: var(--fs-sm); color: var(--muted); display: inline-flex; align-items: center; gap: .35rem; }
.attune-limit select { width: auto; padding: .1rem .3rem; }
.item-list { display: grid; gap: .75rem; }
.item-card { border: 2px solid var(--border); background: var(--surface); padding: .75rem 1rem; }
.item-card.attuned { border-color: var(--gold); }
.item-head { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
.item-head h3 { margin: 0 .25rem 0 0; font-size: 1.1rem; }
.item-badge { font-size: .75rem; padding: .05rem .4rem; border: 2px solid var(--border-strong); color: var(--muted); }
.item-badge.on { border-color: var(--gold); color: var(--gold); }
.item-badge.cursed { border-color: var(--danger); color: var(--danger); }
.item-charges { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 0; }
.item-charges button { min-width: 2rem; padding: .1rem .4rem; }
.item-label, .item-count { font-size: var(--fs-sm); color: var(--muted); }
.item-pips { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.item-pips i { width: 10px; height: 10px; border: 2px solid var(--border-strong); }
.item-pips i.full { background: var(--gold); border-color: var(--gold); }
.item-notes { margin-top: .5rem; white-space: pre-wrap; }
.item-actions { margin-top: .6rem; }
.item-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: 1rem 0; }
.item-fields label { display: flex; flex-direction: column; gap: .25rem; font-size: var(--fs-sm); color: var(--muted); font-family: var(--pixel); }
.item-fields label.full { grid-column: 1 / -1; }
.item-fields label.check { flex-direction: row; align-items: center; gap: .5rem; color: var(--text); }
.item-fields label[hidden] { display: none; }
.item-fields textarea { min-height: 5rem; }
@media (max-width: 600px) { .item-fields { grid-template-columns: 1fr; } }

/* Short interface text in the pixel font too: form labels, meta lines,
   dates and counts, the calendar, the start-time poll, names in voice and
   chat, the footer and status messages. Reading text (notes, recaps, chat
   messages, hints) and anything you type stay in the old-print serif. */
#editor-fields label, #sound-form label, .profile-form label, .auth-form label, .mic-mode label, .mic-clean label,
.meta, .next-label, .next-free, .later-item, .tp-time, .tp-count, .tp-names, .tp-prompt,
.cal-wd, .cal-count, .cal-key, .cal-day-head, .cal-best, .cal-hover-head, .cal-hover-label, .cal-hover-group,
.chat-meta, .nb-foot, .vc-sum, .voice-members li > span, .online, .online-chip,
.foot, [role="status"], .toast, .avatar, .cal-dot {
  font-family: var(--pixel);
}
input, textarea, select { font-family: var(--serif); }

/* On the campaigns page, Create and Join are the same size */
#create-form button, #join-form button { min-width: 6rem; }

/* Desktop header: one short row, with the name and d20 on the left and the
   tabs on the right. Each tab fills the row's height, so the active tab's
   gold underline sits on the header's bottom edge. Phones keep two rows. */
@media (min-width: 760px) {
  .top { padding-top: 0; }
  .top .wrap { display: flex; align-items: stretch; gap: 1.5rem; }
  .top .title-row { flex: 0 1 auto; min-width: 0; padding: .5rem 0; }
  .top .campaign-name { font-size: 1.7rem; }
  .top .tabs { margin: 0 0 0 auto; flex: none; align-items: stretch; }
  .top .tabs a { display: flex; align-items: center; }
  .top .tabs .voice-now { align-self: center; }
}

/* Mic level meter in the mic panel */
.mic-level { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; }
.mic-meter { flex: 1; height: 12px; background: var(--bg); border: 2px solid var(--border-strong); overflow: hidden; }
.mic-meter span { display: block; height: 100%; width: 0; background: var(--gold); transition: width .06s linear; }
.mic-meter span.talking { background: var(--speaking); }
.mic-meter { position: relative; }
.mic-gate-mark { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--text); pointer-events: none; }
.mic-gate { margin: .6rem 0 .2rem; }
.mic-gate label { display: flex; justify-content: space-between; gap: .5rem; }
.mic-gate-val { font-family: var(--pixel); color: var(--gold); }
.mic-gate input[type=range] { width: 100%; margin: .3rem 0 .1rem; accent-color: var(--gold); }
.mic-gate p { margin: 0; }
.mic-test { flex: none; padding: .2rem .6rem; }
.mic-test[hidden] { display: none; }
#mic-meter-hint { margin: .35rem 0 0; }
@media (prefers-reduced-motion: reduce) { .mic-meter span { transition: none; } }

/* Which mic you're using, and the warning when it seems silent */
.vc-mic-status:empty { display: none; }
.vc-mic { margin: 0 0 .75rem; font-family: var(--pixel); }
.mic-warn {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin: 0 0 .75rem;
  padding: .6rem .75rem; border: 2px solid var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface));
}
.mic-warn > span:first-child { flex: 1 1 16rem; }
.mic-warn .row { gap: .5rem; }

/* The DM's Move to private / Move back buttons in the voice lists */
.vc-move { margin-left: auto; padding: .1rem .55rem; font-size: var(--fs-xs); flex: none; }
.vc-move + .peer-volume { margin-left: .6rem; }

/* Notebook page title: no inset edge until you hover or click into it */
.nb-head input:not(:hover):not(:focus) { box-shadow: none; }
.nb-delete-note { flex: none; max-width: 16rem; text-align: right; font-family: var(--pixel); }
