/* urist.css — Worker/Urist Mode styles */
/* Dark mode default, mobile-first, 375px baseline */
@font-face {
  font-family: 'OpenDyslexic';
  src: url("/assets/opendyslexic-latin-400-normal.woff2") format('woff2');
  font-weight: normal;
  font-style: normal;
}

:root {
  color-scheme: dark;
  --bg: #1a1a1a;
  --surface: #242424;
  --surface-2: #2e2e2e;
  --border: #3d3830;
  --text: #d8cfc0;
  --text-muted: #7a7068;
  --btn-bg: #333;
  --btn-hover: #3d3830;
  --btn-text: #d8cfc0;
  --badge-normal: #555;
  --badge-high: #6b5000;
  --badge-urgent: #6b1a1a;
  --badge-text: #d8cfc0;
  --accent: #4a9eff;
  --accent-hover: #3a8eef;
  --accent-muted: #1a3a5c;
  --warning: #e67e22;
  --warning-text: #ff9800;
  --warning-bg: #2a1f00;
  --warning-border: #5c3d00;
  --error-bg: #2a0a0a;
  --error-border: #5c1a1a;
  --danger: #8b2c2c;
  --card-shadow-rest: 0 2px 8px rgba(0,0,0,0.5), 0 0 14px rgba(180,120,40,0.16);
  --card-shadow-lift: 0 22px 52px rgba(0,0,0,0.85), 0 0 28px rgba(180,120,40,0.32);
  --card-shadow-spent: 0 1px 6px rgba(0,0,0,0.3), 0 0 0px rgba(180,120,40,0);

  /* Color identity — intent patterns (see intent/vision/color-identity.md)
     Brighter than fortress stone, with texture applied via border-image. */
  --color-red: #b5453a;
  --color-green: #3d8b55;
  --color-blue: #4a7fb5;
  --color-white: #c8c0b8;
  --color-black: #7b4a8e;  /* purple rendering — literal black invisible on dark bg */
}

.stack-page * {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

/* Stack page layout */
.stack-page {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem;
}

.stack-page h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

.stack-empty {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 2rem 0;
}

/* Work order card */
.work-order {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.task-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.card-name {
  font-weight: 600;
  font-size: 1rem;
  flex: 1;
}

/* Priority badges */
.task-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tick-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.app-nav-tick {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 0 0.5rem;
  font-variant-numeric: tabular-nums;
  align-self: center;
}

.priority-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--badge-normal);
  color: var(--badge-text);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.priority-badge.priority-high,
.priority-badge.priority-2 {
  background: var(--badge-high);
}

.priority-badge.priority-urgent,
.priority-badge.priority-3 {
  background: var(--badge-urgent);
}

.task-message {
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

/* Action buttons — equal visual weight, no hierarchy */
.task-actions {
  display: flex;
  gap: 0.5rem;
}

.btn {
  flex: 1;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
}

.btn:active {
  background: var(--btn-hover);
}

/* No hover-dependent state — active only */
@media (hover: hover) {
  .btn:hover {
    background: var(--btn-hover);
  }
}

/* button_to wraps in form — normalize the form element */
.task-actions form {
  flex: 1;
  display: flex;
}

.task-actions form .btn {
  flex: 1;
}

/* ============================================================
   Button variants (shared across all pages)
   ============================================================ */

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:active,
.btn-primary:focus {
  background: var(--accent);
}

@media (hover: hover) {
  .btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
  }
}

.btn-secondary,
.btn-default {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 1px solid var(--border);
}

.btn-warning {
  background: #8a6d1b;
  color: #f5e6a3;
  border-color: #a07d20;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-success {
  background: #1a6b2f;
  color: #a8f0be;
  border-color: #2a9044;
}

.btn-arcane {
  background: #4a1a7a;
  color: #d4aaff;
  border-color: #6a2aaa;
}

@media (hover: hover) {
  .btn-arcane:hover {
    background: #5c228f;
    border-color: #7b35bb;
  }
}

.btn-morning {
  background: #2d7a45;
  color: #a8f0c0;
  border-color: #3a9055;
}

.btn-morning[disabled] {
  background: #142e1c;
  color: #3d7050;
  border-color: #1e3a24;
  opacity: 1;
}

.btn-afternoon {
  background: #7a3d12;
  color: #f0c080;
  border-color: #9a5020;
}

.btn-afternoon[disabled] {
  background: #3a1a08;
  color: #9a7040;
  border-color: #4a2510;
  opacity: 1;
}

.btn-primary[disabled] {
  background: #1a2535;
  color: #4a6a9a;
  border-color: #253545;
  opacity: 1;
}

@media (hover: hover) {
  .btn-success:hover { background: #1f7d38; }
  .btn-warning:hover { background: #9e7d20; }
  .btn-danger:hover { background: #6e2020; }
  .btn-morning:not([disabled]):hover { background: #358a50; }
  .btn-afternoon:not([disabled]):hover { background: #8a4a1a; }
}

.btn-small {
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  min-height: 32px;
}

.btn-faded {
  opacity: 0.35;
}

/* ============================================================
   Forge mechanic — two-click activation for phase buttons
   data-forge="cold"  : locked, muted — click to light
   data-forge="lit"   : active, full color — click to fire
   ============================================================ */

[data-forge] {
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

[data-forge="cold"]::before {
  content: "\1F512\00A0";
  font-size: 0.8em;
  opacity: 0.8;
}

[data-forge="lit"]::before {
  content: "\1F525\00A0";
  font-size: 0.8em;
}

.btn-primary[data-forge="cold"] {
  background: #1e2e45;
  color: #5a7ab0;
  border-color: #253545;
}

.btn-morning[data-forge="cold"] {
  background: #1a4028;
  color: #5a9870;
  border-color: #1e4a2e;
}

.btn-afternoon[data-forge="cold"] {
  background: #4a2210;
  color: #b08060;
  border-color: #5a2c16;
}

.btn-warning[data-forge="cold"] {
  background: #4a3a10;
  color: #aa9050;
  border-color: #5a4818;
}

@media (hover: hover) {
  [data-forge="cold"]:hover {
    filter: brightness(1.15);
    cursor: pointer;
  }
}

/* ============================================================
   Page container (CEO pages — wider than Stack mobile pages)
   ============================================================ */

.page-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ============================================================
   Form elements (all pages)
   ============================================================ */

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group textarea,
.form-group select,
.form-group .form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  font-family: system-ui, -apple-system, sans-serif;
  box-sizing: border-box;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus,
.form-group input[type="number"]:focus,
.form-group textarea:focus,
.form-group select:focus,
.form-group .form-control:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

/* Hints field — monospace only */
.form-group input[name$="[hints]"],
.form-group input[id$="_hints"] {
  font-family: monospace;
}

.form-group small {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.form-group.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-group.checkbox label {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

#error_explanation {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-left: 4px solid var(--danger);
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1.25rem;
}

#error_explanation h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--text);
}

#error_explanation ul {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text);
}

/* ============================================================
   Dashboard
   ============================================================ */

.dashboard-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.branding {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.branding-text {
  display: flex;
  flex-direction: column;
}

.branding h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.dashboard-greeting {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.3;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-turn-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}

.header-turn-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.turn-panel-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.ollama-orb {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  cursor: default;
}

.ollama-orb--online {
  background-color: #4ade80;
  box-shadow: 0 0 6px #4ade80;
}

.ollama-orb--offline {
  background-color: #f87171;
  box-shadow: 0 0 6px #f87171;
}

.ollama-orb--unknown {
  background-color: #6b7280;
}

.ollama-orb--disabled {
  background-color: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.ollama-orb--fallback {
  background-color: #f97316;
  box-shadow: 0 0 6px #f97316;
}

.urist-icon {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.user-menu {
  display: flex;
  gap: 0.5rem;
}

.energy-section {
  margin-bottom: 1.25rem;
}

.stack-section {
  margin-bottom: 2rem;
}

.stack-section h2 {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stack-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.energy-display {
  background: var(--surface);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.energy-top-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.625rem;
}

.energy-level-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.energy-level-label strong {
  color: var(--text);
  font-weight: 600;
}

.energy-selector {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.375rem;
}

.energy-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.75rem 0.5rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
  min-height: 52px;
  transition: border-color 0.15s, background 0.15s;
}

.energy-btn-pip {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.15s, box-shadow 0.15s;
}

.energy-btn-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Energy level color coding */
.energy-btn--1 .energy-btn-pip { background: #6b7280; }
.energy-btn--2 .energy-btn-pip { background: #8b6914; }
.energy-btn--3 .energy-btn-pip { background: #4a9eff; }
.energy-btn--4 .energy-btn-pip { background: #22c55e; }
.energy-btn--5 .energy-btn-pip { background: #a855f7; }

.energy-btn.active {
  border-color: var(--accent);
  background: var(--accent-muted);
  color: var(--text);
}

.energy-btn.active .energy-btn-pip {
  box-shadow: 0 0 6px currentColor;
}

.energy-btn--1.active { border-color: #6b7280; }
.energy-btn--2.active { border-color: #8b6914; background: rgba(139, 105, 20, 0.15); }
.energy-btn--3.active { border-color: #4a9eff; }
.energy-btn--4.active { border-color: #22c55e; background: rgba(34, 197, 94, 0.1); }
.energy-btn--5.active { border-color: #a855f7; background: rgba(168, 85, 247, 0.1); }

@media (hover: hover) {
  .energy-btn:not(.active):hover {
    border-color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
  }
  .energy-btn.active:hover {
    filter: brightness(1.25);
  }
}

.energy-timestamp {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

.warning {
  color: var(--warning-text);
  font-weight: 600;
}

.work-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.task-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.task-item.priority-urgent {
  border-top: 1px solid rgba(192, 57, 43, 0.4);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(192, 57, 43, 0.15);
}

.task-item.priority-high {
  border-top: 1px solid rgba(230, 126, 34, 0.3);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(230, 126, 34, 0.1);
}

.task-item .task-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.task-item .task-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.task-origin {
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  letter-spacing: 0.02em;
}

.task-item .task-message {
  margin: 0.5rem 0 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding-left: 0.5rem;
  border-left: 2px solid var(--border);
  line-height: 1.5;
}

.task-item .task-actions {
  display: flex;
  gap: 0.5rem;
}

.task-item .task-actions form {
  flex: 1;
  display: flex;
}

.task-item .task-actions .btn {
  flex: 1;
  min-height: 44px;
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.empty-state-headline {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem;
}

.empty-state-body {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

.empty-state-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.empty-state-actions .btn {
  flex: 0 1 auto;
}

.idle-message {
  font-size: 1rem;
  color: var(--text);
  font-style: italic;
  margin: 0 0 0.25rem;
}

.idle-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: normal;
  margin: 0;
}

.upkeep-calculating {
  animation: pulse-opacity 1.5s ease-in-out infinite;
}

.upkeep-calculating.hidden {
  display: none;
}

@keyframes pulse-opacity {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.tick-error-banner {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
  border-radius: 6px;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  margin: 0 0 1rem;
}

.dashboard-greeting {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-style: italic;
  margin: 0 0 1.25rem;
  padding: 0 1rem;
}

/* ============================================================
   Cards (index, show, new, edit)
   ============================================================ */

.cards-container,
.card-form-container,
.card-detail {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* Color preview on edit form — tints the container to match selected color */
.card-form-container {
  border-left: 4px solid transparent;
  transition: border-color 0.4s ease, background 0.4s ease;
  border-radius: 0 4px 4px 0;
}
.card-form-container[data-color="red"]   { border-left-color: var(--color-red);   background: rgba(181,69,58,0.05); }
.card-form-container[data-color="green"] { border-left-color: var(--color-green); background: rgba(61,139,85,0.05); }
.card-form-container[data-color="blue"]  { border-left-color: var(--color-blue);  background: rgba(74,127,181,0.05); }
.card-form-container[data-color="white"] { border-left-color: var(--color-white); background: rgba(200,192,184,0.04); }
.card-form-container[data-color="black"] { border-left-color: var(--color-black); background: rgba(123,74,142,0.05); }

.cards-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.cards-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.cards-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  gap: 1rem;
}

.card-main {
  flex: 1;
  min-width: 0;
}

.card-main h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
}

.card-main h3 a {
  color: var(--text);
  text-decoration: none;
}

.card-main h3 a:hover {
  color: var(--accent);
}

.card-energy {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.card-status {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-top: 0.25rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.card-status.active {
  background: var(--accent-muted);
  color: var(--accent);
}

.card-status.inactive {
  background: var(--surface-2);
  color: var(--text-muted);
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Card detail (show page) */

.card-detail .card-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.card-detail .card-header h1 {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.card-meta p {
  margin: 0.25rem 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.card-meta strong {
  color: var(--text);
}

.card-detail .card-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.card-detail .card-body h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.8rem;
}

.card-detail .card-body p {
  margin: 0 0 1rem;
  line-height: 1.6;
}

.card-detail .card-body p:last-child {
  margin-bottom: 0;
}

/* Card form — dry run section */

.dry-run-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

#dry-run-result {
  margin-top: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
}

#dry-run-output {
  margin: 0.5rem 0 0;
  font-family: monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  color: var(--text);
}

/* ============================================================
   Ledger
   ============================================================ */

.ledger-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.ledger-container h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.ledger-table th {
  background: var(--surface-2);
  color: var(--text-muted);
  text-align: left;
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ledger-table td {
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: top;
}

.ledger-table tr:hover td {
  background: var(--surface-2);
}

.ledger-table a {
  color: var(--accent);
  text-decoration: none;
}

.ledger-table a:hover {
  text-decoration: underline;
}

.ledger-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.ledger-filters select,
.ledger-filters button {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.ledger-filters button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.ledger-empty {
  padding: 2rem 0;
  color: var(--text-muted);
}

.ledger-empty a {
  color: var(--accent);
  text-decoration: none;
}

.ledger-empty a:hover {
  text-decoration: underline;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.pagination a {
  color: var(--accent);
  text-decoration: none;
}

.pagination a:hover {
  text-decoration: underline;
}

/* ============================================================
   Spellbooks
   ============================================================ */

   .spellbooks-container,
   .spellbook-form-container,
   .spellbook-detail {
   max-width: 900px;
   margin: 0 auto;
   padding: 2rem 1rem;
   }

   /* Header sections with metadata */
   .spellbooks-header,
   .spellbook-header {
   margin-bottom: 2rem;
   padding-bottom: 1.5rem;
   border-bottom: 1px solid var(--border);
   }

   .spellbooks-header {
   display: flex;
   justify-content: space-between;
   align-items: flex-start;
   }

   .spellbooks-header > div:first-child {
   flex: 1;
   }

   .spellbook-header {
   display: flex;
   justify-content: space-between;
   align-items: flex-start;
   }

   .spellbooks-header h1,
   .spellbook-header h1 {
   margin: 0 0 0.5rem;
   font-size: 2rem;
   font-weight: 700;
   }

   .header-subtitle {
   margin: 0;
   font-size: 0.95rem;
   color: var(--text-muted);
   }

   .header-actions {
   display: flex;
   gap: 0.75rem;
   align-items: center;
   }

   /* List of spellbooks */
   .spellbooks-list {
   display: flex;
   flex-direction: column;
   gap: 1rem;
   }

   .spellbook-item {
   display: flex;
   justify-content: space-between;
   align-items: stretch;
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: 8px;
   padding: 1.25rem;
   transition: background 0.2s, border-color 0.2s;
   }

   .spellbook-item:hover {
   background: var(--surface-2);
   border-color: var(--accent);
   }

   .spellbook-main {
   flex: 1;
   display: flex;
   flex-direction: column;
   justify-content: space-between;
   }

   .spellbook-title-row {
   display: flex;
   align-items: baseline;
   gap: 0.75rem;
   margin-bottom: 0.5rem;
   }

   .spellbook-main h3 {
   margin: 0;
   font-size: 1.1rem;
   font-weight: 600;
   }

   .spellbook-main h3 a {
   color: var(--text);
   text-decoration: none;
   transition: color 0.2s;
   }

   .spellbook-main h3 a:hover {
   color: var(--accent);
   }

   .spellbook-badge {
   display: inline-flex;
   align-items: center;
   justify-content: center;
   min-width: 2rem;
   height: 1.75rem;
   padding: 0 0.5rem;
   background: var(--accent-muted);
   border: 1px solid var(--accent);
   border-radius: 6px;
   font-size: 0.85rem;
   font-weight: 600;
   color: var(--accent);
   }

   .spellbook-description {
   margin: 0;
   font-size: 0.9rem;
   color: var(--text-muted);
   line-height: 1.4;
   }

   .spellbook-description .muted {
   color: var(--text-muted);
   font-weight: 500;
   }

   .spellbook-actions {
   display: flex;
   gap: 0.5rem;
   align-items: center;
   margin-left: 1rem;
   }

   /* Spellbook detail (show) */
   .spellbook-items {
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: 8px;
   padding: 1.5rem;
   }

   .items-section {
   padding: 0;
   }

   .items-header {
     display: flex;
     justify-content: space-between;
     align-items: baseline;
     margin-bottom: 1rem;
   }

   .items-header h3 {
     margin: 0;
     font-size: 1rem;
     font-weight: 600;
     color: var(--text);
   }

   .items-count {
   display: inline-flex;
   align-items: center;
   justify-content: center;
   min-width: 2rem;
   height: 1.75rem;
   padding: 0 0.5rem;
   background: var(--accent-muted);
   border: 1px solid var(--accent);
   border-radius: 6px;
   font-size: 0.85rem;
   font-weight: 600;
   color: var(--accent);
   }

   .items-list-simple {
     margin: 1rem 0 0;
     padding-left: 1.75rem;
     list-style: decimal;
   }

   .list-item {
     padding: 0.5rem 0;
     color: var(--text);
     line-height: 1.5;
     border-bottom: 1px solid var(--border);
   }

   .list-item:last-child {
     border-bottom: none;
   }

   /* Empty states */
   .empty-state {
   text-align: center;
   padding: 2rem 1rem;
   }

   .empty-state-spellbooks {
   background: var(--surface);
   border: 1px dashed var(--border);
   border-radius: 8px;
   padding: 2rem 1rem;
   }

   .empty-icon {
   font-size: 3rem;
   margin-bottom: 0.75rem;
   }

   .empty-state h2 {
   margin: 0 0 0.75rem;
   font-size: 1.25rem;
   font-weight: 600;
   }

   .empty-state p {
   margin: 0 0 1.5rem;
   font-size: 0.95rem;
   color: var(--text-muted);
   line-height: 1.5;
   }

   .empty-items-state {
     text-align: center;
     padding: 2.5rem 1.5rem;
     background: var(--surface-2);
     border: 1px dashed var(--border);
     border-radius: 8px;
   }

   .empty-items-state .empty-icon {
     font-size: 3rem;
     margin-bottom: 0.75rem;
   }

   .empty-items-state h3 {
     margin: 0 0 0.5rem;
     font-size: 1.1rem;
     font-weight: 600;
     color: var(--text);
   }

   .empty-items-state p {
     margin: 0.5rem 0;
     font-size: 0.9rem;
     color: var(--text-muted);
     line-height: 1.5;
   }

   .empty-hint {
     margin-bottom: 1.5rem !important;
     font-size: 0.85rem;
   }

   /* Spellbook footer with tips */
   .spellbook-footer {
     margin-top: 2rem;
     padding-top: 1.5rem;
     border-top: 1px solid var(--border);
   }

   .spellbook-tip {
     margin: 0;
     padding: 0.75rem 1rem;
     background: var(--accent-muted);
     border-left: 3px solid var(--accent);
     border-radius: 4px;
     font-size: 0.9rem;
     color: var(--text);
     line-height: 1.5;
   }

   .spellbook-tip strong {
     color: var(--accent);
   }

   .spellbook-tip code {
     display: inline-block;
     padding: 0.2rem 0.4rem;
     background: var(--surface-2);
     border-radius: 3px;
     font-family: monospace;
     font-size: 0.8rem;
     color: var(--text-muted);
   }

   /* Form styling for spellbooks */
   .form-header {
     margin-bottom: 2rem;
     padding-bottom: 1.5rem;
     border-bottom: 1px solid var(--border);
   }

   .form-header h1 {
     margin: 0 0 0.5rem;
     font-size: 2rem;
     font-weight: 700;
   }

   .form-header p {
     margin: 0;
     font-size: 0.95rem;
     color: var(--text-muted);
   }

   .form-card {
     background: var(--surface);
     border: 1px solid var(--border);
     border-radius: 8px;
     padding: 1.5rem;
     margin-bottom: 1.5rem;
   }

   .warning-box {
     background: var(--warning-bg);
     border: 1px solid var(--warning-border);
     border-radius: 8px;
     padding: 1rem 1.25rem;
     margin-bottom: 1.5rem;
   }

   .warning-box strong {
     color: var(--warning-text);
     display: block;
     margin-bottom: 0.5rem;
     font-size: 0.95rem;
   }

   .warning-box p {
     margin: 0.5rem 0;
     font-size: 0.9rem;
     color: var(--text-muted);
     line-height: 1.4;
   }

   .warning-note {
     font-size: 0.85rem;
     font-style: italic;
   }

   .error-box {
     background: var(--error-bg);
     border: 1px solid var(--error-border);
     border-radius: 8px;
     padding: 1rem 1.25rem;
     margin-bottom: 1.5rem;
   }

   .error-box h2 {
     margin: 0 0 0.75rem;
     font-size: 1rem;
     font-weight: 600;
     color: #b06060;
   }

   .error-box ul {
     margin: 0;
     padding-left: 1.25rem;
   }

   .error-box li {
     margin-bottom: 0.25rem;
     font-size: 0.9rem;
     color: #a07070;
   }

   /* Form inputs enhancements */
   .form-input-lg {
     font-size: 1.05rem;
     padding: 0.75rem 1rem;
   }

   .form-hint {
     display: block;
     margin-top: 0.4rem;
     color: var(--text-muted);
     font-size: 0.85rem;
   }

   /* Items section in edit form */
   .items-section {
     margin-bottom: 1.5rem;
     padding-top: 1.5rem;
     border-top: 1px solid var(--border);
   }

   .items-edit-list {
     display: flex;
     flex-direction: column;
     gap: 0.5rem;
     margin-top: 1rem;
   }

   .item-edit-row {
     display: flex;
     align-items: center;
     gap: 0.5rem;
     padding: 0.75rem;
     background: var(--surface-2);
     border: 1px solid var(--border);
     border-radius: 6px;
     transition: background 0.2s, border-color 0.2s, opacity 0.15s;
     cursor: move;
   }

   .item-edit-row:focus-within {
     background: var(--surface);
     border-color: var(--accent);
   }

   .item-edit-row.dragging {
     opacity: 0.4;
     background: var(--surface-2);
     border-color: var(--accent);
   }

   .item-edit-row:hover {
     background: var(--surface);
     border-color: var(--border);
   }

   .item-drag-handle {
     display: flex;
     align-items: center;
     justify-content: center;
     width: 1.5rem;
     color: var(--text-muted);
     cursor: grab;
     font-weight: 600;
     flex-shrink: 0;
   }

   .item-drag-handle:active {
     cursor: grabbing;
   }

   .item-input-wrapper {
     flex: 1;
   }

   .item-input {
     width: 100%;
     padding: 0.5rem 0.75rem;
     background: transparent;
     color: var(--text);
     border: none;
     border-radius: 4px;
     font-size: 0.95rem;
     font-family: system-ui, -apple-system, sans-serif;
     outline: none;
   }

   .item-input::placeholder {
     color: var(--text-muted);
   }

   .item-remove-btn {
     display: flex;
     align-items: center;
     justify-content: center;
     width: 2rem;
     height: 2rem;
     cursor: pointer;
     color: var(--text-muted);
     transition: color 0.2s;
   }

   .item-remove-btn:hover {
     color: #a05050;
   }

   .item-remove-btn input[type="checkbox"] {
     display: none;
   }

   .item-remove-btn span {
     font-size: 1rem;
   }

   /* Danger zone */
   .danger-zone {
     background: var(--warning-bg);
     border: 1px solid var(--warning-border);
     border-radius: 8px;
     padding: 1.25rem;
     margin-top: 2rem;
   }

   .danger-zone h4 {
     margin: 0 0 1rem;
     font-size: 0.95rem;
     font-weight: 600;
     color: var(--warning-text);
     text-transform: uppercase;
     letter-spacing: 0.05em;
   }

   .empty-items {
  color: var(--text-muted);
  margin: 0;
}

.empty-items a {
  color: var(--accent);
}

/* Spellbook edit */

.items-section {
  margin-bottom: 1.25rem;
}

.items-section h3 {
  margin-bottom: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.items-list {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.item-row {
  display: contents;
}

.item-input-wrapper {
  display: flex;
  align-items: center;
}

.item-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.95rem;
  font-family: system-ui, -apple-system, sans-serif;
}

.item-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.item-row .remove-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 150ms ease;
}

.item-row .remove-label:hover {
  opacity: 1;
}

.remove-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
}

.reference-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-left: 4px solid var(--warning);
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.delete-section {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  margin-top: 1rem;
}

/* ============================================================
   Settings page
   ============================================================ */

.settings-section {
  margin-bottom: 1.5rem;
}

.settings-section--divided {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.settings-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.settings-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.settings-stack-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings-stack-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
}

.settings-stack-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.settings-stack-rename {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}

.stack-name-input {
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.6rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: system-ui, -apple-system, sans-serif;
}

.stack-name-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.settings-stack-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.settings-stack-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.settings-stack-new {
  margin-top: 0.75rem;
}

.settings-callout {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(100, 160, 255, 0.06);
  border: 1px solid rgba(100, 160, 255, 0.2);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.settings-callout strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.settings-callout p {
  margin: 0;
}

.settings-callout--green {
  background: rgba(61, 139, 85, 0.1);
  border-color: rgba(61, 139, 85, 0.35);
  color: #7ecf9a;
}

.settings-callout--stasis {
  background: rgba(120, 40, 160, 0.12);
  border-color: rgba(180, 80, 200, 0.35);
  color: #c8a0e8;
}

/* Settings panel — elevated card wrapping a form */
.settings-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

/* Generic field wrapper — label stacked above control */
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.settings-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Checkbox row — label beside the box */
.settings-field--checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
}

.settings-field--checkbox label {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.settings-checkbox {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Styled select to match dark theme */
.settings-select {
  appearance: none;
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
}

.settings-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Sub-hint beneath a form */
.settings-hint--inline {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

/* ============================================================
   Global Nav
   ============================================================ */

.app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.app-nav-item {
  flex: 1;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.app-nav-item.active {
  color: var(--text);
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1em;
  height: 1.1em;
  padding: 0 0.3em;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  background: rgba(180, 80, 200, 0.7);
  border-radius: 9px;
  margin-left: 0.2em;
  vertical-align: middle;
}

.nav-badge--empty {
  background: rgba(100, 100, 110, 0.5);
  color: rgba(200, 200, 210, 0.6);
}

.nav-badge--stasis {
  background: rgba(100, 100, 120, 0.45);
  color: rgba(180, 180, 200, 0.55);
}

/* On mobile, add bottom padding so nav doesn't obscure content */
main {
  padding-bottom: 60px;
}

@media (min-width: 768px) {
  .app-nav {
    position: static;
    border-top: none;
    border-bottom: 1px solid var(--border);
    justify-content: center;
    gap: 2rem;
  }

  .app-nav-item {
    min-height: 48px;
  }

  main {
    padding-bottom: 0;
  }
}

/* ============================================================
   CEO Gameboard (cards#index)
   ============================================================ */

.gameboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* Upkeep Digest */

.upkeep-digest {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.upkeep-cell {
  display: grid;
  grid-template-columns: 14px 1fr;
  align-items: center;
  column-gap: 0.4rem;
  row-gap: 0.15rem;
}

.upkeep-cell .upkeep-label {
  grid-column: 1 / -1;
}

.upkeep-label {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
}

.upkeep-value {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: contents;
}

.upkeep-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.upkeep-warning .upkeep-value { color: var(--warning-text); }
.upkeep-ollama-offline .upkeep-value { color: #d4860a; }
.upkeep-ollama-unknown .upkeep-value { color: var(--text-muted); }

.turn-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.turn-panel--open {
  border-left: 2px solid var(--accent);
}

.turn-panel--closed {
  border-left: 2px solid var(--surface-border, #333);
  opacity: 0.85;
}

.turn-panel-close-context {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.turn-phase-time {
  font-size: 0.75rem;
  font-weight: normal;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.turn-panel-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.4rem 0;
}

.turn-panel-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.economy-display {
  display: inline-flex;
  gap: 0.5rem;
}

.economy-display--centered {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.economy-display--centered .economy-plump-helmets {
  font-size: 1.6rem;
}

.economy-display--centered .economy-dwarven-coins {
  font-size: 1.9rem;
}

.economy-bounce {
  animation: economy-bounce 0.4s ease-out;
}

@keyframes economy-bounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.35); }
  60%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* Sun poke — slow radiant growth with rotating glow */
.sun-radiate {
  animation: sun-radiate 2.2s ease-out;
  display: inline-block;
  position: relative;
  z-index: 10000;
}

@keyframes sun-radiate {
  0%   { transform: scale(1)   rotate(0deg);   filter: none; }
  20%  { transform: scale(1.4) rotate(30deg);  filter: drop-shadow(0 0 5px #4de8a0) drop-shadow(0 0 12px #2a9a5a); }
  52%  { transform: scale(2.1) rotate(92deg);  filter: drop-shadow(0 0 10px #4de8a0) drop-shadow(0 0 22px #2a9a5a) drop-shadow(0 0 38px #1a6040); }
  76%  { transform: scale(1.5) rotate(148deg); filter: drop-shadow(0 0 5px #4de8a0); }
  100% { transform: scale(1)   rotate(180deg); filter: none; }
}

/* Sun rays — beams that grow outward from the click origin */
.sun-ray {
  position: fixed;
  width: 2px;
  height: 14px;
  background: linear-gradient(to top, #4de8a0, rgba(60, 180, 100, 0));
  pointer-events: none;
  z-index: 9999;
  border-radius: 2px 2px 0 0;
  transform-origin: 50% 100%;
  animation: sun-ray-extend 1.5s ease-out forwards;
}

@keyframes sun-ray-extend {
  0%   { transform: rotate(var(--angle)) scaleY(0);             opacity: 1; }
  55%  { transform: rotate(var(--angle)) scaleY(var(--reach));  opacity: 0.9; }
  100% { transform: rotate(var(--angle)) scaleY(var(--reach));  opacity: 0; }
}

/* Stasis overrides — hue-shift mushroom blue + blue glow + blue rays */
[data-fortress-status="stasis"] .plump-helmet-shroom {
  filter: hue-rotate(210deg);
}


.sun-radiate--stasis {
  animation-name: sun-radiate-stasis;
}

@keyframes sun-radiate-stasis {
  0%   { transform: scale(1)   rotate(0deg);   filter: none; }
  20%  { transform: scale(1.4) rotate(30deg);  filter: drop-shadow(0 0 5px #7ab8f5) drop-shadow(0 0 12px #2a6cb5); }
  52%  { transform: scale(2.1) rotate(92deg);  filter: drop-shadow(0 0 10px #7ab8f5) drop-shadow(0 0 22px #2a6cb5) drop-shadow(0 0 38px #0a3a7a); }
  76%  { transform: scale(1.5) rotate(148deg); filter: drop-shadow(0 0 5px #7ab8f5); }
  100% { transform: scale(1)   rotate(180deg); filter: none; }
}

.sun-ray--stasis {
  background: linear-gradient(to top, #7ab8f5, rgba(100, 160, 240, 0));
}

/* Mushroom poke — Disney squash-and-stretch */
.mushroom-sproink {
  animation: mushroom-sproink 1.4s ease-out;
  display: inline-block;
  transform-origin: center bottom;
}

@keyframes mushroom-sproink {
  /*  anticipation: slight squash before the pop  */
  0%   { transform: scaleX(1)    scaleY(1); }
  8%   { transform: scaleX(1.2)  scaleY(0.8); }
  /*  deep squash — full wind-up  */
  16%  { transform: scaleX(1.45) scaleY(0.5); }
  /*  launch stretch — tall and narrow shooting up  */
  28%  { transform: scaleX(0.6)  scaleY(2.6); }
  /*  peak — big overshoot, slight squash at top  */
  40%  { transform: scaleX(1.15) scaleY(2.1); }
  /*  fall stretch — elongated coming back down  */
  52%  { transform: scaleX(0.65) scaleY(2.2); }
  /*  landing squash — hits the ground  */
  62%  { transform: scaleX(1.5)  scaleY(0.65); }
  /*  second bounce up — smaller  */
  72%  { transform: scaleX(0.85) scaleY(1.45); }
  /*  second landing  */
  82%  { transform: scaleX(1.18) scaleY(0.88); }
  /*  tiny settle  */
  92%  { transform: scaleX(0.97) scaleY(1.04); }
  100% { transform: scaleX(1)    scaleY(1); }
}

/* Confetti particles */
.confetti-particle {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  animation: confetti-fall 1.6s ease-in forwards;
}

@keyframes confetti-fall {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  20%  { transform: translate(calc(var(--dx) * 0.2), calc(var(--dy) * -0.3)) scale(1.1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.5); opacity: 0; }
}

.confetti-particle--slow {
  animation: confetti-burst-slow 1.4s ease-out forwards;
  width: 7px;
  height: 7px;
}

@keyframes confetti-burst-slow {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  60%  { opacity: 0.8; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.4); opacity: 0; }
}

/* Mushroom poke confetti — fast radial burst, small particles, snappy exit */
.confetti-particle--mushroom {
  animation: confetti-mushroom 0.65s cubic-bezier(0.2, 0.8, 0.4, 1) forwards;
  width: var(--size, 6px);
  height: var(--size, 6px);
  border-radius: 2px;
}

@keyframes confetti-mushroom {
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 1; }
  50%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2) rotate(var(--spin, 180deg)); opacity: 0; }
}

/* Flame particles — bright, fast rise from bottom */
.flame-particle {
  position: fixed;
  width: 8px;
  height: 12px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 0 8px 3px rgba(255, 140, 0, 0.5);
  animation: flame-rise 0.7s ease-out forwards;
}

@keyframes flame-rise {
  0%   { transform: translate(0, 0) scale(1.2); opacity: 1; }
  30%  { transform: translate(calc(var(--drift) * 0.3), calc(var(--rise) * 0.4)) scale(1); opacity: 0.9; }
  100% { transform: translate(var(--drift), var(--rise)) scale(0.2); opacity: 0; }
}

/* Ember particles — small, scatter wide, rise higher */
.ember-particle {
  position: fixed;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 0 4px 1px rgba(255, 100, 0, 0.6);
  animation: ember-rise 1.4s ease-out forwards;
}

@keyframes ember-rise {
  0%   { transform: translate(0, 0) scale(1); opacity: 0.9; }
  40%  { opacity: 1; }
  70%  { transform: translate(calc(var(--drift) * 0.7), calc(var(--rise) * 0.7)) scale(0.7); opacity: 0.6; }
  100% { transform: translate(var(--drift), var(--rise)) scale(0); opacity: 0; }
}

/* Smoke wisps — grey, slow, diffuse */
.smoke-particle {
  position: fixed;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  background: rgba(120, 110, 100, 0.4);
  filter: blur(3px);
  animation: smoke-rise 1.8s ease-out forwards;
}

@keyframes smoke-rise {
  0%   { transform: translate(0, 0) scale(0.6); opacity: 0; }
  15%  { opacity: 0.35; }
  50%  { transform: translate(calc(var(--drift) * 0.5), calc(var(--rise) * 0.5)) scale(1.2); opacity: 0.2; }
  100% { transform: translate(var(--drift), var(--rise)) scale(1.8); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .economy-bounce { animation: none; }
  .mushroom-sproink { animation: none; }
  .sun-radiate { animation: none; }
  .sun-ray { animation: none; display: none; }
  .confetti-particle { animation: none; display: none; }
  .ember-particle, .flame-particle, .smoke-particle { animation: none; display: none; }
}

/* The Cellar — ale sampler on Settings */
.cellar-barrels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.cellar-barrel {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cellar-barrel:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.cellar-panel {
  position: relative;
  overflow: hidden;
}

.cellar-panel .cellar-barrels,
.cellar-panel .settings-section-title,
.cellar-panel .settings-hint {
  position: relative;
  z-index: 2;
}

.cellar-pour {
  animation: ale-rise 1s ease-out forwards;
  border-radius: inherit;
}

.economy-plump-helmets {
  font-size: 1.1rem;
  font-weight: 700;
  color: #c070e0;
}

.economy-dwarven-coins {
  font-size: 1.3rem;
  font-weight: 600;
  color: #3d7050;
}

.dwarven-coin-sun {
  display: inline-block;
  position: relative;
  z-index: 10000;
  font-size: 1.25em;
  font-weight: 700;
  line-height: 1;
}

.turn-panel-label {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--accent);
}

.turn-panel-phase {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.turn-panel-replay-link {
  background: transparent;
  border: 1px solid rgba(255, 152, 0, 0.4);
  border-radius: 4px;
  color: #ff9800;
  font-size: 0.65rem;
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 0 6px rgba(255, 152, 0, 0.15), inset 0 0 4px rgba(255, 152, 0, 0.05);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.turn-panel-replay-link:hover {
  color: #ffb74d;
  border-color: rgba(255, 152, 0, 0.7);
  box-shadow: 0 0 10px rgba(255, 152, 0, 0.3), inset 0 0 6px rgba(255, 152, 0, 0.1);
}

.turn-panel-calculating {
  font-weight: 400;
  color: var(--warning-text);
  animation: pulse-opacity 1.5s ease-in-out infinite;
}

.turn-panel-calculating.hidden {
  display: none;
}

.turn-phase-strip {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.turn-step {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.turn-step::after {
  content: "→";
  color: var(--text-muted);
  font-size: 0.75rem;
  margin: 0 0.1rem;
}

.turn-step:last-child::after {
  content: "";
}

.turn-step-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.turn-step--done .turn-step-detail {
  color: var(--text);
}

.turn-panel-replays {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
}

.turn-panel-replays .btn {
  font-size: 0.65rem;
  padding: 0.1rem 0.45rem;
  min-height: unset;
}

.turn-details {
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}

.turn-details-summary {
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
}

.turn-phase-empty {
  color: var(--text-muted);
  font-style: italic;
}

.turn-phase-group {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.turn-phase-group:last-child {
  border-bottom: none;
}

.turn-phase-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 0.25rem;
}

.turn-phase-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.15rem 0;
}

.turn-phase-row .turn-card-list {
  flex-basis: 100%;
}

.turn-phase-name {
  flex-shrink: 0;
  width: 4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.turn-phase-detail {
  font-size: 0.85rem;
}

.turn-phase-totals {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
}

.turn-card-list {
  list-style: none;
  padding: 0;
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
}

.turn-card-list li {
  padding: 0.1rem 0;
}

.turn-synthesis-details {
  width: 100%;
}

.turn-synthesis-summary {
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

.turn-synthesis-notes {
  white-space: pre-wrap;
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0.25rem 0 0;
  color: var(--text);
}

/* Quick Capture */

.quick-capture {
  margin-bottom: 1rem;
}

.quick-capture-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.quick-capture-input {
  flex: 1;
  background: var(--surface-2, #1a1a2e);
  border: 1px solid var(--border-color, #333);
  color: var(--text-primary, #e0e0e0);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-family: var(--font-mono, monospace);
  font-size: 0.85rem;
}

.quick-capture-form .btn {
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  min-height: auto;
}

.quick-capture-input:focus {
  outline: 2px solid var(--accent-color, #6c63ff);
  outline-offset: 2px;
}

.quick-capture-stack {
  background: var(--surface-2, #1a1a2e);
  border: 1px solid var(--border-color, #333);
  color: var(--text-primary, #e0e0e0);
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

/* Card Counts */

.card-counts {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.count-separator {
  color: var(--border);
}

/* Zone Sections */

.zone-section {
  margin-bottom: 2rem;
}

.zone-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.zone-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Hand zone collapse */

.hand-details {
  width: 100%;
}

.hand-details > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.hand-details > summary::-webkit-details-marker {
  display: none;
}

.hand-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
  cursor: pointer;
}

.hand-toggle-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hand-empty {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9rem;
  padding: 0.75rem 0;
}

/* Card Grid */

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  perspective: 800px;
}

@media (min-width: 600px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
  }
}

/* Gameboard Empty State */

.gameboard-empty {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
}

.gameboard-empty p {
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.gameboard-empty p:first-child {
  color: var(--text);
  font-weight: 500;
}

/* ============================================================
   Stack Columns — Gameboard Layout
   ============================================================ */

.stack-columns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  align-items: start;
}

@media (min-width: 900px) {
  .stack-columns {
    grid-template-columns: repeat(auto-fill, minmax(200px, 256px));
  }
}

.stack-column {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 200px;
}

.stack-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px 8px 0 0;
  gap: 0.4rem;
}

.stack-name {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.stack-header-controls {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.stack-card-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 1.2rem;
  text-align: center;
}

.btn-icon {
  padding: 0.15rem 0.35rem;
  font-size: 0.75rem;
  line-height: 1;
  min-width: auto;
}

.btn-stack-arrow {
  padding: 0.15rem 0.3rem;
  font-size: 0.8rem;
  line-height: 1;
  opacity: 0.6;
}

.btn-stack-arrow:hover {
  opacity: 1;
}

.stack-phase {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  flex: 1;
  min-height: 3rem;
}

.stack-card-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stack-empty-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
  border: 1px dashed var(--border);
  border-radius: 6px;
  margin: 0.5rem;
}

.stack-phase-divider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0;
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;

  &::before,
  &::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
  }
}

/* Card stack move form — inline dropdown in stack/hand */

.card-stack-controls {
  display: none;
  gap: 0.25rem;
  align-items: center;
  padding: 0 0.25rem 0.25rem;
  flex-wrap: wrap;
}

.stack-pos-btn {
  padding: 0.15rem 0.4rem;
  min-width: 1.8rem;
}

.card-stack-move-form {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.stack-select {
  flex: 1;
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  min-width: 0;
}

/* Hand zone card grid */

.hand-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

@media (min-width: 600px) {
  .hand-cards {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
  }
}

.hand-card-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.hand-card-wrapper .card-tile {
  width: 100%;
}

/* Card Tile — visual card object with anatomy */

.card-tile {
  max-width: 256px;
  background: linear-gradient(160deg, #2a2a2a 0%, #1e1e1e 100%);
  border: 2px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: visible; /* Required for gap budget overlap */
  position: relative;
  transition: opacity 0.2s ease, filter 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  transform-origin: center center;
}

@media (min-width: 600px) {
  .card-tile {
    aspect-ratio: 1 / 1;
  }
}

.card-tile.state-untapped {
  z-index: 1;
}

.card-tile.state-tapped {
  z-index: 5; /* Lifted above neighbors */
}

.card-tile.state-animating {
  z-index: 10;
}

.card-face {
  display: flex;
  flex-direction: column;
  flex: 1;
  transition: opacity 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  .card-tile {
    transition: none;
  }
}

/* State atmosphere — luminance/saturation hierarchy (Spec 0030) */

.card-tile.state-untapped {
  filter: none;
  border-color: var(--border);
  background: linear-gradient(160deg, #2a2a2a 0%, #1e1e1e 100%);
}

.card-tile.state-untapped:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.6), 0 0 22px rgba(180,120,40,0.2);
  border-color: rgba(180,120,40,0.25);
}

.card-tile.state-untapped .card-face {
  opacity: 1;
}

/* Tapped — brown, spent. The tap gesture is the only warmth signal. */
.card-tile.state-tapped {
  filter: saturate(0.8);
  border-color: rgba(230, 126, 34, 0.4);
  background: #1e1400; /* Amber-brown */
}

.card-tile.state-tapped .card-face {
  opacity: 0.85;
}

.card-tile.state-tapped .card-state-footer {
  border-top-color: rgba(230, 126, 34, 0.2);
}

/* Charred — dark ash, task resolved. The fire is out. */
.card-tile.state-charred {
  filter: saturate(0.3) brightness(0.7);
  border-color: rgba(80, 60, 40, 0.4);
  background: #120e08;
}

.card-tile.state-charred .card-face {
  opacity: 0.6;
}

.card-tile.state-charred .card-state-footer {
  border-top-color: rgba(80, 60, 40, 0.2);
}

.card-tile.state-charred .state-indicator {
  color: rgba(180, 140, 100, 0.6);
}

.card-tile.state-suppressed {
  filter: grayscale(50%);
  border-color: rgba(100, 100, 100, 0.3);
  background: var(--surface);
}

.card-tile.state-suppressed .card-face {
  opacity: 0.5;
}

.card-tile.state-suppressed .state-indicator {
  color: var(--text-muted);
}

/* Color rail — top accent bar for color identity (Spec 0056)
   Uses ::before pseudo-element as a horizontal band across the card top.
   The rail is permanent; it does NOT change on tap/untap/suppress.
   Body color = mechanical state. Rail = intent identity. */

.card-tile[data-color]:not([data-color=""])::before,
.library-card[data-color]:not([data-color=""])::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 6px;
  border-radius: 8px 8px 0 0;
  z-index: 1;
}

.task-item[data-color]:not([data-color=""])::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  border-radius: 7px 7px 0 0;
  z-index: 1;
}

/* Add relative positioning for pseudo-element containers */
.task-item { position: relative; }

/* Textured gradients per color — horizontal stone grain */
[data-color="red"]::before {
  background: linear-gradient(
    90deg,
    #c45045 0%, #a83a30 18%, #b84038 35%, #8b2e25 52%,
    #c04a40 68%, #a03530 85%, #b5453a 100%
  );
}
[data-color="green"]::before {
  background: linear-gradient(
    90deg,
    #48a065 0%, #358550 18%, #4a9b60 35%, #2d7045 52%,
    #40905a 68%, #358a4e 85%, #3d8b55 100%
  );
}
[data-color="blue"]::before {
  background: linear-gradient(
    90deg,
    #5590c0 0%, #3d75a5 18%, #4f8ab8 35%, #356895 52%,
    #4a82b0 68%, #3e78a8 85%, #4a7fb5 100%
  );
}
[data-color="white"]::before {
  background: linear-gradient(
    90deg,
    #d5cec5 0%, #b8b0a8 18%, #ccc5bc 35%, #a8a098 52%,
    #c0b8b0 68%, #d0c8c0 85%, #c8c0b8 100%
  );
}
[data-color="black"]::before {
  background: linear-gradient(
    90deg,
    #8855a0 0%, #6b3d80 18%, #7e4e95 35%, #5a3070 52%,
    #7548a8 68%, #684085 85%, #7b4a8e 100%
  );
}

/* Colorless — no pseudo-element (data-color="" matches no selector) */

/* Header region — name + energy pip */

.card-tile .card-header {
  padding: 0.75rem 0.75rem 0.35rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.card-tile .card-name {
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

/* Header edit button — sits between name and energy badge */

.card-header-edit {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0 0.3rem;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1.3;
  opacity: 0;
  transition: opacity 0.15s;
}

.card-tile:hover .card-header-edit {
  opacity: 1;
}

.card-header-edit:hover {
  color: var(--accent);
}

.card-header-edit--disabled {
  opacity: 0;
  cursor: not-allowed;
}

.card-tile:hover .card-header-edit--disabled {
  opacity: 0.3;
}

/* Bounce button — return to hand from battlefield header */
.card-header-bounce {
  font-size: 0.9rem;
}

.card-header-bounce:hover {
  color: var(--warning);
}

/* Energy badge — prominent mana pip */

.energy-badge {
  font-size: 0.875rem;
  font-weight: 800;
  min-width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-muted);
  color: rgba(74, 158, 255, 0.7);
  flex-shrink: 0;
  border: 1px solid rgba(74, 158, 255, 0.2);
}

/* Type line — structural divider, label slot for F-041 */

.card-type-line {
  padding: 0 0.75rem;
  position: relative;
  margin-bottom: 0.35rem;
}

.card-type-line hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

.card-type-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -0.5em;
  background: inherit;
  padding: 0 0.5rem;
}

.card-type-label:empty {
  display: none;
}

/* Body region — behavior preview */

.card-tile .card-body {
  padding: 0 0.75rem 0.5rem;
  flex: 1;
}

.card-tile .card-body p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

/* State footer — game state, not actions */

.card-state-footer {
  border-top: 1px solid var(--border);
  padding: 0.5rem 0.75rem 0.625rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.counter-badge {
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Counter-zero — card is charged and ready to fire. Vibrates like a coiled spring. */
@keyframes counter-zero-vibrate {
  0%, 100% { transform: translate(0, 0); }
  10%      { transform: translate(-1px, 0.5px); }
  20%      { transform: translate(1px, -0.5px); }
  30%      { transform: translate(-0.5px, -1px); }
  40%      { transform: translate(1px, 0.5px); }
  50%      { transform: translate(-1px, -0.5px); }
  60%      { transform: translate(0.5px, 1px); }
  70%      { transform: translate(-1px, 0px); }
  80%      { transform: translate(0.5px, -0.5px); }
  90%      { transform: translate(-0.5px, 0.5px); }
}

.card-tile.counter-zero {
  border-color: rgba(230, 160, 50, 0.5);
  box-shadow: inset 0 0 8px 1px rgba(230, 160, 50, 0.2),
              0 0 6px rgba(230, 160, 50, 0.15);
  animation: counter-zero-vibrate 4s linear infinite;
}

.card-tile.counter-zero .counter-badge {
  color: #e6a032;
  border-color: rgba(230, 160, 50, 0.5);
  background: rgba(230, 160, 50, 0.15);
}

@media (prefers-reduced-motion: reduce) {
  .card-tile.counter-zero {
    animation: none;
  }
}

.spellbook-indicator {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* State indicator — subtle, ambient */

.state-indicator {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.state-indicator--untapped {
  background: transparent;
  color: var(--text-muted);
}

.state-indicator--tapped {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

.state-indicator--fired {
  background: var(--accent-muted);
  color: var(--accent);
}

.state-indicator--suppressed {
  background: var(--surface-2);
  color: var(--text-muted);
}

/* Card chrome — action buttons, always upright, full opacity */

.btn-tap-now {
  background: #c47a20;
  color: #fff;
  border-color: #d48a2a;
}
.btn-tap-now:hover {
  background: #d48a2a;
}
.btn-tap-now-inline {
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1.2;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  touch-action: auto !important;
  pointer-events: auto !important;
}

.footer-actions {
  margin-left: auto;
  display: flex;
  gap: 0.3rem;
  align-items: center;
  touch-action: auto !important;
  pointer-events: auto !important;
}

.btn-footer {
  padding: 0.15rem 0.5rem;
  font-size: 0.65rem;
  line-height: 1.2;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  color: #fff;
  touch-action: auto !important;
  pointer-events: auto !important;
}

.btn-to-hand { background: #2a6a9a; }
.btn-to-hand:hover { background: #3580b8; }

.btn-edit { background: #6a4a8a; }
.btn-edit:hover { background: #7d5ea0; }

.btn-delete { background: #8a4a1a; }
.btn-delete:hover { background: #a05a22; }

.footer-action-form {
  display: contents;
}

.card-chrome {
  display: none;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.1);
  align-items: center;
  flex-wrap: wrap;
}

/* Show card chrome only in hand zone (cast form needed; stacks use drag) */
.hand-card-wrapper .card-chrome {
  display: flex;
}

.card-chrome,
.card-chrome select,
.card-chrome button,
.card-chrome input {
  touch-action: auto !important;
  pointer-events: auto !important;
}

.card-chrome form {
  display: flex;
}

.card-chrome .btn {
  flex: none;
}

/* Edit modal overlay */
.edit-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 5vh;
  overflow-y: auto;
}

.edit-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 90%;
  max-width: 700px;
  padding: 1.5rem;
  position: relative;
  margin-bottom: 2rem;
  transition: border-color 0.4s ease, background 0.4s ease;
}

.edit-modal[data-color="red"]   { border-color: var(--color-red);   background: color-mix(in srgb, var(--color-red) 8%, var(--surface)); }
.edit-modal[data-color="green"] { border-color: var(--color-green); background: color-mix(in srgb, var(--color-green) 8%, var(--surface)); }
.edit-modal[data-color="blue"]  { border-color: var(--color-blue);  background: color-mix(in srgb, var(--color-blue) 8%, var(--surface)); }
.edit-modal[data-color="white"] { border-color: var(--color-white); background: color-mix(in srgb, var(--color-white) 5%, var(--surface)); }
.edit-modal[data-color="black"] { border-color: var(--color-black); background: color-mix(in srgb, var(--color-black) 8%, var(--surface)); }

.edit-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
}

.edit-modal-close:hover {
  color: var(--text, #eee);
}

.edit-modal-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

.confirm-modal {
  max-width: 380px;
  padding: 1.75rem 1.5rem 1.25rem;
}

.confirm-modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  padding-right: 2rem;
}

.confirm-modal-message {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

.confirm-modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.cast-form {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.cast-select {
  flex: 1;
  font-size: 0.8rem;
  padding: 0.3rem 0.4rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  min-width: 4rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cast-form .btn {
  padding: 0.3rem 0.5rem;
  font-size: 0.75rem;
  min-height: 0;
  white-space: nowrap;
  width: auto;
  flex: none;
}

/* ============================================================
   Test Bench
   ============================================================ */

.test-bench {
  margin-top: 2rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.test-bench__heading {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.test-bench__controls {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.test-bench__energy {
  width: 5rem;
}

.test-bench__buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.test-bench__results {
  margin-top: 0.75rem;
  font-family: monospace;
  font-size: 0.875rem;
}

.test-bench-row {
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.25rem;
  background: var(--surface-2);
  border-left: 3px solid var(--border);
}

.test-bench-row--ok {
  border-left-color: #4caf50;
}

.test-bench-row--fallback {
  border-left-color: var(--warning);
}

.test-bench-row--invalid {
  border-left-color: var(--danger);
}

.test-bench-row--unavailable {
  border-left-color: var(--text-muted);
}

.test-bench-summary {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--surface-2);
  border-radius: 4px;
  font-size: 0.875rem;
  line-height: 1.6;
}

/* ===== Toast ===== */

#toast-container {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 200;
  pointer-events: none;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  color: var(--text);
  font-size: 0.9rem;
  white-space: nowrap;
  animation: toast-dismiss 150ms ease-out 2.5s forwards;
}

.toast.error {
  border-color: var(--badge-urgent);
  color: var(--badge-text);
}

@keyframes toast-dismiss {
  to { opacity: 0; pointer-events: none; }
}

@media (min-width: 768px) {
  #toast-container {
    bottom: 1.5rem;
    right: 1.5rem;
    left: auto;
    transform: none;
  }
}

/* ===== Inline Confirm ===== */

.confirm-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-secondary);
  padding: 0.5rem;
  border-radius: 0.375rem;
}

.confirm-label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ===== Action Feel: Resolution Transitions ===== */

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Accept (Completed): ale fill, then slide up + fade. */
.resolving--completed {
  transform: translateY(-100%);
  opacity: 0;
  border-color: rgba(140, 60, 180, 0.5) !important;
  transition: transform 250ms ease-out, opacity 250ms ease-out, border-color 30ms ease-in;
  overflow: hidden;
}

/* Purple ale rising from bottom of the task card */
.ale-fill {
  position: absolute;
  bottom: 0;
  left: -4px;
  right: -4px;
  height: 0;
  background: linear-gradient(
    0deg,
    var(--ale-deep) 0%,
    var(--ale-mid) 40%,
    var(--ale-light) 75%,
    var(--ale-top) 100%
  );
  border-radius: inherit;
  z-index: 1;
  pointer-events: none;
  filter: url(#ale-turbulence);
  animation: ale-rise 0.6s ease-out forwards;
}

/* Foam head at the top edge of the fill */
.ale-fill::after {
  content: '';
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 12px;
  background: linear-gradient(
    0deg,
    transparent 0%,
    var(--ale-foam, rgba(220, 190, 240, 0.3)) 40%,
    var(--ale-foam-top, rgba(240, 220, 255, 0.15)) 100%
  );
  filter: url(#ale-turbulence) blur(1px);
  border-radius: 50%;
}

@keyframes ale-rise {
  0%   { height: 0; }
  100% { height: 100%; }
}

/* Bubbles rising through the ale */
.ale-bubble {
  position: absolute;
  bottom: 0;
  border-radius: 50%;
  background: rgba(220, 190, 255, 0.35);
  border: 1px solid rgba(240, 220, 255, 0.2);
  z-index: 2;
  pointer-events: none;
  animation: bubble-rise 0.7s ease-out forwards;
}

@keyframes bubble-rise {
  0%   { transform: translateY(0) scale(0.6); opacity: 0.6; }
  50%  { opacity: 0.8; }
  100% { transform: translateY(-80px) scale(0.3); opacity: 0; }
}

/* Defer: slide right + fade, 150ms. Lateral = "moved aside". */
.resolving--defer {
  transform: translateX(100%);
  opacity: 0;
  transition: transform 150ms ease-out, opacity 150ms ease-out;
  overflow: hidden;
}

/* Decline (Failed): the panel itself darkens and burns away. */
.resolving--failed {
  animation: panel-burn 2s ease-out forwards;
  overflow: visible;
}

@keyframes panel-burn {
  0%   { background-color: var(--surface); border-color: var(--border); filter: brightness(1) saturate(1); opacity: 1; }
  12%  { background-color: #3a1800; border-color: rgba(230, 126, 34, 0.6); filter: brightness(1.3) saturate(0.8); opacity: 1; }
  30%  { background-color: #2a1000; border-color: rgba(200, 100, 20, 0.5); filter: brightness(1.0) saturate(0.5); opacity: 1; }
  55%  { background-color: #1a0a00; border-color: rgba(120, 60, 10, 0.4); filter: brightness(0.6) saturate(0.3); opacity: 0.85; }
  80%  { background-color: #0e0804; border-color: rgba(60, 40, 20, 0.3); filter: brightness(0.3) saturate(0.1); opacity: 0.5; }
  100% { background-color: #080404; border-color: rgba(40, 30, 20, 0.2); filter: brightness(0.15) saturate(0); opacity: 0; }
}

/* Flavor text floats above the burning panel — fixed on body, immune to parent fade */
.decline-flash {
  position: fixed;
  transform: translate(-50%, -50%);
  max-width: 280px;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-style: italic;
  color: #ffe0b0;
  background: rgba(30, 15, 5, 0.9);
  border: 1px solid rgba(220, 130, 40, 0.4);
  border-radius: 6px;
  text-align: center;
  z-index: 9999;
  pointer-events: none;
  text-shadow: 0 0 8px rgba(255, 140, 0, 0.5);
  animation: flash-appear 0.25s ease-out forwards;
}

@keyframes flash-appear {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Completion flavor text — purple-tinted, floats over the ale fill */
.complete-flash {
  position: fixed;
  transform: translate(-50%, -50%);
  max-width: 280px;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-style: italic;
  color: #e0c0ff;
  background: rgba(30, 10, 40, 0.85);
  border: 1px solid rgba(160, 80, 200, 0.4);
  border-radius: 6px;
  text-align: center;
  z-index: 9999;
  pointer-events: none;
  text-shadow: 0 0 8px rgba(160, 80, 200, 0.4);
  animation: flash-appear 0.25s ease-out forwards;
}

/* Trail copy: defer destination line or decline flavor text */
.trail-copy {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
  padding: 0.5rem 1rem;
  opacity: 1;
  transition: opacity 300ms ease-out;
}

.trail-copy.fading {
  opacity: 0;
}

/* Resolved counter */
#resolved-counter:not(:empty) {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.5rem 0;
}

.counter-arriving {
  animation: fade-in 200ms ease-in forwards;
}

/* Empty state arrival after last card exits */
.empty-state.arriving {
  animation: fade-in 200ms ease-in 300ms both;
}

/* Cast / Return to hand highlight pulse on gameboard */
.card-tile.just-cast,
.card-tile.just-returned {
  animation: highlight-pulse 1s ease-out;
  z-index: 20; /* Ensure pulse isn't clipped */
}

@keyframes highlight-pulse {
  0% { 
    box-shadow: 0 0 0 4px var(--accent);
    border-color: var(--accent) !important;
  }
  100% { 
    box-shadow: 0 0 0 0 transparent;
  }
}

/* Reduced motion: collapse all transitions/animations to instant */
@media (prefers-reduced-motion: reduce) {
  .resolving--accept,
  .resolving--defer,
  .resolving--decline {
    transition: none;
  }

  .trail-copy {
    transition: none;
  }

  .counter-arriving {
    animation: none;
  }

  .empty-state.arriving {
    animation: none;
    opacity: 1;
  }

  .card-tile.just-cast,
  .card-tile.just-returned {
    animation: none;
  }
}

/* ============================================================
   Simulated Board
   ============================================================ */

.simboard-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.simboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.simboard-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.simboard-form-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.simboard-form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.simboard-form-row .form-group {
  flex: 1;
  min-width: 120px;
  margin-bottom: 0;
}

.simboard-section-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.simboard-resolved-section,
.simboard-cards-section {
  margin-bottom: 1.25rem;
}

.simboard-resolved-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.simboard-resolved-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.simboard-resolved-name {
  flex: 1;
  min-width: 120px;
  padding: 0.35rem 0.6rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9rem;
}

.simboard-resolved-event {
  padding: 0.35rem 0.5rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9rem;
}

.simboard-card-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.simboard-card-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.simboard-card-energy {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.simboard-run-row {
  margin-top: 1.25rem;
}

.simboard-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-style: italic;
}

/* Results */

.simboard-results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.simboard-results-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 1rem 0 0.5rem;
}

.simboard-results-label:first-child {
  margin-top: 0;
}

.simboard-work-order {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

.simboard-priority-1 { border-left-color: var(--border); }
.simboard-priority-2 { border-left-color: var(--warning, #d4a017); }
.simboard-priority-3 { border-left-color: var(--danger, #c0392b); }

.simboard-wo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.simboard-wo-header .simboard-card-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.simboard-priority-badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.simboard-wo-message {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

.simboard-suppressed-card {
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
}

.simboard-suppressed-card:last-child {
  border-bottom: none;
}

.simboard-synthesis-notes {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
  font-style: italic;
}

.simboard-error {
  border: 1px solid var(--border);
  border-left: 4px solid var(--danger, #c0392b);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--text);
}

.simboard-results-empty {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9rem;
}

/* Header actions */
.header-actions {
  display: flex;
  gap: 0.5rem;
}

/* ============================================================
   Card Library
   ============================================================ */

.library-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.library-container > form {
  max-width: 640px;
}

.library-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.library-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.library-subheading {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.library-category {
  margin-bottom: 2rem;
}

.library-category-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.library-category-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  font-style: italic;
}

/* Footer section — darkened zone for "You get the idea" */
.library-category--footer {
  background: rgba(0, 0, 0, 0.25);
  margin-left: -1rem;
  margin-right: -1rem;
  padding: 1.25rem 1rem 0;
  border-radius: 10px;
}

.color-legend {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  margin-top: 1.5rem;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.color-block {
  padding: 1.25rem 0.5rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.color-block[data-color="red"] {
  background: linear-gradient(135deg, #c45045 0%, #a83a30 25%, #8b2e25 50%, #b8403a 75%, #c04a40 100%);
  color: #f0d0cc;
}
.color-block[data-color="green"] {
  background: linear-gradient(135deg, #48a065 0%, #358550 25%, #2d7045 50%, #40905a 75%, #4ba568 100%);
  color: #c0e8d0;
}
.color-block[data-color="blue"] {
  background: linear-gradient(135deg, #5590c0 0%, #3d75a5 25%, #356895 50%, #4a82b0 75%, #5895c5 100%);
  color: #c0d8f0;
}
.color-block[data-color="white"] {
  background: linear-gradient(135deg, #d5cec5 0%, #b8b0a8 25%, #a8a098 50%, #c0b8b0 75%, #b5ada5 100%);
  color: #2a2a2a;
}
.color-block[data-color="black"] {
  background: linear-gradient(135deg, #8855a0 0%, #6b3d80 25%, #5a3070 50%, #7548a8 75%, #8a58a5 100%);
  color: #e0d0f0;
}

.library-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 600px) {
  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

.library-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.library-card-header {
  padding: 0.875rem 0.875rem 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.library-card-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.library-card-description {
  padding: 0 0.875rem 0.375rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.library-card-body {
  padding: 0 0.875rem 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
  opacity: 0.75;
  flex: 1;
}

.library-card-flavor {
  display: block;
  padding: 0 0.875rem 0.5rem;
  font-size: 0.72rem;
  font-style: italic;
  color: var(--text-muted);
  opacity: 0.6;
}

.library-card-hints {
  padding: 0 0.875rem 0.5rem;
  font-size: 0.75rem;
  font-family: monospace;
  color: var(--text-muted);
  margin: 0;
  opacity: 0.6;
}

.library-card-meta {
  padding: 0.25rem 0.875rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.library-card-footer {
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.library-card-footer .btn {
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  min-height: auto;
  line-height: 1.4;
}

.library-card-footer form {
  display: flex;
}

.preview-stage {
  padding: 0.5rem 0.875rem;
  min-height: 2.5rem;
}

.preview-task-sample {
  display: block;
  opacity: 0;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--text);
  background: rgba(77, 232, 194, 0.08);
  border: 1px solid rgba(77, 232, 194, 0.25);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  margin-top: 0.25rem;
  line-height: 1.4;
}

.preview-counter {
  display: inline-block;
  font-size: 0.75rem;
  opacity: 0;
}

.library-card--previewing {
  outline: 1px solid var(--border);
  z-index: 10;
  position: relative;
  overflow: visible;
}

.library-card--tapped {
  border-color: rgba(230, 126, 34, 0.4);
  background: #1e1400;
  filter: saturate(0.8);
}

.library-card--done {
  z-index: 10;
  position: relative;
}

@media (prefers-reduced-motion: reduce) {
  .library-card--previewing .preview-task-sample {
    opacity: 1;
  }
}

.library-already-playing {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* Card Type Form (Spec 0036) */
.card-type-selector {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card-type-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.card-type-option:hover {
  border-color: var(--accent-muted);
  background: rgba(74, 158, 255, 0.04);
}

.card-type-option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(74, 158, 255, 0.08);
}

.card-type-option input[type="radio"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.card-type-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* ============================================================
   Devise Auth Pages
   ============================================================ */

main > h2:first-child,
main > h2:first-of-type {
  max-width: 400px;
  margin: 2rem auto 1.5rem;
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
}

main > form:not([class]),
main > form[action*="sign_in"],
main > form[action*="password"],
main > form[action*="registration"] {
  max-width: 400px;
  margin: 0 auto;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

main > form:not([class]) div,
main > form[action*="sign_in"] div,
main > form[action*="password"] div,
main > form[action*="registration"] div {
  margin-bottom: 1rem;
}

main > form:not([class]) label,
main > form[action*="sign_in"] label,
main > form[action*="password"] label,
main > form[action*="registration"] label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
}

main > form:not([class]) input[type="text"],
main > form:not([class]) input[type="email"],
main > form:not([class]) input[type="password"],
main > form[action*="sign_in"] input[type="email"],
main > form[action*="sign_in"] input[type="password"],
main > form[action*="password"] input[type="email"],
main > form[action*="registration"] input[type="email"],
main > form[action*="registration"] input[type="password"] {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  font-family: system-ui, -apple-system, sans-serif;
  box-sizing: border-box;
}

main > form:not([class]) input:focus,
main > form[action*="sign_in"] input:focus,
main > form[action*="password"] input:focus,
main > form[action*="registration"] input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

main > form:not([class]) input[type="submit"],
main > form[action*="sign_in"] input[type="submit"],
main > form[action*="password"] input[type="submit"],
main > form[action*="registration"] input[type="submit"] {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  margin-top: 0.5rem;
}

main > form:not([class]) input[type="checkbox"] {
  margin-right: 0.4rem;
}

main > p:has(a),
main > .links {
  max-width: 400px;
  margin: 1rem auto;
  text-align: center;
}

main > p:has(a) a,
main > .links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

main > p:has(a) a:hover,
main > .links a:hover {
  text-decoration: underline;
}

#flash_alert,
#flash_notice,
main > p.alert,
main > p.notice {
  max-width: 400px;
  margin: 1rem auto;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  text-align: center;
}

main > p.alert {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--text);
}

main > p.notice {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Sorcery exit animation (Spec 0036 — triggered by Spec 0037) */
.card-tile.sorcery-consumed {
  animation: sorcery-exit 400ms ease-out forwards;
}

@keyframes sorcery-exit {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.95); }
}

/* Upkeep pulse — Morning Reveal beat 2 (Spec 0041) */
@keyframes upkeep-pulse {
  0%    { filter: brightness(1); box-shadow: inset 0 0 0 1px transparent; }
  10%   { filter: brightness(1.35); box-shadow: inset 0 0 10px 2px rgba(77, 232, 194, 0.45); }
  28%   { filter: brightness(1); box-shadow: inset 0 0 0 1px transparent; }
  40%   { filter: brightness(1.30); box-shadow: inset 0 0 10px 2px rgba(77, 232, 194, 0.42); }
  58%   { filter: brightness(1); box-shadow: inset 0 0 0 1px transparent; }
  70%   { filter: brightness(1.25); box-shadow: inset 0 0 9px 2px rgba(77, 232, 194, 0.39); }
  100%  { filter: brightness(1); box-shadow: inset 0 0 0 1px transparent; }
}

@keyframes counter-badge-teal-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(77, 232, 194, 0); }
  10%  { box-shadow: 0 0 6px 2px rgba(77, 232, 194, 0.7); }
  28%  { box-shadow: 0 0 0 0 rgba(77, 232, 194, 0); }
  40%  { box-shadow: 0 0 5px 2px rgba(77, 232, 194, 0.6); }
  58%  { box-shadow: 0 0 0 0 rgba(77, 232, 194, 0); }
  70%  { box-shadow: 0 0 4px 1px rgba(77, 232, 194, 0.5); }
  100% { box-shadow: 0 0 0 0 rgba(77, 232, 194, 0); }
}

.card-tile.upkeep-pulsing {
  animation: upkeep-pulse 1.2s ease-out forwards;
}

.card-tile.upkeep-pulsing .counter-badge,
.counter-badge.counter-badge-pulsing {
  animation: counter-badge-teal-pulse 1.2s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
  .card-tile.upkeep-pulsing {
    animation: none;
  }
  .card-tile.upkeep-pulsing .counter-badge,
  .counter-badge.counter-badge-pulsing {
    animation: none;
  }
}

/* ============================================================
   Departure tokens — F-064
   Pill tokens that fly leftward after the cascade taps cards.
   Positioned and animated entirely by GSAP (position: fixed,
   left: 0, top: 0 as base; transforms applied via GSAP x/y).
   ============================================================ */
.departure-token {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  pointer-events: none;
  user-select: none;
  background: #2c2200;
  border: 1px solid #6b5500;
  color: #e8c840;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.04em;
}

/* Preview departure token — shop preview task emit, larger readable variant */
.preview-departure-token {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  pointer-events: none;
  user-select: none;
  background: #2c2200;
  border: 1px solid #6b5500;
  color: #e8c840;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  max-width: 280px;
  white-space: normal;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5), 0 0 8px rgba(232, 200, 64, 0.15);
}

/* Counter drain particle — flung from badge with gravity */
.counter-particle {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  pointer-events: none;
  user-select: none;
  color: #4de8c2;
  font-size: 0.9rem;
  text-shadow: 0 0 6px rgba(77, 232, 194, 0.6);
  line-height: 1;
}

/* ============================================================
   Fortress Atmospheric States (F-063)
   ============================================================ */

/* Ollama Offline — Every Light Is Off */
body:has([data-fortress-status="ollama-offline"]) {
  background: #040404;
  transition: background 3s ease;
}

[data-fortress-status="ollama-offline"] {
  background: #040404;
  transition: background 3s ease;
}

/* Nav dims to almost nothing */
body:has([data-fortress-status="ollama-offline"]) .app-nav {
  filter: saturate(0) brightness(0.18);
  transition: filter 3s ease;
}

/* Card zones: near-invisible shapes in the dark */
[data-fortress-status="ollama-offline"] .zone-section,
[data-fortress-status="ollama-offline"] .quick-capture,
[data-fortress-status="ollama-offline"] .card-counts {
  filter: saturate(0) brightness(0.1);
  transition: filter 3s ease;
}

/* Turn panel dims but stays readable — the one thing you can find in the dark */
[data-fortress-status="ollama-offline"] .upkeep-digest {
  border-color: #181818;
  transition: border-color 3s ease;
}

/* Desaturate turn panel children individually — not the whole panel,
   so the offline amber text and red orb keep their color */
[data-fortress-status="ollama-offline"] .turn-panel-status,
[data-fortress-status="ollama-offline"] .turn-phase-strip,
[data-fortress-status="ollama-offline"] .turn-panel-replays,
[data-fortress-status="ollama-offline"] .turn-details {
  filter: saturate(0) brightness(0.6);
  transition: filter 3s ease;
}

/* The Kitchen cell: desaturate everything except the ollama value text */
[data-fortress-status="ollama-offline"] .upkeep-cell .upkeep-label {
  filter: saturate(0) brightness(0.6);
  transition: filter 3s ease;
}

/* Amber warning text stays vivid */
[data-fortress-status="ollama-offline"] .upkeep-ollama-offline .upkeep-value {
  color: #d4860a;
}

[data-fortress-status="ollama-offline"] .fortress-status-msg--offline {
  color: #d4860a;
}

/* The one last LED — overlay orb positioned by JS to escape parent filter */
.ollama-orb-overlay {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f87171;
  box-shadow: 0 0 8px #f87171, 0 0 20px rgba(248, 113, 113, 0.5);
  z-index: 10000;
  pointer-events: none;
}

[data-fortress-status="ollama-offline"] .card-tile:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* Suppress live upkeep pulse when offline, but allow replay pulse */
[data-fortress-status="ollama-offline"] .card-tile.upkeep-pulsing:not(.replay-pulsing) {
  animation: none !important;
}

/* Turn controls non-interactive while offline — panel is already visually dimmed */
[data-fortress-status="ollama-offline"] .turn-phase-strip .btn,
[data-fortress-status="ollama-offline"] .turn-panel-replays .btn {
  pointer-events: none;
}

/* Stasis — Vapor × Fortress. Neon pink/purple bleeding through fortress grey. */

/* Turn engine fully stopped — phase strip, replays, tap, bounce, game clock all inert */
[data-fortress-status="stasis"] .turn-phase-strip .btn,
[data-fortress-status="stasis"] .turn-panel-replays .btn,
[data-fortress-status="stasis"] .btn-tap-now,
[data-fortress-status="stasis"] .btn-to-hand {
  pointer-events: none;
  opacity: 0.22;
}

/* Game clock and stacks dimmed — irrelevant while frozen */
[data-fortress-status="stasis"] .settings-section--game-clock .settings-hint,
[data-fortress-status="stasis"] .settings-section--game-clock .settings-panel,
[data-fortress-status="stasis"] .settings-section--stacks {
  opacity: 0.45;
  pointer-events: none;
}

/* Cards: dim the warm tones, let neon edges bleed through */
[data-fortress-status="stasis"] .card-tile {
  opacity: 0.65;
  border-color: rgba(180, 80, 200, 0.35);
  box-shadow: 0 0 12px rgba(200, 60, 180, 0.1), 0 0 4px rgba(100, 200, 255, 0.08);
}

/* Neon glow on headers and text accents */
[data-fortress-status="stasis"] h1,
[data-fortress-status="stasis"] h2 {
  color: #c8a0e8;
}

[data-fortress-status="stasis"] .btn-secondary {
  border-color: rgba(200, 100, 220, 0.4);
  color: #d4a0f0;
}

/* Static gradient: pink-purple neon wash over fortress grey */
[data-fortress-status="stasis"]::after {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(180, 40, 160, 0.08) 0%,
    rgba(100, 40, 180, 0.06) 40%,
    rgba(60, 180, 220, 0.05) 70%,
    rgba(200, 60, 180, 0.07) 100%
  );
  pointer-events: none;
  z-index: 100;
}

/* Stasis buttons — neon vapor pop */
.btn-stasis-thaw {
  background: linear-gradient(135deg, rgba(60, 200, 220, 0.2), rgba(100, 220, 180, 0.15));
  color: #6eecd0;
  border: 1px solid rgba(100, 230, 200, 0.4);
  padding: 0.6rem 1.5rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-shadow: 0 0 8px rgba(100, 230, 200, 0.3);
  box-shadow: 0 0 16px rgba(60, 200, 220, 0.15), 0 0 4px rgba(100, 230, 200, 0.1);
}

.btn-stasis-thaw:hover {
  background: linear-gradient(135deg, rgba(60, 200, 220, 0.35), rgba(100, 220, 180, 0.25));
  box-shadow: 0 0 24px rgba(60, 200, 220, 0.25), 0 0 8px rgba(100, 230, 200, 0.2);
}

.btn-stasis-freeze {
  background: linear-gradient(135deg, rgba(180, 40, 160, 0.15), rgba(120, 60, 200, 0.12));
  color: #d4a0f0;
  border: 1px solid rgba(200, 100, 220, 0.4);
  padding: 0.5rem 1.2rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-shadow: 0 0 6px rgba(200, 100, 220, 0.25);
  box-shadow: 0 0 10px rgba(180, 60, 200, 0.1);
}

.btn-stasis-freeze:hover {
  color: #e0b8f8;
  background: linear-gradient(135deg, rgba(180, 40, 160, 0.25), rgba(120, 60, 200, 0.2));
  border-color: rgba(200, 100, 220, 0.6);
  box-shadow: 0 0 18px rgba(200, 60, 180, 0.2), 0 0 6px rgba(150, 80, 220, 0.15);
}

/* Stasis confirm dialog */
.stasis-dialog {
  background: #1e1e24;
  border: 1px solid rgba(200, 100, 220, 0.3);
  border-radius: 12px;
  padding: 0;
  max-width: 360px;
  width: 90vw;
  box-shadow: 0 0 40px rgba(150, 50, 200, 0.15), 0 8px 32px rgba(0, 0, 0, 0.6);
  color: var(--text);
}

.stasis-dialog::backdrop {
  background: rgba(10, 8, 16, 0.75);
}

.stasis-dialog-body {
  padding: 1.5rem;
  text-align: center;
}

.stasis-dialog-message {
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
  color: #d4a0f0;
}

.stasis-dialog-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.stasis-dialog-actions .btn {
  min-width: 100px;
}

/* Fortress status messages in turn panel */
.fortress-status-msg {
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  font-style: italic;
  width: 100%;
}

.fortress-status-msg--offline {
  color: #d4860a;
  background: transparent;
}

.fortress-status-msg--stasis {
  color: #d4a0f0;
  background: rgba(180, 60, 200, 0.1);
  border: 1px solid rgba(200, 100, 220, 0.2);
}
}

/* ============================================================
   Card Drag Interaction — spec 0048
   GSAP Draggable + Flip drag classes.
   ============================================================ */

.card-dragging {
  z-index: 1000;
  cursor: grabbing;
  position: relative;
}

.card-drag-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: rgba(255, 255, 255, 0.03);
  border: 2px dashed rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  pointer-events: none;
}

@media (max-width: 599px) {
  .card-drag-placeholder {
    aspect-ratio: auto;
    height: 3rem;
  }
}

.drag-target-active {
  filter: brightness(1.08);
  border-color: rgba(180, 120, 40, 0.45) !important;
  transition: filter 0.1s ease, border-color 0.1s ease;
}

.drag-error-flash {
  outline: 2px solid rgba(220, 80, 60, 0.7);
  outline-offset: 2px;
  border-radius: 6px;
}

.drag-insertion-gap {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 2px dashed rgba(180, 120, 40, 0.5);
  background: rgba(180, 120, 40, 0.08);
  border-radius: 10px;
  pointer-events: none;
  z-index: 10;
}

@media (max-width: 599px) {
  .drag-insertion-gap {
    aspect-ratio: auto;
    height: 3rem;
  }
}

.drag-confirm-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  background: #1e1e24;
  border: 1px solid rgba(200, 100, 220, 0.35);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  max-width: 320px;
  width: 88vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 24px rgba(150, 50, 200, 0.1);
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
}

.drag-confirm-modal p {
  margin: 0 0 1rem;
  color: #c8b49a;
}

.drag-confirm-modal strong {
  color: #e8c87c;
}

.drag-confirm-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.drag-confirm-btn {
  padding: 0.45rem 1.1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid;
}

.drag-confirm-return {
  background: rgba(220, 80, 60, 0.15);
  color: #f08070;
  border-color: rgba(220, 80, 60, 0.4);
}

.drag-confirm-return:hover {
  background: rgba(220, 80, 60, 0.25);
  border-color: rgba(220, 80, 60, 0.65);
}

.drag-confirm-cancel {
  background: rgba(100, 100, 120, 0.15);
  color: #a0a0b8;
  border-color: rgba(100, 100, 140, 0.35);
}

.drag-confirm-cancel:hover {
  background: rgba(100, 100, 120, 0.25);
}

/* Sign-in page */
.sign-in-container {
  max-width: 380px;
  margin: 3rem auto;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.sign-in-title {
  text-align: center;
  font-size: 1.5rem;
  margin: 0 0 1.5rem;
  color: var(--text);
}

.sign-in-sso {
  margin-bottom: 1rem;
}

.sign-in-sso-btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
}

.sign-in-divider {
  text-align: center;
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  position: relative;
}

.sign-in-divider span {
  background: var(--surface);
  padding: 0 0.75rem;
  position: relative;
  z-index: 1;
}

.sign-in-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid var(--border);
}

.sign-in-form label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.sign-in-field {
  margin-bottom: 1rem;
}

.sign-in-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.95rem;
  box-sizing: border-box;
}

.sign-in-input:focus {
  outline: none;
  border-color: var(--accent);
}

.sign-in-remember {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.sign-in-submit {
  width: 100%;
  padding: 0.6rem;
  font-size: 0.95rem;
}

/* ============================================================
   Morning Reveal — F-087
   New tasks fade/slide in on first dashboard load after tick.
   ============================================================ */

.task-item[data-reveal] {
  opacity: 0;
  transform: translateY(28px) scale(0.97);
  filter: blur(2px);
}

.task-item[data-reveal].reveal-active {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
  transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.35s ease;
  transition-delay: var(--reveal-delay, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  .task-item[data-reveal] {
    opacity: 1;
    transform: none;
    filter: none;
  }
}
