/* =========================================================================
   Outer Rim Dice — original dark space / metallic-panel theme.
   No assets, iconography, or layout copied from any reference site.
   ========================================================================= */

:root {
  --bg-void: #0a0e14;
  --bg-panel: #131a24;
  --bg-panel-raised: #1a2330;
  --bg-panel-inset: #0e141c;
  --border-metal: #2c3a4d;
  --border-metal-light: #3d5066;
  --text-primary: #e8edf4;
  --text-muted: #96a4b8;
  --text-dim: #6b7889;

  --accent-blue: #4fa3e3;
  --accent-amber: #e3a63f;
  --accent-red: #e35d5d;
  --accent-green: #5cc27a;

  --die-boost: #4fa3e3;
  --die-setback: #3a3f47;
  --die-ability: #4fbf6b;
  --die-difficulty: #9b6fd1;
  --die-proficiency: #e3c23f;
  --die-challenge: #d9534f;
  --die-force: #e9edf2;
  --die-numeric: #7a8698;

  --sym-success: #4fbf6b;
  --sym-failure: #e35d5d;
  --sym-advantage: #4fa3e3;
  --sym-threat: #e3a63f;
  --sym-triumph: #e3c23f;
  --sym-despair: #b23a5c;
  --sym-light: #e9edf2;
  --sym-dark: #7a5fd1;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --focus-ring: 0 0 0 3px rgba(79, 163, 227, 0.55);
}

* { box-sizing: border-box; }

/* Author rules below set `display` on several normally-hidden elements
   (.app-shell, .modal-overlay, etc). Because author CSS beats the
   user-agent stylesheet even at equal specificity, this explicit rule is
   required so the `hidden` attribute reliably wins. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  min-height: 100%;
}

body {
  background-image:
    radial-gradient(circle at 15% 10%, rgba(79, 163, 227, 0.06), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(227, 166, 63, 0.05), transparent 45%);
}

h1, h2, h3 { margin: 0; }
p { margin: 0.4em 0; }

button {
  font-family: inherit;
  cursor: pointer;
}
button:disabled { cursor: not-allowed; opacity: 0.45; }

input, select, textarea {
  font-family: inherit;
  background: var(--bg-panel-inset);
  border: 1px solid var(--border-metal);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent-blue);
  color: #041018;
  padding: 8px 14px;
  z-index: 999;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ---------------------------- Buttons ---------------------------------- */

.btn {
  border: 1px solid var(--border-metal-light);
  background: linear-gradient(180deg, var(--bg-panel-raised), var(--bg-panel));
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.05s ease, background 0.15s ease;
}
.btn:hover:not(:disabled) { background: var(--bg-panel-raised); border-color: var(--accent-blue); }
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn-primary { background: linear-gradient(180deg, #3a86c8, #2c6ba0); border-color: #5aa8de; color: #eaf5ff; }
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #4694d6, #3577ae); }

.btn-secondary { background: linear-gradient(180deg, #3a4a3f, #2b3a30); border-color: var(--accent-green); }

.btn-danger { background: linear-gradient(180deg, #7a3232, #5c2424); border-color: var(--accent-red); color: #ffecec; }
.btn-danger:hover:not(:disabled) { background: linear-gradient(180deg, #8a3a3a, #6c2a2a); }

.btn-ghost { background: transparent; border-color: var(--border-metal); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-panel-raised); }

.btn-lg { padding: 12px 20px; font-size: 1.05rem; }
.btn-sm { padding: 4px 9px; font-size: 0.8rem; }
.btn-icon { padding: 4px 8px; }
.btn-roll { white-space: nowrap; }

/* ---------------------------- Landing ----------------------------------- */

.landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.landing-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-metal);
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.landing-card h1 {
  font-size: 1.9rem;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-amber));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 6px;
}
.landing-sub { color: var(--text-muted); margin-bottom: 24px; }
.landing-actions { display: flex; flex-direction: column; gap: 18px; }
.join-form { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.join-form label { font-size: 0.85rem; color: var(--text-muted); }
.join-form-row { display: flex; gap: 8px; }
.join-form-row input { flex: 1; min-width: 0; text-transform: uppercase; }
.landing-note { color: var(--text-dim); font-size: 0.8rem; margin-top: 22px; }
.field-error { color: var(--accent-red); font-size: 0.85rem; }

/* ---------------------------- App shell / header ------------------------ */

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
  background: linear-gradient(180deg, #161f2b, #10161f);
  border-bottom: 1px solid var(--border-metal);
  padding: 10px 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.app-title {
  font-size: 1.15rem;
  color: var(--accent-blue);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.room-info { display: flex; align-items: center; gap: 8px; }
.room-code-label { color: var(--text-dim); font-size: 0.8rem; }
.room-code {
  background: var(--bg-panel-inset);
  border: 1px solid var(--border-metal-light);
  color: var(--accent-amber);
  font-weight: 700;
  letter-spacing: 0.08em;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}
.badge-gm { background: rgba(227,166,63,0.15); color: var(--accent-amber); border-color: var(--accent-amber); }
.badge-pc { background: rgba(79,163,227,0.15); color: var(--accent-blue); border-color: var(--accent-blue); }
.badge-npc { background: rgba(227,93,93,0.15); color: var(--accent-red); border-color: var(--accent-red); }
.badge-current { background: rgba(92,194,122,0.18); color: var(--accent-green); border-color: var(--accent-green); }
.badge-init { background: var(--bg-panel-inset); color: var(--text-muted); border-color: var(--border-metal); }

.conn-status { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; margin-left: auto; }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-dim); }
.conn-connected .conn-dot { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.conn-connecting .conn-dot, .conn-reconnecting .conn-dot { background: var(--accent-amber); box-shadow: 0 0 6px var(--accent-amber); animation: pulse 1s infinite; }
.conn-disconnected .conn-dot { background: var(--accent-red); box-shadow: 0 0 6px var(--accent-red); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.presence-count { color: var(--text-dim); font-size: 0.8rem; }

.btn-history-toggle { margin-left: 6px; }

.turn-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-metal);
}
.round-display { display: flex; align-items: baseline; gap: 6px; }
.round-label { color: var(--text-dim); font-size: 0.8rem; }
#round-number { font-size: 1.3rem; font-weight: 800; color: var(--accent-amber); }
.current-turn { display: flex; gap: 6px; align-items: baseline; }
.current-turn-label { color: var(--text-dim); font-size: 0.8rem; }
#current-turn-name { font-weight: 700; color: var(--accent-green); }
.turn-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.mode-select-label { color: var(--text-dim); font-size: 0.8rem; }
.select-initiative-mode { padding: 7px 8px; }

/* Compact icon-only Prev/Next turn buttons. */
.btn-turn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  flex: 0 0 auto;
}

/* ---------------------------- Tabs --------------------------------------- */

.tab-bar { display: flex; gap: 4px; padding: 8px 16px 0; background: var(--bg-panel); border-bottom: 1px solid var(--border-metal); }
.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.92rem;
}
.tab-btn.is-active { color: var(--accent-blue); border-bottom-color: var(--accent-blue); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.app-main { flex: 1; padding: 16px; max-width: 1400px; margin: 0 auto; width: 100%; }

/* ---------------------------- Character list ----------------------------- */

.add-character-bar { margin-bottom: 12px; }
.character-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.empty-note { color: var(--text-dim); font-style: italic; padding: 20px 0; text-align: center; }

.character-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-metal);
  border-left: 4px solid var(--border-metal-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.character-card.is-pc { border-left-color: var(--accent-blue); }
.character-card.is-npc { border-left-color: var(--accent-red); }
.character-card.is-current-turn {
  box-shadow: 0 0 0 2px var(--accent-green), 0 0 16px rgba(92,194,122,0.25);
}

.character-card-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.drag-handle { cursor: grab; color: var(--text-dim); font-size: 1.1rem; }
.character-name-block { display: flex; align-items: baseline; gap: 6px; }
.character-name { font-weight: 700; font-size: 1.05rem; }
.character-player { color: var(--text-dim); font-size: 0.82rem; }

.stat-rows { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.stat-row { display: grid; grid-template-columns: auto auto 60px auto auto 1fr; align-items: center; gap: 6px; }
.stat-label { color: var(--text-muted); font-size: 0.82rem; width: 52px; }
.stat-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-metal-light);
  background: var(--bg-panel-raised);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
}
.stat-input { width: 56px; text-align: center; }
.stat-max { color: var(--text-dim); font-size: 0.82rem; }
.stat-bar { grid-column: 1 / -1; height: 4px; background: var(--bg-panel-inset); border-radius: 2px; overflow: hidden; }
.stat-row-wounds .stat-bar-fill { background: var(--accent-red); height: 100%; }
.stat-row-strain .stat-bar-fill { background: var(--accent-amber); height: 100%; }
.stat-row.is-max { outline: 1px solid var(--accent-red); border-radius: var(--radius-sm); }

.character-notes { color: var(--text-muted); font-size: 0.85rem; font-style: italic; background: var(--bg-panel-inset); padding: 6px 8px; border-radius: var(--radius-sm); }

.quick-roll-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.pool-summary-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.pool-summary-empty { color: var(--text-dim); font-size: 0.82rem; }
.pool-chip { font-size: 0.75rem; padding: 2px 7px; border-radius: 999px; background: var(--bg-panel-inset); border: 1px solid var(--border-metal); }

.macro-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
.btn-macro { white-space: nowrap; }

.card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

.character-expanded { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border-metal); }

.preset-panel { margin-top: 10px; }
.preset-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.preset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--bg-panel-inset);
  border: 1px solid var(--border-metal);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
}
.preset-item-name {
  font-weight: 600;
  font-size: 0.88rem;
  flex: 1 1 auto;
  min-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preset-item-actions { display: flex; gap: 4px; flex-wrap: wrap; flex: 0 0 auto; }
.btn-pin { color: var(--text-muted); }
.btn-pin.is-pinned { background: rgba(227,194,63,0.14); border-color: var(--sym-triumph); color: var(--sym-triumph); }

/* ---------------------------- Dice picker -------------------------------- */

.pool-picker { display: flex; flex-direction: column; gap: 14px; }
.dice-group-title { font-size: 0.85rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.dice-tiles { display: flex; flex-wrap: wrap; gap: 8px; }

.dice-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--bg-panel-inset);
  border: 1px solid var(--border-metal);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  min-width: 84px;
}
.dice-tile.has-dice { border-color: var(--tile-color, var(--accent-blue)); box-shadow: 0 0 0 1px var(--tile-color, var(--accent-blue)) inset; }
.dice-tile-swatch {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px;
  font-size: 0.68rem;
  font-weight: 800;
  color: #08111a;
}
.die-boost .dice-tile-swatch { background: var(--die-boost); }
.die-setback .dice-tile-swatch { background: var(--die-setback); color: #eee; }
.die-ability .dice-tile-swatch { background: var(--die-ability); }
.die-difficulty .dice-tile-swatch { background: var(--die-difficulty); }
.die-proficiency .dice-tile-swatch { background: var(--die-proficiency); }
.die-challenge .dice-tile-swatch { background: var(--die-challenge); }
.die-force .dice-tile-swatch { background: var(--die-force); }
.die-numeric .dice-tile-swatch { background: var(--die-numeric); }

.die-boost.has-dice { --tile-color: var(--die-boost); }
.die-setback.has-dice { --tile-color: var(--die-setback); }
.die-ability.has-dice { --tile-color: var(--die-ability); }
.die-difficulty.has-dice { --tile-color: var(--die-difficulty); }
.die-proficiency.has-dice { --tile-color: var(--die-proficiency); }
.die-challenge.has-dice { --tile-color: var(--die-challenge); }
.die-force.has-dice { --tile-color: var(--die-force); }
.die-numeric.has-dice { --tile-color: var(--die-numeric); }

.dice-tile-label { font-size: 0.75rem; color: var(--text-muted); text-align: center; }
.dice-tile-controls { display: flex; align-items: center; gap: 6px; }
.dice-tile-btn {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-metal-light);
  background: var(--bg-panel-raised);
  color: var(--text-primary);
  font-weight: 800;
  line-height: 1;
}
.dice-tile-count { min-width: 16px; text-align: center; font-weight: 700; }
.pool-picker-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pool-total { color: var(--text-muted); font-size: 0.85rem; }

/* ---------------------------- Roll results / symbols --------------------- */

.roll-result { margin-top: 14px; }
.roll-entry { background: var(--bg-panel-inset); border: 1px solid var(--border-metal); border-radius: var(--radius-md); padding: 10px 12px; }
.roll-entry-header { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; }
.roll-entry-actor { font-weight: 700; color: var(--accent-blue); }
.roll-entry-label { color: var(--text-muted); font-style: italic; }
.roll-entry-time { color: var(--text-dim); font-size: 0.78rem; margin-left: auto; }

.die-chip-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.die-chip { display: flex; flex-direction: column; align-items: center; background: var(--bg-panel); border: 1px solid var(--border-metal); border-radius: var(--radius-sm); padding: 3px 7px; font-size: 0.72rem; min-width: 46px; }
.die-chip-type { color: var(--text-dim); font-size: 0.66rem; }
.die-chip-face { font-weight: 700; }

.net-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.net-badges.is-wash .net-badge-none { color: var(--text-dim); font-style: italic; font-size: 0.85rem; }
.net-badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 10px; font-size: 0.8rem; font-weight: 700; border: 1px solid; }
.net-badge-shape { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 3px; font-size: 0.65rem; color: #08111a; }

.sym-success, .net-badge.sym-success { color: var(--sym-success); border-color: var(--sym-success); background: rgba(79,191,107,0.12); }
.sym-failure, .net-badge.sym-failure { color: var(--sym-failure); border-color: var(--sym-failure); background: rgba(227,93,93,0.12); }
.sym-advantage, .net-badge.sym-advantage { color: var(--sym-advantage); border-color: var(--sym-advantage); background: rgba(79,163,227,0.12); }
.sym-threat, .net-badge.sym-threat { color: var(--sym-threat); border-color: var(--sym-threat); background: rgba(227,166,63,0.12); }
.sym-triumph, .net-badge.sym-triumph { color: var(--sym-triumph); border-color: var(--sym-triumph); background: rgba(227,194,63,0.14); }
.sym-despair, .net-badge.sym-despair { color: var(--sym-despair); border-color: var(--sym-despair); background: rgba(178,58,92,0.14); }
.sym-light, .net-badge.sym-light { color: var(--sym-light); border-color: var(--sym-light); background: rgba(233,237,242,0.1); }
.sym-dark, .net-badge.sym-dark { color: var(--sym-dark); border-color: var(--sym-dark); background: rgba(122,95,209,0.14); }

.net-badge-shape.sym-success, .net-badge-shape.sym-failure, .net-badge-shape.sym-advantage,
.net-badge-shape.sym-threat, .net-badge-shape.sym-triumph, .net-badge-shape.sym-despair,
.net-badge-shape.sym-light, .net-badge-shape.sym-dark { background: currentColor; }
.net-badge .net-badge-shape { background: currentColor; color: #08111a; }

.numeric-total { color: var(--text-muted); font-size: 0.85rem; margin: 4px 0; }
.roll-entry-summary { color: var(--text-primary); font-size: 0.9rem; margin-top: 6px; }

.roll-entry.is-compact .die-chip-list { display: none; }

/* ---------------------------- Quick roller -------------------------------- */

.quick-roller-layout { display: flex; justify-content: center; }
.quick-roller-card { background: var(--bg-panel); border: 1px solid var(--border-metal); border-radius: var(--radius-lg); padding: 18px; max-width: 720px; width: 100%; }
.quick-roller-header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.quick-roller-header label { color: var(--text-muted); font-size: 0.85rem; }
.pool-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.label-input { flex: 1; min-width: 180px; }

/* ---------------------------- History drawer ------------------------------ */

.history-drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(380px, 92vw);
  height: 100vh;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-metal);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 40;
  display: flex;
  flex-direction: column;
}
.history-drawer.is-open { transform: translateX(0); }
.history-drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 14px; border-bottom: 1px solid var(--border-metal); }
.history-drawer-actions { display: flex; gap: 6px; }
.history-list { list-style: none; margin: 0; padding: 10px 14px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.history-item { }
.history-overlay { position: fixed; inset: 0; background: rgba(4,8,12,0.6); z-index: 39; }

@media (min-width: 1050px) {
  .app-main { padding-right: calc(min(380px, 92vw) + 32px); }
  .history-drawer { transform: translateX(0); box-shadow: -6px 0 24px rgba(0,0,0,0.35); }
  .history-overlay { display: none !important; }
  .btn-history-toggle { display: none; }
}

/* ---------------------------- Modals --------------------------------------- */

.modal-overlay { position: fixed; inset: 0; background: rgba(4,8,12,0.7); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal { background: var(--bg-panel); border: 1px solid var(--border-metal-light); border-radius: var(--radius-lg); padding: 22px; max-width: 480px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-sm { max-width: 360px; }
.modal h2 { margin-bottom: 14px; color: var(--accent-blue); }
.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.form-row label { font-size: 0.85rem; color: var(--text-muted); }
.form-row input, .form-row textarea { width: 100%; }
.form-row-inline { flex-direction: row; gap: 14px; flex-wrap: wrap; }
.form-row-inline > div { flex: 1; min-width: 100px; display: flex; flex-direction: column; gap: 4px; }
.type-fieldset { border: 1px solid var(--border-metal); border-radius: var(--radius-sm); padding: 8px 10px; display: flex; gap: 14px; }
.type-fieldset legend { color: var(--text-dim); font-size: 0.78rem; padding: 0 4px; }
.type-fieldset label { display: flex; align-items: center; gap: 5px; font-size: 0.88rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------------------------- Toasts ---------------------------------------- */

.toast-region { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--bg-panel-raised);
  border: 1px solid var(--border-metal-light);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  font-size: 0.88rem;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast-error { border-color: var(--accent-red); }
.toast-success { border-color: var(--accent-green); }
.toast-roll { border-color: var(--accent-amber); }

/* ---------------------------- Responsive tweaks ----------------------------- */

@media (max-width: 640px) {
  .app-title { display: none; }
  .turn-row { gap: 8px; }
  .turn-controls { width: 100%; justify-content: flex-start; }
  .stat-row { grid-template-columns: 44px auto 52px auto auto; }
  .header-row { gap: 8px; }
  .app-main { padding: 12px; }
  .app-header { padding: 8px 12px; }
  .character-card { padding: 10px 11px; }
  .dice-tile { min-width: 72px; padding: 6px 8px; }
  .modal { padding: 16px; }
}

/* Tighter tuning for phone-width screens (iPhone SE through Pro Max) so
   everything fits without horizontal scrolling or cramped tap targets. */
@media (max-width: 430px) {
  html, body { overflow-x: hidden; }
  .app-main { padding: 8px; }
  .app-header { padding: 8px 10px; }
  .header-row { gap: 6px; }
  .room-code-label { display: none; }
  .presence-count { display: none; }
  .turn-row { gap: 6px; }
  .round-display, .current-turn { font-size: 0.85rem; }
  .turn-controls { gap: 6px; }
  .mode-select-label { display: none; }
  .select-initiative-mode { padding: 6px; font-size: 0.8rem; }
  .btn-lg { padding: 10px 16px; font-size: 1rem; }
  .landing-card { padding: 22px 18px; }
  .character-card { padding: 9px 10px; }
  .character-card-header { gap: 6px; }
  .stat-label { width: 42px; font-size: 0.76rem; }
  .stat-btn { width: 26px; height: 26px; }
  .stat-input { width: 46px; }
  .dice-tile { min-width: 66px; padding: 5px 6px; gap: 2px; }
  .dice-tiles { gap: 6px; }
  .dice-tile-label { font-size: 0.68rem; }
  .quick-roller-card { padding: 12px; }
  .modal { padding: 14px; }
  .form-row-inline { gap: 8px; }
  .form-row-inline > div { min-width: 84px; }
  .preset-item { padding: 5px 6px; }
  .history-drawer-header { padding: 10px 12px; }
}
