:root {
  --parchment-1: #f3e3b5;
  --parchment-2: #e3cb88;
  --parchment-3: #b8975a;
  --ink: #2a1a08;
  --ink-soft: #4a3418;
  --ink-mute: #7a6238;
  --stone-1: #4a423a;
  --stone-2: #2c2620;
  --stone-3: #1a1612;
  --gold-1: #f4d27a;
  --gold-2: #c89a2e;
  --gold-3: #8a6510;
  --bronze-1: #d68a4e;
  --bronze-2: #7a3e16;
  --rune: #6f5fe6;
  --blood: #8a1d1d;
  --moss: #4a6b2a;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: 'MedievalSharp', 'IM Fell English', Georgia, serif;
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(ellipse 90% 70% at 50% 30%, #3a2e1e 0%, #1a1410 60%, #0c0906 100%);
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  font-family: 'MedievalSharp', 'IM Fell English', Georgia, serif;
}

/* TITLEBAR */
.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: linear-gradient(180deg, #6b5a44 0%, #3b3024 50%, #20180f 100%);
  border-bottom: 2px solid #000;
  box-shadow:
    inset 0 1px 0 rgba(255,210,140,.25),
    inset 0 -1px 0 rgba(0,0,0,.6);
  height: 46px;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: #f3d98a;
  text-shadow: 0 1px 0 #000;
  font-weight: 700;
  letter-spacing: .04em;
  font-size: 15px;
  text-decoration: none;
}
.brand:hover { color: #ffe7a8; }
.brand-tag { opacity: .5; font-weight: 400; font-size: 12px; letter-spacing: .06em; }
.brand-emblem {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 30% 30%, #f4d27a, #8a6510 80%);
  border: 1px solid #2a1a08;
  border-radius: 4px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.4),
    inset 0 -2px 4px rgba(0,0,0,.4);
  color: #2a1a08;
  font-weight: 800;
  font-size: 14px;
}
.userbar { display: flex; align-items: center; gap: 14px; font-family: 'MedievalSharp', 'IM Fell English', serif; }
.music-bar { display: inline-flex; align-items: center; gap: 8px; }
.user {
  display: flex; align-items: center; gap: 10px;
  color: #e8d29a;
  font-size: 14px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #c89a6e, #6e4e2a);
  border: 2px solid var(--gold-2);
  box-shadow: 0 0 0 1px #1a1208, inset 0 -2px 6px rgba(0,0,0,.4);
  object-fit: cover;
  display: block;
}
.user-avatar-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}
.user-avatar-wrap.is-admin .user-avatar {
  border-color: var(--gold-1);
  box-shadow: 0 0 0 1px #1a1208, 0 0 6px rgba(244,210,122,.45), inset 0 -2px 6px rgba(0,0,0,.4);
}
.user-avatar-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 14px; height: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold-1), var(--gold-3));
  border: 1px solid #1a1208;
  color: #1a1208;
  font-size: 9px;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255,255,255,.25);
  pointer-events: none;
}
.user-name { font-weight: 600; line-height: 1; }
.user-id { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: #7a6638; opacity: .65; letter-spacing: .02em; line-height: 1.4; }
.pill {
  padding: 4px 10px;
  background: linear-gradient(180deg, #3a2c8a, #5b4ae0);
  color: #ffe7a8;
  border: 1px solid #1a1240;
  border-radius: 3px;
  font-size: 11px;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 #000;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2);
}
.logout {
  color: #d68a8a;
  background: transparent;
  border: 1px solid #6e2020;
  padding: 4px 10px;
  border-radius: 3px;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}
.logout:hover { background: rgba(110,32,32,.4); color: #ffaaaa; }

/* MAIN STAGE */
.stage {
  flex: 1;
  padding: 24px 32px 40px;
  position: relative;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(255,210,140,.04) 0%, transparent 70%);
}

/* FLASH — parchment proclamation */
.flash {
  position: relative;
  max-width: 1180px;
  margin: 0 auto 16px;
  padding: 12px 18px 12px 44px;
  font-family: 'MedievalSharp', 'IM Fell English', serif;
  font-style: italic;
  font-size: 15px;
  background:
    radial-gradient(ellipse at 0% 50%, rgba(120,80,30,.18), transparent 65%),
    linear-gradient(180deg, #f3e3b5 0%, #e3cb88 100%);
  border: 1.5px solid var(--bronze-2);
  border-radius: 3px;
  color: var(--ink);
  box-shadow:
    inset 0 0 0 1px rgba(244,210,122,.55),
    inset 0 1px 0 rgba(255,255,255,.45),
    0 2px 6px rgba(0,0,0,.35),
    0 0 0 1px rgba(0,0,0,.25);
  text-shadow: 0 1px 0 rgba(255,255,255,.35);
}
.flash::before {
  content: "\2733";
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  display: grid; place-items: center;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 18px;
  color: var(--bronze-2);
  text-shadow: 0 1px 0 rgba(255,255,255,.5);
  font-style: normal;
}

/* PARCHMENT WORKSPACE */
.scroll {
  background:
    radial-gradient(ellipse at 20% 10%, rgba(120,80,30,.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(120,80,30,.16) 0%, transparent 55%),
    linear-gradient(180deg, #f5e6b8 0%, #e6d098 50%, #d5b97a 100%);
  border: 3px solid #1a1208;
  box-shadow:
    0 0 0 4px var(--bronze-2),
    0 0 0 5px var(--bronze-1),
    0 0 0 8px #4a3418,
    0 0 0 9px #1a1208,
    0 25px 60px -15px rgba(0,0,0,.85);
  border-radius: 2px;
  position: relative;
  margin: 0 auto;
  max-width: 1180px;
}
.scroll::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 22% 14% at 0% 0%, rgba(80,40,10,.18), transparent 70%),
    radial-gradient(ellipse 22% 14% at 100% 0%, rgba(80,40,10,.14), transparent 70%),
    radial-gradient(ellipse 28% 16% at 100% 100%, rgba(80,40,10,.18), transparent 70%),
    radial-gradient(ellipse 22% 14% at 0% 100%, rgba(80,40,10,.16), transparent 70%);
  mix-blend-mode: multiply;
  border-radius: 2px;
}

/* PAGE HEAD */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 36px 18px;
  border-bottom: 2px solid #8a6510;
  position: relative;
  gap: 16px;
}
.page-head::after {
  content: "";
  position: absolute;
  left: 36px; right: 36px;
  bottom: -5px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #8a6510, transparent);
}
.page-title {
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-weight: 800;
  font-size: 32px;
  color: var(--ink);
  margin: 0;
  letter-spacing: .02em;
}
.page-title small {
  display: block;
  font-family: 'MedievalSharp', 'IM Fell English', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 14px;
  color: var(--ink-mute);
  letter-spacing: 0;
  margin-top: 2px;
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-mute);
  font-style: italic;
  margin-bottom: 8px;
}
.crumbs a { color: var(--gold-3); text-decoration: none; border-bottom: 1px dotted var(--gold-3); }
.crumbs a:hover { color: var(--ink); }

/* BUTTONS */
.btn {
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 13px;
  padding: 11px 20px;
  border: 2px solid #1a1208;
  border-radius: 3px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(180deg, #7d6cf5 0%, #5b4ae0 50%, #4536b8 100%);
  text-shadow: 0 1px 0 rgba(0,0,0,.5);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.35),
    inset 0 -3px 6px rgba(0,0,0,.3),
    inset 0 0 0 1px rgba(244,210,122,.55),
    0 4px 0 #1a1208,
    0 6px 10px rgba(0,0,0,.4);
  transition: transform .08s ease, box-shadow .08s ease;
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), inset 0 -2px 4px rgba(0,0,0,.4), 0 1px 0 #1a1208; }
.btn.gold {
  background: linear-gradient(180deg, #f6d986 0%, #c89a2e 50%, #8a6510 100%);
  color: #2a1a08;
  text-shadow: 0 1px 0 rgba(255,255,255,.3);
}
.btn.danger {
  background: linear-gradient(180deg, #c43a3a 0%, #8a1d1d 50%, #4a0a0a 100%);
}
.btn.ghost {
  background: linear-gradient(180deg, rgba(255,240,200,.5), rgba(200,160,90,.2));
  color: var(--ink);
  text-shadow: none;
  border: 2px solid #4a3418;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), inset 0 0 0 1px rgba(244,210,122,.4);
}
.btn.ghost:active { box-shadow: inset 0 1px 4px rgba(0,0,0,.2); }
.btn .ico { font-size: 14px; }

/* CHIPS / BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: linear-gradient(180deg, rgba(255,240,200,.7), rgba(200,160,90,.3));
  color: var(--ink);
}
.badge.private { background: linear-gradient(180deg, #f9d56a, #d8a82a); border-color: var(--bronze-2); }
.badge.public  { background: linear-gradient(180deg, #b3d18a, #6e9648); border-color: #2a4010; color: #1a2a08; }
.badge.shared  { background: linear-gradient(180deg, #b3c9e0, #7898c0); border-color: #1a2a4a; color: #0a1228; }

/* LIST VIEW */
.ledger {
  padding: 24px 36px 30px;
}
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.search {
  position: relative;
  flex: 1; max-width: 380px;
}
.search input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  font-family: 'MedievalSharp', 'IM Fell English', serif;
  font-size: 15px;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255,250,225,.8), rgba(220,190,130,.5));
  border: 2px solid #4a3418;
  border-radius: 3px;
  box-shadow: inset 0 2px 4px rgba(80,40,10,.25), inset 0 0 0 1px rgba(244,210,122,.5);
  outline: none;
}
.search input::placeholder { color: var(--ink-mute); font-style: italic; }
.search input:focus { border-color: var(--bronze-2); box-shadow: inset 0 2px 4px rgba(80,40,10,.25), inset 0 0 0 1px var(--gold-1), 0 0 0 3px rgba(244,210,122,.25); }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-mute); font-size: 16px; }

.filters { display: flex; gap: 6px; }
.seg {
  display: flex;
  border: 2px solid #4a3418;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(74,52,24,.1);
}
.seg button {
  border: none;
  background: transparent;
  padding: 8px 14px;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: pointer;
  border-right: 1px solid #4a3418;
}
.seg button:last-child { border-right: none; }
.seg button.active {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), inset 0 -2px 4px rgba(0,0,0,.2);
}
.seg-opt {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: pointer;
  border-right: 1px solid #4a3418;
  background: transparent;
}
.seg-opt:last-child { border-right: none; }
.seg-opt input { display: none; }
.seg-opt.active {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), inset 0 -2px 4px rgba(0,0,0,.2);
}
[data-image-trigger-mode] .seg { width: max-content; margin-bottom: 6px; }

/* LEDGER TABLE */
.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'MedievalSharp', 'IM Fell English', serif;
  font-size: 15px;
  color: var(--ink);
}
.ledger-table thead th {
  text-align: left;
  padding: 10px 12px;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 2px solid #8a6510;
  background: linear-gradient(180deg, rgba(244,210,122,.35), transparent);
}
.ledger-table tbody td {
  padding: 14px 12px;
  border-bottom: 1px dashed rgba(74,52,24,.35);
  vertical-align: middle;
}
.ledger-table tbody tr:hover { background: rgba(255,240,200,.35); }
.ledger-table tbody tr.row-disabled td { opacity: .55; }
.name-cell { display: flex; align-items: center; gap: 12px; }
.name-sigil {
  width: 38px; height: 38px;
  border-radius: 4px;
  border: 2px solid #1a1208;
  box-shadow: inset 0 0 0 1px var(--gold-1), 0 2px 4px rgba(0,0,0,.3);
  display: grid; place-items: center;
  color: #ffe7a8;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-weight: 800;
  font-size: 16px;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
  flex-shrink: 0;
}
.name-text { display: flex; flex-direction: column; gap: 2px; }
.name-primary { font-weight: 600; color: var(--ink); font-size: 16px; line-height: 1.1; }
.name-mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--ink-mute); }
.triggers-cell { display: flex; flex-wrap: wrap; gap: 4px; }
.trig {
  padding: 2px 8px;
  background: rgba(74,52,24,.12);
  border: 1px solid rgba(74,52,24,.35);
  border-radius: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
}
.check-icon { color: var(--moss); font-size: 18px; font-weight: 700; }
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px; height: 22px;
  background: linear-gradient(180deg, #6e5a40, #2a2018);
  border: 2px solid #1a1208;
  border-radius: 12px;
  cursor: default;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.5);
  transition: background .2s;
  vertical-align: middle;
}
.toggle-switch.on { background: linear-gradient(180deg, #6e9648, #4a6b2a); }
.toggle-switch::after {
  content: "";
  position: absolute;
  top: 1px; left: 1px;
  width: 16px; height: 16px;
  background: radial-gradient(circle at 30% 30%, #f4d27a, #8a6510);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.5);
  transition: left .2s;
}
.toggle-switch.on::after { left: 23px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1.5px solid #4a3418;
  background: linear-gradient(180deg, rgba(255,240,200,.6), rgba(200,160,90,.25));
  border-radius: 3px;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
  text-decoration: none;
  font-family: 'MedievalSharp', 'IM Fell English', serif;
}
.icon-btn:hover { border-color: var(--bronze-2); color: var(--ink); }
.icon-btn.danger:hover { border-color: var(--blood); color: var(--blood); }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-mute);
  font-style: italic;
}
.empty h3 { font-family: 'MedievalSharp', 'Cinzel', serif; font-style: normal; font-size: 20px; color: var(--ink-soft); margin: 12px 0 8px; }

/* FORM VIEW */
.form-wrap {
  padding: 24px 36px 10px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
}
@media (max-width: 1024px) {
  .form-wrap { grid-template-columns: 1fr; }
  .form-aside { display: none; }
}
.form-main { min-width: 0; }
.form-aside { align-self: start; position: sticky; top: 70px; }

.field { margin-bottom: 18px; }
.field-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--ink);
  text-transform: uppercase;
}
.field-label .req { color: var(--blood); font-weight: 800; }
.field-help {
  font-family: 'MedievalSharp', 'IM Fell English', serif;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-mute);
  margin-top: 6px;
  line-height: 1.4;
}
.field-error {
  display: block;
  margin-top: 6px;
  color: var(--blood);
  font-size: 13px;
  font-family: 'MedievalSharp', 'IM Fell English', serif;
  font-weight: 600;
}

.input, .textarea, .select {
  width: 100%;
  padding: 11px 13px;
  font-family: 'MedievalSharp', 'IM Fell English', serif;
  font-size: 15px;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255,250,225,.85), rgba(230,206,150,.5));
  border: 2px solid #4a3418;
  border-radius: 3px;
  box-shadow:
    inset 0 2px 4px rgba(80,40,10,.22),
    inset 0 0 0 1px rgba(244,210,122,.45);
  outline: none;
  line-height: 1.4;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--bronze-2);
  box-shadow: inset 0 2px 4px rgba(80,40,10,.22), inset 0 0 0 1px var(--gold-1), 0 0 0 3px rgba(244,210,122,.25);
}
.input.mono, .textarea.mono { font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.input::placeholder, .textarea::placeholder { color: var(--ink-mute); font-style: italic; }
.input[readonly], .input:disabled { background: rgba(200,170,110,.2); color: var(--ink-mute); cursor: not-allowed; }
.textarea { resize: vertical; min-height: 90px; }
.select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
/* Themed range slider — bronze rivets + gold-coin thumb on stone groove */
.theme-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  outline: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  border: none;
  display: block;
}
/* Track */
.theme-slider::-webkit-slider-runnable-track {
  height: 14px;
  background:
    linear-gradient(180deg, #2a2018 0%, #4a3418 50%, #2a2018 100%);
  border: 2px solid #1a1208;
  border-radius: 8px;
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,.7),
    inset 0 0 0 1px rgba(244,210,122,.18),
    0 1px 0 rgba(255,240,200,.25);
}
.theme-slider::-moz-range-track {
  height: 14px;
  background:
    linear-gradient(180deg, #2a2018 0%, #4a3418 50%, #2a2018 100%);
  border: 2px solid #1a1208;
  border-radius: 8px;
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,.7),
    inset 0 0 0 1px rgba(244,210,122,.18);
}
/* Filled portion (Firefox only — Webkit has no progress; we fake it with a wrapper). */
.theme-slider::-moz-range-progress {
  height: 14px;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2) 60%, var(--gold-3));
  border-radius: 6px 0 0 6px;
  box-shadow: 0 0 8px rgba(244,210,122,.45);
}
/* Thumb — gold coin */
.theme-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px; height: 24px;
  margin-top: -7px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #fff3c8 0%, var(--gold-1) 25%, var(--gold-2) 60%, var(--gold-3) 100%);
  border: 2px solid #1a1208;
  box-shadow:
    inset 0 -2px 3px rgba(80,40,10,.55),
    inset 0 1px 1px rgba(255,255,255,.6),
    0 2px 4px rgba(0,0,0,.6),
    0 0 0 1px rgba(244,210,122,.3);
  cursor: grab;
}
.theme-slider::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.05); }
.theme-slider::-moz-range-thumb {
  width: 24px; height: 24px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #fff3c8 0%, var(--gold-1) 25%, var(--gold-2) 60%, var(--gold-3) 100%);
  border: 2px solid #1a1208;
  box-shadow:
    inset 0 -2px 3px rgba(80,40,10,.55),
    inset 0 1px 1px rgba(255,255,255,.6),
    0 2px 4px rgba(0,0,0,.6);
  cursor: grab;
}
.theme-slider:focus { outline: none; }
.theme-slider:focus::-webkit-slider-thumb { box-shadow: inset 0 -2px 3px rgba(80,40,10,.55), inset 0 1px 1px rgba(255,255,255,.6), 0 2px 4px rgba(0,0,0,.6), 0 0 0 3px rgba(244,210,122,.4); }

/* Wrapper provides the gold-fill effect for Webkit (positioned overlay behind thumb). */
.theme-slider-wrap {
  position: relative;
  flex: 1;
  height: 22px;
  display: flex;
  align-items: center;
}
.theme-slider-fill {
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  height: 14px;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2) 60%, var(--gold-3));
  border-radius: 6px 0 0 6px;
  border: 2px solid #1a1208;
  border-right: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 0 8px rgba(244,210,122,.4);
  pointer-events: none;
  z-index: 1;
  max-width: calc(100% - 12px);
}
.theme-slider-wrap .theme-slider {
  position: relative;
  z-index: 2;
}

.slider-row { display: flex; align-items: center; gap: 14px; }
.slider-row .input { width: 80px; }
.slider-row .slider-num {
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-weight: 700;
  color: var(--ink);
  min-width: 56px;
  text-align: right;
  padding: 4px 8px;
  background: linear-gradient(180deg, rgba(40,28,16,.85), rgba(20,14,8,.9));
  border: 1px solid #1a1208;
  border-radius: 3px;
  color: var(--gold-1);
  text-shadow: 0 1px 0 #000;
  box-shadow: inset 0 0 0 1px rgba(244,210,122,.4);
  font-size: 13px;
}
.slider-row .slider-wrap { flex: 1; }

/* Visibility radio cards */
.radio-stack { display: grid; gap: 10px; }
.radio-card {
  display: flex; gap: 12px;
  padding: 14px 16px;
  border: 2px solid #4a3418;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(255,245,210,.5), rgba(220,190,130,.25));
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  align-items: flex-start;
}
.radio-card:hover { border-color: var(--bronze-2); }
.radio-card.selected {
  border-color: var(--bronze-2);
  box-shadow:
    inset 0 0 0 1px var(--gold-1),
    0 0 0 3px rgba(244,210,122,.3);
  background: linear-gradient(180deg, rgba(255,240,180,.65), rgba(244,210,122,.3));
}
.radio-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.radio-dot {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--ink-soft);
  background: rgba(255,250,225,.7);
  margin-top: 1px;
  position: relative;
}
.radio-card.selected .radio-dot { border-color: var(--bronze-2); background: var(--gold-1); }
.radio-card.selected .radio-dot::after {
  content: ""; position: absolute; inset: 3px;
  background: var(--bronze-2);
  border-radius: 50%;
}
.radio-title { font-family: 'MedievalSharp', 'Cinzel', serif; font-weight: 700; font-size: 14px; color: var(--ink); margin: 0 0 3px; letter-spacing: .04em; }
.radio-desc { font-family: 'MedievalSharp', 'IM Fell English', serif; font-style: italic; font-size: 13px; color: var(--ink-soft); margin: 0; line-height: 1.4; }

/* checkbox card */
.check-card {
  display: flex; gap: 12px;
  padding: 12px 16px;
  border: 2px solid #4a3418;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(255,245,210,.45), rgba(220,190,130,.2));
  cursor: pointer;
  align-items: flex-start;
}
.check-card input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.check-box {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border-radius: 2px;
  border: 2px solid var(--ink-soft);
  background: rgba(255,250,225,.7);
  margin-top: 1px;
  display: grid; place-items: center;
  color: transparent;
  font-weight: 800;
  font-size: 13px;
}
.check-card.checked .check-box { background: var(--gold-1); border-color: var(--bronze-2); color: var(--bronze-2); }
.check-card.checked .check-box::before { content: "\2713"; }

/* Section headers in form */
.section {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 2px solid #8a6510;
  position: relative;
}
.section::before {
  content: "";
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-1), transparent);
}
.section-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.section-num {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 30% 30%, var(--gold-1), var(--gold-3));
  border: 2px solid #1a1208;
  border-radius: 50%;
  color: var(--ink);
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-weight: 800;
  font-size: 13px;
  box-shadow: inset 0 -1px 2px rgba(0,0,0,.3);
  flex-shrink: 0;
}
.section-title {
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  margin: 0;
  letter-spacing: .04em;
}
.section-sub {
  font-family: 'MedievalSharp', 'IM Fell English', serif;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-mute);
  margin: 2px 0 0;
}

/* Sticky aside */
.aside-card {
  background: linear-gradient(180deg, rgba(40,28,16,.92), rgba(20,14,8,.92));
  border: 2px solid #1a1208;
  box-shadow:
    inset 0 0 0 1px rgba(244,210,122,.5),
    0 8px 20px rgba(0,0,0,.5);
  border-radius: 3px;
  padding: 18px 18px 16px;
  color: #e8d29a;
  font-family: 'MedievalSharp', 'IM Fell English', serif;
}
.aside-card h4 {
  margin: 0 0 12px;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold-1);
  font-weight: 700;
}
.aside-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(244,210,122,.18);
  font-size: 13px;
}
.aside-row:last-child { border-bottom: none; }
.aside-row .k { color: #c9b380; font-style: italic; }
.aside-row .v { color: #e8d29a; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.aside-row .v.warn { color: #e6a25a; }
.aside-row .v.ok { color: #9fc77a; }
.aside-help {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(244,210,122,.18);
  font-size: 12px;
  font-style: italic;
  color: #a89060;
  line-height: 1.5;
}

.form-actions {
  margin: 0 36px;
  padding: 22px 0 30px;
  border-top: 2px solid #8a6510;
  display: flex; gap: 12px; align-items: center;
}
.form-actions .spacer { flex: 1; }
.form-actions-note { font-family: 'MedievalSharp', 'IM Fell English', serif; font-style: italic; color: var(--ink-mute); }

/* Trigger chips input */
.trig-input-wrap {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(255,250,225,.85), rgba(230,206,150,.5));
  border: 2px solid #4a3418;
  border-radius: 3px;
  min-height: 56px;
  box-shadow: inset 0 2px 4px rgba(80,40,10,.22), inset 0 0 0 1px rgba(244,210,122,.45);
  cursor: text;
}
.trig-input-wrap.focused {
  border-color: var(--bronze-2);
  box-shadow: inset 0 2px 4px rgba(80,40,10,.22), inset 0 0 0 1px var(--gold-1), 0 0 0 3px rgba(244,210,122,.25);
}
.trig-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 4px 4px 10px;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  border: 1px solid var(--bronze-2);
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink);
  font-weight: 600;
}
.trig-chip .x {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  background: rgba(80,40,10,.2);
  border-radius: 2px;
  cursor: pointer;
  color: var(--bronze-2);
  font-size: 12px;
  border: none;
  font-family: inherit;
}
.trig-chip .x:hover { background: var(--blood); color: #fff; }
.trig-input-wrap input {
  flex: 1; min-width: 100px;
  border: none; outline: none; background: transparent;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--ink);
  padding: 4px;
}
.trig-input-wrap input::placeholder { color: var(--ink-mute); font-style: italic; }

/* Sigil color variants */
.sigil-rune   { background: radial-gradient(circle at 35% 30%, #6f5fe6, #1a1240); }
.sigil-blood  { background: radial-gradient(circle at 35% 30%, #c43a3a, #4a0a0a); }
.sigil-moss   { background: radial-gradient(circle at 35% 30%, #6e9648, #2a4010); }
.sigil-water  { background: radial-gradient(circle at 35% 30%, #6098c8, #1a4068); }
.sigil-amber  { background: radial-gradient(circle at 35% 30%, #f4d27a, #8a6510); color: #2a1a08 !important; text-shadow: 0 1px 0 rgba(255,255,255,.3) !important; }
.sigil-shadow { background: radial-gradient(circle at 35% 30%, #4a3a4e, #14101a); }

.sigil-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.sigil-swatch {
  width: 44px; height: 44px;
  border-radius: 4px;
  border: 2px solid #4a3418;
  box-shadow: inset 0 0 0 1px var(--gold-1);
  cursor: pointer;
  display: grid; place-items: center;
  color: #fff;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(0,0,0,.5);
  padding: 0;
}
.sigil-swatch.selected {
  border-color: var(--bronze-2);
  box-shadow: 0 0 0 3px rgba(244,210,122,.4), inset 0 0 0 1px var(--gold-1);
}

/* Stats strip */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 14px 16px;
  margin: 20px 36px 4px;
  background: linear-gradient(180deg, rgba(40,28,16,.85), rgba(20,14,8,.85));
  border: 2px solid #1a1208;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(244,210,122,.4);
}
.stat-cell {
  display: flex; align-items: center; gap: 12px;
  padding: 0 12px;
  border-right: 1px dashed rgba(244,210,122,.18);
  color: #e8d29a;
}
.stat-cell:last-child { border-right: none; }
.stat-num {
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-weight: 800;
  font-size: 26px;
  line-height: 1;
  color: var(--gold-1);
  text-shadow: 0 1px 0 #000;
}
.stat-lab {
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #c9b380;
  line-height: 1.3;
}
.stat-sub {
  font-family: 'MedievalSharp', 'IM Fell English', serif;
  font-style: italic;
  font-size: 11px;
  color: #a89060;
}

/* Tabs */
.form-tabs {
  display: flex;
  border-bottom: 2px solid #8a6510;
  gap: 4px;
  margin: 18px 36px 0;
  flex-wrap: wrap;
}
.form-tab {
  padding: 10px 16px;
  border: 2px solid transparent;
  border-bottom: none;
  background: transparent;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  cursor: pointer;
  border-radius: 3px 3px 0 0;
  margin-bottom: -2px;
}
.form-tab.active {
  background: linear-gradient(180deg, rgba(255,245,210,.85), rgba(230,206,150,.5));
  border-color: #8a6510;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(244,210,122,.5);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Login panel */
.login-shell {
  display: grid;
  place-items: center;
  padding: 60px 20px;
  min-height: calc(100vh - 46px);
}
.login-card {
  width: 420px;
  max-width: 100%;
  padding: 36px 36px 28px;
  text-align: center;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(120,80,30,.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(120,80,30,.16) 0%, transparent 55%),
    linear-gradient(180deg, #f5e6b8 0%, #e6d098 50%, #d5b97a 100%);
  border: 3px solid #1a1208;
  box-shadow:
    0 0 0 4px var(--bronze-2),
    0 0 0 5px var(--bronze-1),
    0 0 0 8px #4a3418,
    0 0 0 9px #1a1208,
    0 25px 60px -15px rgba(0,0,0,.85);
  border-radius: 2px;
}
.login-card h1 {
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-weight: 800;
  font-size: 28px;
  margin: 0 0 6px;
  color: var(--ink);
  letter-spacing: .04em;
}
.login-card .sub {
  font-family: 'MedievalSharp', 'IM Fell English', serif;
  font-style: italic;
  font-size: 14px;
  color: var(--ink-mute);
  margin: 0 0 28px;
}
.login-card form { display: grid; place-items: center; }
.owner-id-hint {
  display: inline-flex;
  gap: 4px;
  align-items: baseline;
  margin-left: 8px;
  font-size: 11px;
  color: var(--ink-mute);
  opacity: .7;
}
.owner-id-hint:empty { display: none; }
.owner-id-hint .k {
  font-style: italic;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.owner-id-hint .mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.login-error {
  margin: 0 0 18px;
  padding: 10px 14px;
  border: 1px solid rgba(170, 50, 40, .55);
  background: rgba(170, 50, 40, .12);
  color: #b03028;
  font-family: 'MedievalSharp', 'IM Fell English', serif;
  font-size: 13px;
  border-radius: 4px;
}
.login-foot {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed rgba(74,52,24,.4);
  font-family: 'MedievalSharp', 'IM Fell English', serif;
  font-style: italic;
  font-size: 12px;
  color: var(--ink-mute);
}

/* Info box — context callout under prompt fields. Aged parchment + bronze frame. */
.info-box {
  position: relative;
  display: block;
  margin: 0 0 10px;
  padding: 10px 14px 10px 36px;
  background:
    radial-gradient(ellipse at 0% 50%, rgba(120,80,30,.14), transparent 60%),
    linear-gradient(180deg, rgba(255,245,210,.7), rgba(220,190,130,.45));
  border: 1.5px solid var(--bronze-2);
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 1px rgba(244,210,122,.55),
    inset 0 1px 0 rgba(255,255,255,.4),
    0 1px 2px rgba(80,40,10,.18);
  font-family: 'MedievalSharp', 'IM Fell English', serif;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.45;
}
.info-box::before {
  content: "\269C";
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  display: grid; place-items: center;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 14px;
  color: var(--bronze-2);
  text-shadow: 0 1px 0 rgba(255,255,255,.4);
  font-style: normal;
}
.info-box strong {
  font-style: normal;
  font-weight: 700;
  color: var(--ink);
  font-family: 'MedievalSharp', 'Cinzel', serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 11px;
  margin-right: 6px;
}

/* Music toggle in titlebar */
.music-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: linear-gradient(180deg, rgba(244,210,122,.18), rgba(138,101,16,.12));
  border: 1px solid var(--gold-3);
  border-radius: 3px;
  cursor: pointer;
  color: #f3d98a;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 #000;
}
.music-toggle:hover { background: linear-gradient(180deg, rgba(244,210,122,.32), rgba(138,101,16,.2)); }
.music-toggle .ico { font-size: 13px; }
.music-toggle.muted { color: #a89060; border-color: #6a4a14; }
.music-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: linear-gradient(180deg, rgba(244,210,122,.18), rgba(138,101,16,.12));
  border: 1px solid var(--gold-3);
  border-radius: 3px;
  cursor: pointer;
  color: #f3d98a;
  font-size: 9px;
  text-shadow: 0 1px 0 #000;
}
.music-step:hover { background: linear-gradient(180deg, rgba(244,210,122,.32), rgba(138,101,16,.2)); }
.music-track {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f3d98a;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: .04em;
  text-shadow: 0 1px 0 #000;
}
.music-volume {
  width: 70px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(90deg, var(--gold-2), var(--gold-3));
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.music-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  background: radial-gradient(circle at 30% 30%, var(--gold-1), var(--gold-3));
  border-radius: 50%;
  border: 1px solid #1a1208;
  cursor: pointer;
}
.music-volume::-moz-range-thumb {
  width: 12px; height: 12px;
  background: radial-gradient(circle at 30% 30%, var(--gold-1), var(--gold-3));
  border-radius: 50%;
  border: 1px solid #1a1208;
  cursor: pointer;
}

/* Voice preview (Hear Their Voice) */
.voice-preview {
  margin-top: 18px;
  padding: 14px 16px 16px;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(120,80,30,.10), transparent 60%),
    linear-gradient(180deg, rgba(255,245,210,.55), rgba(220,190,130,.35));
  border: 1.5px solid var(--bronze-2);
  border-radius: 3px;
  box-shadow:
    inset 0 0 0 1px rgba(244,210,122,.45),
    inset 0 1px 0 rgba(255,255,255,.35),
    0 1px 2px rgba(80,40,10,.15);
}
.voice-preview .section-head { margin-bottom: 6px; }
.voice-preview-status {
  margin-left: 10px;
  font-family: 'MedievalSharp', 'IM Fell English', serif;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 13px;
}
.voice-preview-output { flex: 1 1 240px; min-width: 240px; max-width: 460px; }
.voice-preview-output:empty { display: none; }
.voice-preview .form-actions { flex-wrap: wrap; align-items: center; gap: 10px; }
.voice-preview-audio {
  width: 100%;
  max-width: 420px;
  margin-top: 4px;
  filter: sepia(.45) saturate(1.2) hue-rotate(-10deg);
}

/* Image preview (Conjure an Image) */
.image-preview {
  margin-top: 18px;
  padding: 14px 16px 16px;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(120,80,30,.10), transparent 60%),
    linear-gradient(180deg, rgba(255,245,210,.55), rgba(220,190,130,.35));
  border: 1.5px solid var(--bronze-2);
  border-radius: 3px;
  box-shadow:
    inset 0 0 0 1px rgba(244,210,122,.45),
    inset 0 1px 0 rgba(255,255,255,.35),
    0 1px 2px rgba(80,40,10,.15);
}
.image-preview .section-head { margin-bottom: 6px; }
.image-preview-status {
  font-family: 'MedievalSharp', 'IM Fell English', serif;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 13px;
}
.image-preview-output { margin: 12px 0 18px; display: flex; justify-content: center; }
.image-preview-output:empty { display: none; margin: 0; }

.image-banner {
  position: relative;
  margin: 0;
  padding: 14px;
  max-width: 560px;
  width: 100%;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(60,30,8,.35), transparent 65%),
    linear-gradient(180deg, #2a1d0a 0%, #1a1208 100%);
  border: 1px solid #1a1208;
  box-shadow:
    inset 0 0 0 1px rgba(244,210,122,.55),
    inset 0 0 0 6px rgba(0,0,0,.0),
    inset 0 0 0 7px var(--gold-3),
    0 6px 16px rgba(0,0,0,.45);
  border-radius: 3px;
}
.image-banner img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #1a1208;
  box-shadow: 0 0 0 2px rgba(244,210,122,.4), 0 4px 10px rgba(0,0,0,.5);
}
.image-banner-corner {
  position: absolute;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--gold-1);
  text-shadow: 0 1px 0 #000, 0 0 6px rgba(244,210,122,.5);
  font-size: 16px;
  pointer-events: none;
}
.image-banner-corner-tl { top: 2px; left: 2px; }
.image-banner-corner-tr { top: 2px; right: 2px; transform: scaleX(-1); }
.image-banner-corner-bl { bottom: 2px; left: 2px; transform: scaleY(-1); }
.image-banner-corner-br { bottom: 2px; right: 2px; transform: scale(-1, -1); }

/* Loading placeholder — running knights */
.image-banner-loading .image-loader-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 90%, rgba(60,40,15,.8), transparent 60%),
    linear-gradient(180deg, #4a3418 0%, #2a1d0a 65%, #1a1208 100%);
  border: 1px solid #1a1208;
  box-shadow: 0 0 0 2px rgba(244,210,122,.4), inset 0 0 30px rgba(0,0,0,.55);
}
.image-loader-ground {
  position: absolute;
  left: 0; right: 0;
  bottom: 22%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-3) 20%, var(--gold-1) 50%, var(--gold-3) 80%, transparent);
  box-shadow: 0 1px 0 rgba(0,0,0,.6), 0 0 8px rgba(244,210,122,.25);
}
.image-loader-knight {
  position: absolute;
  bottom: calc(22% + 2px);
  left: -14%;
  width: 64px; height: 64px;
  color: var(--gold-1);
  filter: drop-shadow(0 1px 0 #000) drop-shadow(0 0 6px rgba(244,210,122,.45));
  animation: knight-gallop 2.6s linear infinite, knight-bob .32s ease-in-out infinite alternate;
  will-change: transform;
}
.image-loader-knight .knight-svg { width: 100%; height: 100%; display: block; }
.image-loader-knight-1 { animation-delay: 0s, 0s;     width: 56px; height: 56px; opacity: .85; }
.image-loader-knight-2 { animation-delay: .55s, .15s; width: 72px; height: 72px; }
.image-loader-knight-3 { animation-delay: 1.15s, .05s; width: 48px; height: 48px; opacity: .75; }
@keyframes knight-gallop {
  0%   { transform: translateX(0); }
  100% { transform: translateX(140%); }
}
@keyframes knight-bob {
  0%   { margin-bottom: 0; }
  100% { margin-bottom: 6px; }
}
.image-loader-dust {
  position: absolute;
  bottom: 22%;
  left: 0; right: 0;
  height: 8px;
  background:
    radial-gradient(circle at 20% 50%, rgba(244,210,122,.18), transparent 50%),
    radial-gradient(circle at 60% 50%, rgba(244,210,122,.14), transparent 50%),
    radial-gradient(circle at 90% 50%, rgba(244,210,122,.18), transparent 50%);
  filter: blur(1px);
  animation: dust-drift 1.4s linear infinite;
}
@keyframes dust-drift {
  0%   { background-position: 0 0, 0 0, 0 0; }
  100% { background-position: 40px 0, 60px 0, 30px 0; }
}
.image-loader-caption {
  position: absolute;
  top: 12%;
  left: 0; right: 0;
  text-align: center;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--gold-1);
  text-shadow: 0 1px 0 #000, 0 0 6px rgba(244,210,122,.35);
  animation: caption-pulse 1.6s ease-in-out infinite;
}
@keyframes caption-pulse {
  0%, 100% { opacity: .65; }
  50%      { opacity: 1; }
}

/* Themed audio player (medieval scroll style) */
.tav-player {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  max-width: 460px;
  width: 100%;
  background:
    radial-gradient(ellipse at 0% 50%, rgba(120,80,30,.18), transparent 65%),
    linear-gradient(180deg, #2a1d0a 0%, #1a1208 100%);
  border: 1.5px solid var(--gold-3);
  border-radius: 3px;
  box-shadow:
    inset 0 0 0 1px rgba(244,210,122,.35),
    inset 0 1px 0 rgba(255,220,150,.12),
    0 1px 3px rgba(0,0,0,.4);
}
.tav-player audio { display: none; }
.tav-player-play {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold-1), var(--gold-3) 70%, #6a4a14);
  border: 1px solid #1a1208;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.5),
    inset 0 -2px 4px rgba(0,0,0,.35),
    0 1px 2px rgba(0,0,0,.4);
  color: #1a1208;
  font-size: 12px;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(255,255,255,.3);
  transition: transform .08s ease;
}
.tav-player-play:hover { transform: scale(1.04); }
.tav-player-play:active { transform: scale(.96); }
.tav-player.is-playing .tav-player-play {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.6),
    inset 0 -2px 4px rgba(0,0,0,.35),
    0 0 8px rgba(244,210,122,.45),
    0 1px 2px rgba(0,0,0,.4);
}
.tav-player-progress {
  position: relative;
  flex: 1 1 auto;
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(180deg, #0f0a04, #1a1208);
  border: 1px solid #6a4a14;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.6), inset 0 -1px 0 rgba(244,210,122,.08);
  cursor: pointer;
}
.tav-player-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-3), var(--gold-1));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
  border-radius: 1px;
}
.tav-player-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 12px; height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold-1), var(--gold-3));
  border: 1px solid #1a1208;
  box-shadow: 0 1px 2px rgba(0,0,0,.5);
  pointer-events: none;
}
.tav-player-time {
  flex: 0 0 auto;
  min-width: 80px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #f3d98a;
  text-shadow: 0 1px 0 #000;
  letter-spacing: .04em;
  text-align: right;
}

/* Modal not used by current handlers (htmx confirm), placeholder preserved. */
