@font-face {
  font-family: Cinzel;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/cinzel-latin-700.woff2") format("woff2");
}
:root { color-scheme: light; }
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
html { background: #1a100a; }
html.boot-app #gate { display: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: transparent;
  margin: 0;
  padding:
    calc(14px + env(safe-area-inset-top))
    calc(14px + env(safe-area-inset-right))
    calc(18px + env(safe-area-inset-bottom))
    calc(14px + env(safe-area-inset-left));
  color: #f4e7d0;
}
button, summary { -webkit-tap-highlight-color: rgba(224, 194, 122, .35); }
.hall {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(32, 18, 8, .62), rgba(16, 8, 4, .84)),
    url("guild-hero.jpg") center 28% / cover no-repeat;
}
#app, #gate, .modal, #cele { position: relative; z-index: 1; }
#app { max-width: 1100px; margin: 0 auto; }
header {
  display: flex;
  flex-direction: column;
  margin: 0 0 14px;
  border: 3px solid #e0c27a;
  border-radius: 16px;
  box-shadow: 0 0 0 6px #5a3a22, 0 14px 28px rgba(0, 0, 0, .38);
  color: #f8edd4;
  overflow: hidden;
  background: #2a1810;
}
.title-strip {
  padding: 10px 16px 8px;
  text-align: center;
  background:
    linear-gradient(180deg, #4a2c18, #2a1810);
  border-bottom: 2px solid #e0c27a;
}
.banner-art {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: cover;
  object-position: 34% 42%;
}
.banner-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 10px 14px 12px;
  background: #2a1810;
}
.banner-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-left: auto;
}
h1, h2, h3, .done-day, summary, #cele-msg, #cele-gold {
  font-family: Cinzel, Palatino, "Palatino Linotype", Georgia, serif;
  font-weight: 700;
}
h1 {
  font-size: 28px;
  margin: 0;
  color: #f8e7b8;
  letter-spacing: .03em;
}
#sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: #f3e6cc;
  font-size: 13px;
  margin: 0;
  line-height: 1.3;
}
#week-done {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  color: #ffe7a3;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  min-height: 44px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  touch-action: manipulation;
}
#week-done:hover { color: #fff6d4; }
#week-done:focus-visible,
#done-view-close:focus-visible,
#done-ranges button:focus-visible,
#gold:focus-visible,
#bank-close:focus-visible,
#reset-pin:focus-visible,
#mute:focus-visible,
.dice:focus-visible,
.bar button:focus-visible,
summary:focus-visible {
  outline: 2px solid #ffe7a3;
  outline-offset: 2px;
}
.gold-pile {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  width: auto;
  margin: 0;
  padding: 0 2px;
  border: 0;
  background: none;
  color: #ffe7a3;
  font-family: Cinzel, Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .04em;
  text-align: left;
  text-decoration: none;
  line-height: 1.3;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 100%;
  min-height: 44px;
  cursor: pointer;
  touch-action: manipulation;
}
.gold-pile[hidden] { display: none !important; }
.banker-link {
  text-decoration: underline;
  text-decoration-color: rgba(255, 231, 163, .75);
  text-underline-offset: 3px;
  white-space: nowrap;
}
.banker-week {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}
#gold:hover { color: #fff6d4; }
#gold .gold-neg { color: #ffb4a8; }
.gold-amt { color: #7a5410; font-weight: 700; }
.late-fee { color: #a32018; font-weight: 700; }
.gold-neg { color: #a32018; }
.week-track span.is-neg { background: linear-gradient(90deg, #8e1d16, #e07a72); }
#add-err { flex: 1 1 100%; min-height: 0; margin: 0; }
#add-err:not(:empty) { min-height: 1.2em; }
#cele-gold {
  margin: 0;
  font-family: Cinzel, Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  color: #3a2412;
  background: linear-gradient(#fff4c8, #e6c14e);
  border: 2px solid #8d6418;
  border-radius: 999px;
  padding: 6px 14px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .35);
}
.foot {
  margin-top: 28px;
  text-align: center;
}
#reset-pin, #mute {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  color: rgba(224, 194, 122, .78);
  font-family: Cinzel, Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.2;
  text-decoration: underline;
  text-decoration-color: rgba(224, 194, 122, .5);
  text-underline-offset: 3px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
  cursor: pointer;
  padding: 6px 8px;
}
#reset-pin:hover, #mute:hover {
  color: #ffe7a3;
  text-decoration-color: rgba(255, 231, 163, .85);
}
.bar { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.bar button {
  border: 1px solid #c6a15a;
  background: #f6ead0;
  color: #3a2412;
  padding: 8px 14px;
  border-radius: 16px;
  font-size: 14px;
  min-height: 44px;
  flex: 0 0 auto;
  cursor: pointer;
  touch-action: manipulation;
}
.bar button.on { background: #3a2414; color: #f6e2a8; border-color: #e0c27a; }
.add {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .35), transparent 30%),
    linear-gradient(180deg, #fbf6e8, #f0e0c0);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  border: 2px solid #c6a15a;
  box-shadow: 0 0 0 4px #5c3a22, 0 10px 18px rgba(0, 0, 0, .28);
  color: #3a2412;
}
.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 140px; min-width: 0; }
.field.grow { flex: 1 1 100%; }
.field span, .box label { font-size: 12px; color: #5c4030; font-weight: 700; }
.add input, .add select, .box input {
  font-size: 16px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #c8ae7a;
  border-radius: 8px;
  background: #fffaf0;
  color: #2c1810;
  width: 100%;
  max-width: 100%;
}
.add input, .add select { min-width: 0; }
#d { text-align: left; }
#d::-webkit-date-and-time-value { text-align: left; }
.add button, .box button {
  font-size: 16px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #8d6a32;
  background: #f6ead0;
  color: #3a2412;
  cursor: pointer;
  touch-action: manipulation;
}
.add button {
  background: linear-gradient(#f0d48a, #c4923c);
  color: #2a1a0c;
  border: 0;
  font-weight: 700;
}
.add button:disabled { opacity: 0.6; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.col {
  background:
    linear-gradient(180deg, rgba(255, 214, 150, .14), rgba(0, 0, 0, .14)),
    linear-gradient(90deg, #6b4630, #4e301c 42%, #5c3b24 70%, #3f2616);
  border: 2px solid #d7b36a;
  border-radius: 12px;
  padding: 8px;
  min-width: 0;
  box-shadow: inset 0 0 0 1px #3a2414, 0 10px 18px rgba(0, 0, 0, .28);
}
.col h2 {
  font-size: 16px;
  line-height: 1.3;
  margin: 6px 6px 10px;
  color: #f8e7b8;
  letter-spacing: .02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
}
.col[data-bucket="Past Due"] h2 { color: #ffd2c6; }
.card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .4), transparent 32%),
    linear-gradient(180deg, #fbf6e8, #f0e0c0);
  color: #2c1810;
  border-radius: 3px;
  padding: 10px 28px 10px 12px;
  margin: 8px 2px;
  border: 1px solid #c8ae7a;
  border-left: 18px solid #8d8272;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .45), 0 7px 12px rgba(40, 20, 8, .22);
}
.card::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff1c4, #c4963e 46%, #7a5418 82%);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .45);
}
.card > div { flex: 1; min-width: 0; }
.card input { width: 28px; height: 28px; margin: 2px 0 0; flex: 0 0 auto; accent-color: #1f7a42; }
.card.Work { border-left-color: #2f6fdb; }
.card.Home { border-left-color: #2e9e57; }
.card.eBay { border-left-color: #e08a1e; }
.card.is-overdue { outline: 3px solid #d23b32; outline-offset: 1px; }
.card.is-today { outline: 3px solid #e07a14; outline-offset: 1px; }
.when-flag { font-weight: 700; }
.when-flag.overdue { color: #a32018; }
.when-flag.today { color: #9a4e08; }
.cat-mark {
  position: absolute;
  left: -18px;
  top: 0;
  bottom: 0;
  width: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}
.card.eBay .cat-mark { color: #2a1a0c; }
.meta { font-size: 12px; color: #5c4632; margin-top: 3px; }
.det { font-size: 12px; color: #3d2a1c; margin-top: 3px; white-space: pre-wrap; }
.due { color: #a32018; font-weight: 700; }
details {
  margin-top: 16px;
  background: rgba(42, 24, 14, .55);
  border: 1px solid rgba(214, 176, 96, .5);
  border-radius: 12px;
  padding: 4px 12px 8px;
}
summary {
  cursor: pointer;
  color: #f6e7c1;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 15px;
}
.done { opacity: 0.72; text-decoration: line-through; }
.empty { color: #f0e0c0; font-size: 14px; margin: 8px 4px; }
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 8, 4, .62);
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 16px;
}
.modal.open { display: flex; }
#gate { z-index: 30; }
.box {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .35), transparent 28%),
    linear-gradient(180deg, #fbf6e8, #f0e0c0);
  color: #2c1810;
  border-radius: 12px;
  padding: 18px;
  width: min(380px, 100%);
  border: 2px solid #c6a15a;
  box-shadow: 0 0 0 4px #5c3a22, 0 16px 30px rgba(0, 0, 0, .4);
}
.box h2, .box h3 { margin: 0 0 6px; color: #3a2412; font-size: 22px; }
.box p { margin: 0 0 12px; color: #3d2a1c; }
.box input { margin-bottom: 4px; }
.box .btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.box button.go { background: #1f7a42; color: #fff; border: 0; }
#gate-go { background: linear-gradient(#f0d48a, #c4923c); color: #2a1a0c; border: 0; font-weight: 700; }
.err { color: #8e1d16; min-height: 1.2em; font-size: 14px; }
#cele {
  display: none;
  position: fixed;
  top: 42%;
  left: 50%;
  z-index: 20;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  background: transparent;
  text-align: center;
  transform: translate(-50%, -50%);
  animation: pop 0.4s;
}
#cele img {
  width: min(280px, 74vw);
  height: auto;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .5));
}
#cele-msg {
  margin: 0;
  font-size: 22px;
  color: #3a2412;
  background: linear-gradient(180deg, #fbf6e8, #f0e0c0);
  border: 2px solid #c6a15a;
  padding: 8px 16px;
  border-radius: 4px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .35);
}
.conf {
  position: fixed;
  top: -10px;
  width: 9px;
  height: 14px;
  z-index: 21;
  pointer-events: none;
  animation: fall 2.5s linear forwards;
}
@keyframes fall { to { top: 105vh; } }
@keyframes pop {
  from { transform: translate(-50%, -50%) scale(0.3); }
  to { transform: translate(-50%, -50%) scale(1); }
}
#done-view { z-index: 12; }
#done-view.modal { align-items: flex-end; padding: 0; }
#done-view .done-panel {
  background:
    linear-gradient(180deg, rgba(255, 214, 150, .12), rgba(0, 0, 0, .16)),
    linear-gradient(90deg, #6b4630, #4e301c 40%, #5c3b24);
  color: #f6e7c1;
  width: 100%;
  max-height: 92vh;
  max-height: 92dvh;
  border-radius: 16px 16px 0 0;
  border: 3px solid #e0c27a;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding:
    8px
    calc(14px + env(safe-area-inset-right))
    calc(12px + env(safe-area-inset-bottom))
    calc(14px + env(safe-area-inset-left));
}
.done-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
}
.done-panel-head h3 { margin: 0; font-size: 22px; color: #f8e7b8; letter-spacing: .03em; }
#done-view-close {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  color: #ffe7a3;
  font-size: 16px;
  font-weight: 700;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 4px;
  cursor: pointer;
  touch-action: manipulation;
}
#done-ranges {
  flex: 0 0 auto;
  flex-wrap: wrap;
  overflow: visible;
  margin: 4px 0 8px;
}
#done-ranges button {
  min-height: 44px;
  touch-action: manipulation;
}
.done-hint {
  flex: 0 0 auto;
  margin: 0 0 8px;
  color: #f3e6cc;
  font-size: 13px;
  min-height: 1.2em;
}
#done-list {
  overflow: auto;
  min-height: 0;
  flex: 1 1 auto;
  max-height: calc(92vh - 176px);
  max-height: calc(92dvh - 176px);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
#done-list .card > div { min-width: 0; }
#done-list .card { overflow-wrap: break-word; }
.done-day {
  font-size: 14px;
  color: #f8e7b8;
  margin: 12px 2px 6px;
  letter-spacing: .02em;
}
#done-list .done-day:first-child { margin-top: 2px; }
#done-list .empty { color: #f0e0c0; }
@media (max-width: 700px) {
  .banner-art { max-height: 220px; object-position: 28% 40%; }
  .hall { background-position: 18% 30%; }
  h1 { font-size: 22px; }
  .banner-actions { margin-left: 0; width: 100%; }
}
@media (max-height: 520px) {
  #done-view .done-panel { max-height: 100vh; max-height: 100dvh; border-radius: 0; }
  #done-list {
    max-height: calc(100vh - 176px);
    max-height: calc(100dvh - 176px);
  }
  .banner-art { max-height: 140px; object-position: 28% 40%; }
}
@media (min-width: 700px) and (min-height: 560px) {
  #done-view.modal { align-items: center; padding: 24px; }
  #done-view .done-panel {
    width: min(520px, 100%);
    max-height: min(80vh, 760px);
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, .45);
  }
  #done-list { max-height: calc(min(80vh, 760px) - 176px); }
}
@media (max-width: 640px) {
  .add button { flex: 1 1 100%; }
  #cele-msg { font-size: 18px; }
  #cele-gold { font-size: 17px; }
}
.field.date-field {
  flex: 0 0 auto;
  width: 10rem;
  max-width: 46vw;
}
.date-wrap {
  position: relative;
  display: block;
  width: 10rem;
  max-width: 100%;
  height: 44px;
}
.date-wrap input[type="date"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.date-face {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  height: 44px;
  padding: 0 10px;
  border: 1px solid #c8ae7a;
  border-radius: 8px;
  background: #fffaf0;
  color: #2c1810;
  font-size: 16px;
  pointer-events: none;
  white-space: nowrap;
}
.date-wrap:focus-within .date-face {
  outline: 2px solid #8d6a32;
  outline-offset: 2px;
}
@media (max-width: 520px) {
  .field.date-field,
  .date-wrap {
    width: 8.75rem;
    max-width: 46vw;
  }
  .date-face { font-size: 15px; padding: 0 8px; }
}
#bank-view { z-index: 28; }
#info-view { z-index: 28; }
#bank-view.modal { align-items: flex-end; padding: 0; }
.bank-panel {
  width: 100%;
  max-height: 94vh;
  max-height: 94dvh;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(180deg, rgba(255, 214, 150, .1), rgba(0, 0, 0, .18)),
    linear-gradient(180deg, #6b4630, #3f2616);
  color: #f6e7c1;
  border: 3px solid #e0c27a;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -12px 30px rgba(0, 0, 0, .45);
}
.bank-banner {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #1a100a;
  overflow: hidden;
}
.bank-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}
#bank-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(20, 10, 4, .66);
  color: #ffe7a3;
  border: 0;
  border-radius: 999px;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
.bank-totals {
  position: absolute;
  z-index: 2;
  left: 7.5%;
  top: 14%;
  width: 36%;
  height: 52%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #3a2412;
  text-shadow: none;
}
.bank-kicker {
  margin: 0;
  font-size: clamp(11px, 1.5vw, 13px);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #5c4030;
}
.bank-sum {
  margin: 0 0 8px;
  font-family: Cinzel, Palatino, "Palatino Linotype", Georgia, serif;
  font-weight: 700;
  font-size: clamp(18px, 3.4vw, 34px);
  line-height: 1.05;
  color: #3a2412;
}
.bank-sum:last-child { margin-bottom: 0; }
#bank-scroll { padding: 12px 12px calc(16px + env(safe-area-inset-bottom)); }
.bank-section {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .35), transparent 28%),
    linear-gradient(180deg, #fbf6e8, #f0e0c0);
  color: #2c1810;
  border: 1px solid #c8ae7a;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}
.bank-section h4 {
  margin: 0;
  font-size: 16px;
  color: #3a2412;
}
.bank-note { margin: 2px 0 8px; font-size: 12px; color: #5c4632; }
.week-row {
  display: grid;
  grid-template-columns: minmax(92px, 7.6rem) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 7px 0;
  font-size: 13px;
}
.week-name { line-height: 1.2; color: #3a2412; }
.week-name span { display: block; color: #5c4632; font-size: 12px; }
.week-row.is-now .week-name strong { font-family: Cinzel, Palatino, Georgia, serif; }
.week-track {
  height: 12px;
  border-radius: 999px;
  background: #e6d3aa;
  overflow: hidden;
}
.week-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c4923c, #ffe08a);
}
.week-amt { font-weight: 700; color: #7a5410; white-space: nowrap; }
.card.ledger { align-items: center; padding: 10px 12px; margin: 8px 0; }
.card.ledger::after { display: none; }
.ledger-pay {
  margin-left: auto;
  font-weight: 700;
  color: #7a5410;
  white-space: nowrap;
}
.bank-section .empty { color: #5c4632; }
@media (max-width: 700px) {
  .bank-totals { left: 8%; top: 16%; width: 38%; height: 50%; }
  .bank-sum { font-size: 20px; }
  .week-row { grid-template-columns: minmax(78px, 6.4rem) minmax(0, 1fr) auto; gap: 6px; }
}
@media (min-width: 700px) and (min-height: 560px) {
  #bank-view.modal { align-items: center; padding: 24px; }
  .bank-panel {
    width: min(760px, 100%);
    max-height: min(88vh, 920px);
    border-radius: 16px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, .45);
  }
}
@media (prefers-reduced-motion: reduce) {
  .conf, #cele, .fx-chest, .fx-sock, .fx-cloud, .fx-bottle, .fx-goblin, .coin { animation: none; }
  .banner-art { max-height: 220px; }
  .for-sale-fox, .parcel.fox-hop .for-sale-fox { animation: none; }
}
.add-hint { flex: 1 1 100%; margin: 0; font-size: 12px; color: #5c4030; }
.potion-banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 2px solid #e0c27a;
  border-radius: 10px;
  background: #3a2414;
  color: #f8e7b8;
  font-weight: 700;
}
.potion-banner[hidden] { display: none; }
.quest-icon { width: 44px; height: 44px; flex: 0 0 auto; margin-top: 2px; object-fit: cover; border-radius: 50%; }
.quest-icon svg { display: block; }
.q-head { display: flex; gap: 6px; align-items: flex-start; }
.q-head .repeat-btn { display: inline-flex; margin-top: 4px; }
.q-head > div { flex: 1; min-width: 0; }
.q-title {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  font-family: Cinzel, Palatino, Georgia, serif;
  font-weight: 700;
  line-height: 1.25;
}
.name-lock {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  border: 1px solid #c6a15a;
  border-radius: 6px;
  background: #fffaf0;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.name-lock.is-locked { background: #f3e2b8; }
.due-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.moved-flag { font-weight: 700; color: #7a5410; }
#due-view { z-index: 12; }
#due-cost { font-weight: 700; color: #7a5410; }
.title-undo {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #fff6e4;
  color: #3a2412;
  border: 1px solid #c6a15a;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(40, 20, 6, .25);
  font-size: 15px;
}
.title-undo[hidden] { display: none; }
.title-undo button {
  min-height: 36px;
  border: 1px solid #c6a15a;
  border-radius: 8px;
  background: #fffaf0;
  color: #3a2412;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.q-real { font-size: 13px; color: #5c4632; margin-top: 2px; }
.dice, .edit-quest {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 36px;
  border: 1px solid #c6a15a;
  border-radius: 8px;
  background: #fffaf0;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
.dice { font-size: 18px; font-weight: 400; }
.edit-quest { color: #3a2412; }
.box textarea {
  font-size: 16px;
  min-height: 72px;
  padding: 8px 10px;
  border: 1px solid #c8ae7a;
  border-radius: 8px;
  background: #fffaf0;
  color: #2c1810;
  width: 100%;
  font-family: inherit;
  resize: vertical;
}
.gold-late, .late-fee { color: #a32018; font-weight: 700; }
.chest-note, .chest-hint { color: #7a5410; font-weight: 700; }
.chest-log { margin: 4px 2px 8px; color: #f6e7c1; font-size: 14px; }
#potion-view { z-index: 28; }
#potion-view button:disabled { opacity: 0.55; }
.fx {
  position: fixed;
  inset: 0;
  z-index: 26;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(12, 6, 2, .55);
  color: #f8e7b8;
  text-align: center;
}
.fx[hidden] { display: none !important; }
.fx-stage { position: relative; width: min(280px, 86vw); min-height: 220px; }
.fx-skip {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 14px;
  letter-spacing: .04em;
  background: rgba(20, 10, 4, .72);
  padding: 8px 14px;
  border-radius: 999px;
}
#fx-caption, #fx-count {
  margin: 6px 0 0;
  font-family: Cinzel, Palatino, Georgia, serif;
  font-size: 20px;
  text-shadow: 0 2px 8px #000;
}
.fx-chest {
  width: 120px;
  height: 90px;
  margin: 30px auto 0;
  position: relative;
  transform-origin: center bottom;
}
.fx-chest .body {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 58px;
  border-radius: 6px 6px 10px 10px;
  background: linear-gradient(#a56a32, #6a3e18);
  border: 3px solid #e6c15a;
  box-shadow: inset 0 0 0 4px #8a5424, 0 10px 18px rgba(0, 0, 0, .35);
}
.fx-chest .body::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 16px;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff1c4, #e6b84d 60%, #8a6418);
}
.fx-chest .lid {
  position: absolute;
  left: -4px; right: -4px; top: 0;
  height: 36px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(#e6c15a, #a56a32);
  border: 3px solid #f4e1b5;
  transform-origin: top center;
}
.fx-chest.drop { animation: chest-drop .65s ease-out; }
.fx-chest.shake { animation: chest-shake .45s linear; }
.fx-chest.open .lid { animation: lid-open .35s ease-out forwards; }
.fx-chest.open { filter: drop-shadow(0 0 18px #e6c15a); }
@keyframes chest-drop {
  0% { transform: translateY(-160px) rotate(-8deg); }
  70% { transform: translateY(8px) rotate(3deg); }
  100% { transform: translateY(0) rotate(0); }
}
@keyframes chest-shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-7deg); }
  75% { transform: rotate(7deg); }
}
@keyframes lid-open { to { transform: translateY(-18px) rotateX(70deg); } }
.fx-sock {
  position: absolute;
  left: 50%;
  top: 40px;
  font-size: 64px;
  animation: sock-flop .6s ease-out;
}
.fx-cloud {
  position: absolute;
  left: 50%;
  top: 20px;
  width: 120px;
  height: 70px;
  margin-left: -60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(120, 190, 70, .85), rgba(120, 190, 70, 0) 70%);
  animation: cloud-puff .8s ease-out;
}
@keyframes sock-flop {
  0% { transform: translate(-50%, -30px) rotate(-20deg); }
  100% { transform: translate(-20%, 10px) rotate(18deg); }
}
@keyframes cloud-puff {
  from { transform: scale(.4); opacity: .2; }
  to { transform: scale(1.4); opacity: 1; }
}
.fx-bottle { font-size: 72px; animation: bottle-float 1s ease-in-out infinite; }
.fx-bottle.smash { animation: bottle-smash .45s ease-in forwards; }
.fx-bottle.drink { animation: bottle-drink .8s ease-out forwards; }
@keyframes bottle-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-16px); }
}
@keyframes bottle-smash {
  to { transform: translateY(40px) rotate(25deg) scale(.2); opacity: 0; }
}
@keyframes bottle-drink {
  40% { transform: rotate(-70deg) translateY(-10px); }
  100% { transform: rotate(-70deg) translateY(-30px); filter: drop-shadow(0 0 16px #f4e1b5); }
}
.fx-goblin {
  position: absolute;
  left: 0;
  bottom: 20px;
  min-width: 92px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #3f8f45;
  color: #f8e7b8;
  font-weight: 700;
  box-shadow: 0 8px 16px rgba(0, 0, 0, .35);
}
.fx-goblin.run { animation: goblin-run 1.6s linear forwards; }
@keyframes goblin-run {
  from { transform: translateX(-40vw); }
  to { transform: translateX(70vw); }
}
#fx-coins { position: absolute; inset: 0; pointer-events: none; }
.coin {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff1c4, #e6b84d 60%, #8a6418);
  animation: coin-burst .8s ease-out forwards;
}
@keyframes coin-burst {
  to { transform: translate(var(--x), -80px) rotate(var(--r)); opacity: 0; }
}
.board-foot {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 22px 28px;
  width: fit-content;
  max-width: 100%;
  margin: 36px auto 56px;
  padding: 14px 22px;
  background: #f4e1b5;
  border: 2px solid #c6a15a;
  border-radius: 14px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, .35);
}
.parchment-link {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: #4a2c12;
  font-family: Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(74, 44, 18, .45);
  cursor: pointer;
  min-height: 44px;
  padding: 8px 4px;
}
.parchment-link:hover { color: #2a1608; }
.quest-nav { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
#open-town, .quest-nav button, .sheet-head button, .town-panel button, .town-alert button, .gear-actions button, .shop-row, .loot-box button, #gear-body > button {
  min-height: 44px;
  border: 2px solid #c6a15a;
  border-radius: 12px;
  background: #f6ead0;
  color: #3a2412;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
}
.help-scroll {
  background: #f4e1b5 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 40'%3E%3Cpath d='M6 8h22c6 0 8 6 8 6s2-6 8-6h14v24H44s-2 4-8 4H28c-6 0-8-4-8-4H6z' fill='none' stroke='%236b3a16' stroke-width='2'/%3E%3C/svg%3E") 8px center / 28px no-repeat;
  padding-left: 42px;
}
.repeat-btn, .repeat-flag {
  flex: 0 0 auto;
  min-height: 36px;
  border: 1px solid #c6a15a;
  border-radius: 8px;
  background: #fffaf0;
  color: #3a2412;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.repeat-days { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: #3a2412; }
.repeat-days[hidden], #repeat-month[hidden], #repeat-edit-month[hidden] { display: none; }
.sheet-panel {
  width: min(980px, 100%);
  max-height: min(94vh, 980px);
  overflow: auto;
  background: #f6ead0;
  color: #3a2412;
  border-radius: 16px 16px 0 0;
  padding: 12px;
}
.sheet-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; position: sticky; top: 0; background: #f6ead0; z-index: 2; padding-bottom: 6px; }
.sheet-head h3 { margin: 0; flex: 1; }
button.back-quests,
.sheet-head button.back-quests,
.done-panel-head button.back-quests,
#bank-close.back-quests,
#done-view-close.back-quests,
#town-close.back-quests,
#gear-close.back-quests,
#help-close.back-quests {
  position: static;
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 1 0 100%;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 8px;
  min-height: 44px;
  padding: 8px 14px;
  border: 2px solid #e0c27a;
  border-radius: 12px;
  background: #3a2414;
  color: #ffe7a3;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  z-index: 5;
}
#bank-view > .bank-panel > button.back-quests {
  position: sticky;
  top: 0;
  margin: 0;
  border-radius: 12px 12px 0 0;
}
.done-panel-head { flex-wrap: wrap; }
.box > button.back-quests { margin-bottom: 12px; }
#fx > button.back-quests {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  width: auto;
  flex: none;
  z-index: 3;
  background: rgba(20, 10, 4, .88);
}
#town-view.modal, #gear-view.modal, #help-view.modal, #siri-view.modal, #map-view.modal, #place-view.modal, #settings-view.modal, #info-view.modal { align-items: flex-end; padding: 0; z-index: 24; }
#info-view.modal { z-index: 28; }
.town-buildings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
.building-tile {
  min-height: 128px;
  border: 3px solid #6b4228;
  border-radius: 18px;
  background: #f8efd4;
  color: #3a2412;
  padding: 14px 10px 12px;
  text-align: center;
  cursor: pointer;
  font: inherit;
}
.building-tile .tile-icon { font-size: 34px; line-height: 1.1; display: block; }
.building-tile strong { display: block; margin-top: 6px; font-size: 16px; }
.building-tile .tile-sub { display: block; margin-top: 2px; color: #6b5130; font-size: 13px; }
.building-tile.locked {
  border-style: dashed;
  background: #e7d7b4;
  color: #6d5840;
}
.building-tile.locked .tile-icon { filter: grayscale(.2); }
.town-actions { margin: 8px 0; }
.icon-btn, .town-back {
  min-height: 44px;
  border: 2px solid #c6a15a;
  border-radius: 12px;
  background: #f6ead0;
  color: #3a2412;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
}
.map-scroll {
  overflow: auto;
  max-height: min(62vh, 640px);
  width: 100%;
  border: 2px solid #6b4f2a;
  border-radius: 12px;
  background: #1d3a28;
}
.town-grid {
  display: grid;
  grid-template-columns: repeat(14, 64px);
  grid-template-rows: repeat(12, 64px);
  width: calc(14 * 64px);
  height: calc(12 * 64px);
  gap: 0;
  background: #cbb98a;
  position: relative;
}
.land-slice {
  position: absolute;
  inset: 0;
  background-image: url("assets/town/land.webp");
  background-repeat: no-repeat;
  background-size: calc(14 * 64px) calc(12 * 64px);
  background-position: calc(var(--c) * -64px) calc(var(--r) * -64px);
}
.parcel.wild .land-slice { filter: saturate(.62) brightness(.86) contrast(.96); opacity: 1; }
.road-art, .well-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  z-index: 2;
}
.road-art.planned { opacity: .48; }
.well-art { object-fit: contain; padding: 6%; }
.well-art.planned { opacity: .42; filter: grayscale(.35); }
.structure {
  position: relative;
  z-index: 3;
  pointer-events: none;
}
.structure img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  display: block;
  pointer-events: none;
}
.structure.unbuilt img { opacity: .4; filter: grayscale(.35) brightness(1.05); }
.structure.disrepair img { filter: sepia(.5) brightness(.88); }
.structure.picked { outline: 3px solid #ffe7a3; outline-offset: -3px; }
.name-banner {
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  font-family: Cinzel, Georgia, serif;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  border-radius: 3px;
  z-index: 4;
  pointer-events: none;
  max-width: calc(100% - 2px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.structure[data-span="1"] .name-banner { font-size: 7px; letter-spacing: -0.04em; padding: 0 2px; max-width: none; }
.structure[data-span="2"] .name-banner { font-size: 12px; padding: 1px 6px; }
.structure[data-span="3"] .name-banner { font-size: 14px; padding: 1px 8px; }
.name-banner.lit { background: #3d2412; color: #f3d56a; border: 1px solid #e6c15a; }
.name-banner.dim { background: #8d8880; color: #e6e0d6; border: 1px solid #6e6962; }
.map-victory {
  background: #3d2412;
  color: #f3d56a;
  border: 2px solid #e6c15a;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  text-align: center;
  margin: 8px 0;
}
.parcel.buyable { z-index: 1; }
.parcel-mask {
  position: absolute;
  left: 0;
  top: 0;
  width: 896px;
  height: 768px;
  pointer-events: none;
  z-index: 4;
}
.pocket-warn {
  flex: 1 1 100%;
  margin: 0;
  color: #ffb4a8;
  font-weight: 700;
}
#bank-hold {
  background: #fffaf0;
  margin: 0;
  padding: 10px 14px;
}
.tile-badge { position: absolute; top: 6px; right: 8px; font-size: 16px; }
.building-tile { position: relative; }
.tile-strip { display: block; margin-top: 4px; font-size: 12px; font-weight: 700; }
.tile-strip.bad, .info-status.bad { color: #9c1c14; }
.tile-strip.good, .info-status.good { color: #1d6b32; }
.info-lines { margin: 6px 0 8px; padding-left: 1.2em; }
.info-status { font-weight: 700; }
.parcel-tag {
  position: absolute;
  left: 2px;
  top: 1px;
  font-size: 9px;
  font-weight: 700;
  color: #fff8e6;
  text-shadow: 0 1px 1px #000;
  pointer-events: none;
  opacity: 0;
  z-index: 3;
}
.parcel.picked .parcel-tag { opacity: 1; }
.parcel { position: relative; padding: 0; border: 0; background: #6f9448; overflow: hidden; min-width: 0; min-height: 0; }
.parcel > .parcel-art { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.for-sale-fox {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 42%;
  max-width: 22px;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
  transform-origin: 70% 100%;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .4));
  animation: fox-bob 2.4s ease-in-out infinite;
  animation-delay: calc(var(--fox, 0) * 0.18s);
}
@keyframes fox-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1.5px); }
}
.parcel.fox-hop .for-sale-fox { animation: fox-hop .48s ease-out; animation-delay: 0s; }
@keyframes fox-hop {
  0% { transform: translateY(0) rotate(0deg); }
  35% { transform: translateY(-5px) rotate(-12deg); }
  68% { transform: translateY(0) rotate(8deg); }
  100% { transform: translateY(0) rotate(0deg); }
}
.parcel.wild img { filter: saturate(.92) brightness(.96); }
.parcel.planned img { filter: grayscale(.35) brightness(.86); opacity: .8; }
.parcel.disrepair img { filter: sepia(.55) brightness(.85); }
.parcel.ruin img { filter: grayscale(1) brightness(.55); }
.parcel.picked { outline: 3px solid #ffe7a3; outline-offset: -3px; z-index: 1; }
.town-panel, .town-alert, .town-note { background: #fffaf0; border: 1px solid #c6a15a; border-radius: 10px; padding: 8px 10px; }
.town-tiny { font-size: 12px; color: #5c4030; }
#town-err, #gear-err { color: #a32018; font-weight: 700; }
.doll {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(110px, 1.15fr) minmax(90px, 1fr);
  grid-template-areas:
    ". head ."
    "ear1 neck ear2"
    "weapon figure armor"
    "belt figure trinket"
    "ring1 figure ring2"
    "boots figure pet"
    "pack figure .";
  gap: 6px;
  align-items: stretch;
}
.doll-figure { grid-area: figure; display: flex; align-items: center; justify-content: center; }
.doll-figure img { width: 100%; max-width: 180px; border-radius: 12px; }
.doll .slot.head { grid-area: head; }
.doll .slot.ear1 { grid-area: ear1; }
.doll .slot.neck { grid-area: neck; }
.doll .slot.ear2 { grid-area: ear2; }
.doll .slot.weapon { grid-area: weapon; }
.doll .slot.armor { grid-area: armor; }
.doll .slot.belt { grid-area: belt; }
.doll .slot.ring1 { grid-area: ring1; }
.doll .slot.ring2 { grid-area: ring2; }
.doll .slot.boots { grid-area: boots; }
.doll .slot.trinket { grid-area: trinket; }
.doll .slot.pet { grid-area: pet; }
.doll .slot.pack { grid-area: pack; }
.settings-actions { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.settings-actions button,
#settings-view #mute,
#settings-view #reset-pin {
  appearance: none;
  -webkit-appearance: none;
  min-height: 48px;
  border: 2px solid #6b4228;
  border-radius: 12px;
  background: #fffaf0;
  color: #3a2412;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0;
  text-decoration: none;
  text-shadow: none;
  font-family: Palatino, Georgia, serif;
}
.hero-wrap { display: block; }
.slots { display: grid; gap: 6px; }
.slot { background: #fffaf0; border: 1px dashed #c6a15a; border-radius: 10px; padding: 6px; }
.slot span { display: block; font-size: 12px; color: #5c4030; }
.item-grid, .shop, .loot-box, .gear-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.item, .shop-row { text-align: left; }
.item.cursed { border-color: #a32018; }
.dura-wrap { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.dura { display: block; width: 72px; height: 6px; border-radius: 99px; background: linear-gradient(90deg, #2e9e57 var(--p), #e6d3aa var(--p)); }
.dura.worn { background: linear-gradient(90deg, #c4923c var(--p), #e6d3aa var(--p)); }
.dura.broken { background: #a32018; }
.lock { display: block; color: #a32018; font-size: 12px; }
.help-panel iframe { width: 100%; height: min(72vh, 760px); border: 0; background: #f4e4bc; border-radius: 8px; }
.siri-card {
  background: #fffaf0;
  border: 1px solid #c6a15a;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 10px 0;
}
.siri-card h4 {
  margin: 0 0 4px;
  font-family: Cinzel, Palatino, Georgia, serif;
}
.siri-card p { margin: 0 0 8px; }
.siri-note { font-size: 14px; color: #5c4030; }
.siri-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0 8px 8px 0;
  padding: 8px 14px;
  border: 0;
  border-radius: 12px;
  background: #1f7a42;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  touch-action: manipulation;
}
.siri-card button:not(.siri-add) {
  min-height: 44px;
  margin: 0 8px 8px 0;
  padding: 8px 12px;
  border: 2px solid #c6a15a;
  border-radius: 12px;
  background: #f6ead0;
  color: #3a2412;
  font-weight: 700;
}
.siri-token {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 8px;
  padding: 10px;
  border: 2px solid #c6a15a;
  border-radius: 8px;
  font-size: 16px;
  color: #2c1810;
  background: #fff;
}
.siri-card details { margin-top: 4px; }
.siri-card summary { color: #3a2412; }
.siri-card ol,
.siri-card ul { margin: 8px 0 0; padding-left: 1.2em; }
.siri-card li { margin: 6px 0; }
#siri-body { padding-bottom: 12px; }
@media (min-width: 800px) {
  #town-view.modal, #gear-view.modal, #help-view.modal, #siri-view.modal, #map-view.modal, #place-view.modal, #settings-view.modal, #info-view.modal { align-items: center; padding: 24px; }
  #info-view.modal { z-index: 28; }
  .sheet-panel { border-radius: 16px; }
}
#scene-view.modal {
  align-items: flex-end;
  padding: 0;
  z-index: 18;
}
.scene-panel {
  width: min(560px, 100%);
  max-height: min(94vh, 940px);
  max-height: min(94dvh, 940px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(180deg, rgba(255, 220, 160, .08), transparent 18%),
    #3a2414;
  color: #f6e7c1;
  border: 3px solid #e0c27a;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 0 0 6px #5a3a22, 0 -12px 28px rgba(0, 0, 0, .4);
  padding: 12px 12px calc(16px + env(safe-area-inset-bottom));
}
.scene-head {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #3a2414;
  padding-bottom: 4px;
}
.scene-head h3 {
  margin: 0;
  color: #f8e7b8;
  font-size: 22px;
  text-align: center;
}
#scene-err { color: #ffd2c6; margin: 0 4px 8px; }
#scene-err:empty { display: none; }
.scene-lead, .scene-empty, .scene-fox-line, #scene-fox-line {
  margin: 0 4px 8px;
  color: #f3e6cc;
  font-size: 15px;
}
.scene-empty { text-align: center; padding: 12px 8px 4px; }
.scene-scroll {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .4), transparent 22%),
    linear-gradient(180deg, #fbf6e8, #f0e0c0);
  color: #2c1810;
  border-radius: 10px;
  margin: 4px 2px 8px;
  padding: 6px 12px 8px;
  box-shadow: 0 12px 22px rgba(0, 0, 0, .35), inset 0 0 0 2px #c6a15a;
  transform-origin: top center;
  animation: unroll .7s ease-out both;
}
.scroll-roll {
  height: 16px;
  margin: 4px -6px;
  border-radius: 8px;
  background: linear-gradient(#6a3e18, #e6c15a 42%, #8a5424 58%, #4a2a10);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), 0 3px 4px rgba(0, 0, 0, .28);
}
.scene-quest {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(255, 255, 255, .45);
  border: 1px solid #c8ae7a;
  border-radius: 10px;
  padding: 8px;
  margin: 8px 0;
  animation: quest-slide .45s ease-out both;
  animation-delay: calc(var(--i, 0) * .12s + .28s);
}
.scene-quest .q-real { color: #5c4632; }
.scene-quest.late {
  border-color: #a32018;
  animation: quest-slide .45s ease-out both, late-flash 1.15s ease-in-out calc(var(--i, 0) * .12s + .8s) infinite;
}
@keyframes unroll {
  from { transform: scaleY(.06); }
  to { transform: scaleY(1); }
}
@keyframes quest-slide {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: none; }
}
@keyframes late-flash {
  0%, 100% { background: #f8e4dc; box-shadow: inset 0 0 0 0 #a32018; }
  50% { background: #f3b8b0; box-shadow: inset 0 0 0 2px #a32018; }
}
.scene-panel.settled .scene-scroll { animation: none; }
.scene-panel.settled .scene-quest { animation: none; }
.scene-panel.settled .scene-quest.late { animation: late-flash 1.15s ease-in-out infinite; }
.danger-card {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  overflow: hidden;
  margin: 8px 2px;
  padding: 12px;
  border: 2px solid #c6a15a;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .35), transparent 30%),
    linear-gradient(180deg, #fbf6e8, #f0e0c0);
  color: #2c1810;
  box-shadow: 0 8px 16px rgba(0, 0, 0, .28);
  animation: danger-shake 2.8s ease-in-out infinite;
  transform-origin: center center;
}
.danger-copy { flex: 1 1 190px; min-width: 0; }
.danger-card .q-real { color: #5c4632; }
.danger-card .risk, .danger-card .risk-note { margin: 6px 0 0; font-size: 14px; }
.danger-card .risk-note { color: #a32018; font-weight: 700; }
.hourglass {
  width: 28px;
  height: 38px;
  flex: 0 0 auto;
  margin-top: 2px;
}
.hourglass .sand {
  transform-origin: 18px 37px;
  animation: sand-drop 1.2s linear infinite;
}
@keyframes sand-drop {
  0% { transform: scaleY(.25); }
  75% { transform: scaleY(1); }
  100% { transform: scaleY(.25); }
}
@keyframes danger-shake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  20% { transform: translateX(-1.5px) rotate(-.35deg); }
  45% { transform: translateX(1.5px) rotate(.35deg); }
  70% { transform: translateX(-1px) rotate(-.15deg); }
}
.already-done {
  display: block;
  width: 100%;
  min-height: 52px;
  margin-top: 10px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(#3cb36a, #1f7a42);
  color: #fff;
  font-family: Cinzel, Palatino, Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
.already-done:disabled { opacity: .55; }
.coin-pile {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
}
.coin-pile span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6d4, #e6b84d 58%, #8a6418);
  box-shadow: inset 0 -3px 0 #8a5418, 0 4px 6px rgba(0, 0, 0, .25);
}
.danger-card.victory { animation: none; }
.danger-card.victory .danger-copy,
.danger-card.victory .hourglass,
.danger-card.victory .quest-icon { opacity: 0; transition: opacity .35s ease; }
.danger-card.victory .coin-pile { opacity: 1; }
.danger-card.victory .coin-pile span { animation: coin-pop .45s ease both; }
.danger-card.victory .coin-pile span:nth-child(2) { animation-delay: .08s; }
.danger-card.victory .coin-pile span:nth-child(3) { animation-delay: .16s; }
@keyframes coin-pop {
  from { transform: scale(.2) translateY(8px); }
  to { transform: scale(1) translateY(0); }
}
.scene-mascot {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 4px 6px 0;
}
.scene-mascot .for-sale-fox {
  position: static;
  width: 92px;
  max-width: 92px;
  height: auto;
  flex: 0 0 auto;
  animation: fox-pop .5s cubic-bezier(.2, 1.4, .4, 1) both, fox-cheer 1.6s ease-in-out .55s infinite;
}
#scene-fox-line { margin: 0 0 10px; }
@keyframes fox-pop {
  from { opacity: 0; transform: translateY(18px) scale(.3); }
  to { opacity: 1; transform: none; }
}
@keyframes fox-cheer {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  35% { transform: translateY(-12px) rotate(-8deg); }
  60% { transform: translateY(0) rotate(7deg); }
}
.scene-panel.settled .scene-mascot .for-sale-fox { animation: fox-cheer 1.6s ease-in-out infinite; }
.scene-mascot .for-sale-fox.cheer { animation: fox-cheer .65s ease-in-out 2; }
@media (min-width: 800px) {
  #scene-view.modal { align-items: center; padding: 24px; }
  .scene-panel { border-radius: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .scene-scroll, .scene-quest, .scene-quest.late, .danger-card, .hourglass .sand,
  .scene-mascot .for-sale-fox, .scene-panel.settled .scene-mascot .for-sale-fox,
  .scene-mascot .for-sale-fox.cheer, .danger-card.victory .coin-pile span {
    animation: none;
  }
  .scene-quest, .scene-quest.late { opacity: 1; transform: none; }
  .scene-quest.late {
    background: #f3b8b0;
    box-shadow: inset 0 0 0 2px #a32018;
  }
  .danger-card { transform: none; }
  .hourglass .sand { transform: scaleY(.7); }
  .scene-mascot .for-sale-fox { opacity: 1; transform: none; }
  .danger-card.victory .danger-copy,
  .danger-card.victory .hourglass,
  .danger-card.victory .quest-icon { opacity: 0; transition: none; }
  .danger-card.victory .coin-pile { opacity: 1; }
}
