.app--v2 {
  padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  position: relative;
  z-index: 2;
  background: transparent;
}

.screen__inner {
  max-width: 100%;
}

[data-screen="steed"] .screen__inner,
[data-screen="dragon"] .screen__inner {
  background: linear-gradient(180deg, rgba(15, 24, 18, 0.15) 0%, rgba(15, 24, 18, 0.35) 100%);
  border-radius: var(--radius);
  padding: 12px 14px 20px;
}

[data-screen="dragon"] .title,
[data-screen="steed"] .affection {
  color: var(--parchment);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

[data-screen="dragon"] .horse-mascot--quest {
  background: transparent;
  border-radius: 0;
  overflow: visible;
}

.dragon-honest-wrap {
  margin: 10px 0 4px;
  position: relative;
  z-index: 8;
}

.dragon-honest-wrap .link-btn {
  width: 100%;
  text-align: center;
  line-height: 1.45;
  padding: 10px 8px;
  color: #f4e8d0;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.75);
}

.journal-panel,
.letter-panel,
.sheet-panel,
.tavern-panel,
[data-screen="stars"] .screen__inner.ornate,
.honest-panel,
.booking-countdown {
  background: linear-gradient(
    180deg,
    rgba(252, 245, 232, 0.96) 0%,
    rgba(244, 228, 200, 0.94) 100%
  );
  border: 2px solid rgba(201, 162, 39, 0.55);
  color: var(--ink);
}

.letter-panel .letter-body {
  color: #2a1520;
  font-size: 1.05rem;
  line-height: 1.6;
}

[data-screen="honest-no"] .body-text {
  color: #2a1520;
  font-weight: 500;
}

.booking-countdown {
  padding: 12px 14px;
  border-radius: var(--radius);
  margin: 12px 0;
  font-weight: 600;
  color: var(--burgundy-deep);
}

.particle-canvas {
  z-index: 1;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: max(8px, env(safe-area-inset-top)) 10px 6px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, transparent 100%);
}

.hud-strip {
  flex: 1;
  min-height: 54px;
  padding: 6px 10px 8px;
  border-radius: 14px;
  position: relative;
  cursor: pointer;
  text-align: left;
  border: 2px solid rgba(201, 162, 39, 0.75);
  background:
    linear-gradient(180deg, rgba(255, 252, 245, 0.94) 0%, rgba(244, 228, 200, 0.9) 100%),
    image-set(
      url("../assets/images/parchment.webp") type("image/webp"),
      url("../assets/images/parchment.jpg") type("image/jpeg")
    );
  background-size: cover;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 4px 14px rgba(0, 0, 0, 0.28);
}

.hud-strip__label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--burgundy);
  opacity: 0.85;
  margin-bottom: 2px;
}

.hud-strip__track {
  position: relative;
  height: 28px;
  width: 100%;
}

.hud-map {
  width: 100%;
  height: 100%;
  display: block;
}

.map-token {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: var(--parchment);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: left 0.55s cubic-bezier(0.34, 1.2, 0.64, 1), top 0.55s ease;
  overflow: hidden;
  pointer-events: none;
}

.map-token img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  mix-blend-mode: multiply;
}

body[data-screen="title"] .hud-strip__label {
  content: "Your journey";
}

.sound-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(201, 162, 39, 0.65);
  background: rgba(20, 30, 22, 0.55);
  backdrop-filter: blur(6px);
  margin-left: 8px;
  flex-shrink: 0;
}

body[data-screen="title"] #dialogueBox {
  display: none !important;
}

.screen__inner.ornate,
.parchment-textured {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.title-screen {
  padding-top: 8vh;
}

.title-screen .menu-plaques .btn--primary {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.title-hero-scrim {
  margin: 0 -4px 8px;
  padding: 18px 14px 20px;
  border-radius: 16px;
  background: linear-gradient(
    180deg,
    rgba(12, 18, 14, 0.72) 0%,
    rgba(12, 18, 14, 0.45) 55%,
    rgba(12, 18, 14, 0.15) 100%
  );
  border: 1px solid rgba(201, 162, 39, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.title-lockup {
  font-family: "Cinzel Decorative", "Cinzel", serif;
  font-size: clamp(1.4rem, 6vw, 1.85rem);
  text-align: center;
  color: #fff8f0;
  text-shadow:
    0 2px 4px rgba(0, 0, 0, 0.9),
    0 0 24px rgba(0, 0, 0, 0.55);
  margin: 0;
}

.title-screen .kicker {
  color: #f4e8d0;
  text-align: center;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
  margin: 0 0 10px;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.title-screen .small-print {
  color: var(--parchment);
  text-align: center;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.75);
}

.menu-plaques {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 24px 0;
}

.ornate {
  position: relative;
}

.ornate::before,
.ornate::after {
  content: "⚜";
  position: absolute;
  opacity: 0.25;
  font-size: 0.9rem;
}

.ornate::before { top: 8px; left: 10px; }
.ornate::after { bottom: 8px; right: 10px; transform: scale(-1, 1); }

.wax-seal-art {
  display: block;
  margin: 16px auto;
  cursor: pointer;
  transform-origin: center center;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.25));
}

.wax-seal-art.cracked {
  animation: sealBreak 0.6s forwards;
}

@keyframes sealBreak {
  to { transform: scale(1.1) rotate(8deg); opacity: 0; }
}

.horse-cutout {
  width: min(280px, 75vw);
  margin: 0 auto;
  display: block;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
}

.horse-cutout.small {
  width: 120px;
}

.horse-pet {
  transform: rotate(2deg) scale(1.02);
}

.steed-screen {
  text-align: center;
}

.carrot-btn {
  margin: 12px auto;
  padding: 10px 18px;
  border-radius: 99px;
  border: 2px solid var(--gold);
  background: rgba(255, 255, 255, 0.6);
  font-family: var(--font-body);
}

.name-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
}

.name-chips button {
  padding: 8px 12px;
  border-radius: 99px;
  border: 2px solid rgba(107, 45, 58, 0.35);
  background: rgba(252, 245, 232, 0.92);
  font-size: 0.85rem;
  font-family: var(--font-display);
  color: var(--burgundy-deep);
}

#ratingSlider {
  width: 100%;
  accent-color: var(--burgundy);
  height: 2.25rem;
}

#notesInput,
textarea#notesInput {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 2px solid rgba(107, 45, 58, 0.35);
  background: rgba(252, 245, 232, 0.95);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  resize: vertical;
}

.chip-select,
.chip-row .chip-select {
  padding: 10px 14px;
  border-radius: 99px;
  border: 2px solid rgba(107, 45, 58, 0.35);
  background: rgba(252, 245, 232, 0.92);
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--burgundy-deep);
}

.sheet-panel .stat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  margin: 8px 0;
  font-size: 0.95rem;
}

.sheet-panel .stat-row em {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.class-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.class-grid button {
  text-align: left;
  padding: 12px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.5);
  font-family: var(--font-body);
}

.journal-entry {
  width: 100%;
  text-align: left;
  padding: 14px;
  margin-bottom: 8px;
  border: none;
  border-radius: var(--radius);
  background: rgba(60, 40, 30, 0.08);
  font-family: var(--font-body);
  position: relative;
}

.journal-entry--stamped::after {
  content: "COMPLETED";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%) rotate(-8deg);
  color: var(--burgundy);
  font-weight: 800;
  font-size: 0.75rem;
  border: 3px solid var(--burgundy);
  padding: 4px 8px;
}

.boss-hp {
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: 0.75rem;
}

.boss-hp__bar {
  height: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 99px;
  overflow: hidden;
}

.boss-hp__bar div {
  height: 100%;
  background: linear-gradient(90deg, #6b2d3a, #c9a227);
  transition: width 0.3s ease;
}

.dragon-cutout {
  width: min(132px, 36vw);
  display: block;
  margin: 0 auto 4px;
}

[data-screen="dragon"] .horse-mascot--quest {
  width: min(96px, 26vw);
  margin-bottom: 4px;
}

[data-screen="dragon"] .title {
  font-size: clamp(1rem, 4.2vw, 1.22rem);
  margin-bottom: 6px;
}

[data-screen="dragon"] .boss-hp {
  margin-bottom: 4px;
}

.date-buttons .btn--yes {
  max-width: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 2;
}

.date-buttons .btn--no {
  z-index: 6;
}

.dragon-win .dragon-cutout {
  animation: fadeInUp 0.5s ease;
}

.tavern-panel .menu-list {
  margin-top: 8px;
}

.menu-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  padding: 12px;
  margin-bottom: 8px;
  border: 2px solid rgba(107, 45, 58, 0.2);
  border-radius: var(--radius);
  background: rgba(252, 245, 232, 0.96);
  color: var(--ink);
  text-align: left;
}

.tavern-panel .menu-item em {
  color: var(--ink-soft);
}

.menu-item--on {
  border-color: var(--gold);
}

.menu-item strong { display: block; font-family: var(--font-display); font-size: 0.85rem; }
.menu-item em { font-size: 0.85rem; opacity: 0.85; }

[data-screen="potion"] .title {
  color: #f4e8d0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
}

.cauldron-stage {
  position: relative;
  height: 0;
  margin: 0 0 8px;
  pointer-events: none;
}

.cauldron-glow {
  position: absolute;
  left: 50%;
  top: -18px;
  width: 38%;
  height: 22px;
  transform: translateX(-50%);
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(
    ellipse at center,
    color-mix(in srgb, var(--glow-color, #5ec4b8) 85%, white) 0%,
    color-mix(in srgb, var(--glow-color, #5ec4b8) 40%, transparent) 55%,
    transparent 72%
  );
  box-shadow:
    0 0 18px color-mix(in srgb, var(--glow-color, #5ec4b8) 70%, transparent),
    0 0 36px color-mix(in srgb, var(--glow-color, #5ec4b8) 35%, transparent);
  animation: cauldronBubble 2.8s ease-in-out infinite;
}

@keyframes cauldronBubble {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.92; }
  50% { transform: translateX(-50%) scale(1.06); opacity: 1; }
}

.potion-ing {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: var(--radius);
  border: 2px solid rgba(107, 45, 58, 0.3);
  background: rgba(252, 245, 232, 0.94);
  font-family: var(--font-body);
  color: var(--ink);
}

.potion-ing strong {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--burgundy-deep);
}

.potion-ing--on {
  border-color: var(--burgundy);
  background: rgba(255, 252, 245, 0.98);
}

.potion-ing em {
  display: block;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-family: "Crimson Pro", serif;
}

.vial-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vial {
  padding: 10px 12px;
  border-radius: 99px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  background: linear-gradient(180deg, #fff, var(--vial-color, #ccc));
  font-size: 0.8rem;
}

.vial--on {
  box-shadow: 0 0 12px var(--vial-color);
}

.sky-dial {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius);
  border: 2px solid rgba(107, 45, 58, 0.35);
  background: rgba(252, 245, 232, 0.95);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  border-radius: var(--radius);
  font-family: var(--font-body);
  margin-bottom: 12px;
}

.tarot-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.tarot-card {
  width: 100px;
  height: 150px;
  padding: 0;
  border: none;
  background: none;
  perspective: 800px;
  cursor: pointer;
}

.tarot-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.7s ease;
}

.tarot-card.flipped .tarot-inner {
  transform: rotateY(180deg);
}

.tarot-inner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  backface-visibility: hidden;
}

.tarot-face {
  transform: rotateY(180deg);
}

.tarot-label {
  position: absolute;
  bottom: 8%;
  left: 5%;
  right: 5%;
  text-align: center;
  font-family: "Cinzel", serif;
  font-size: 0.55rem;
  color: #4a1f28;
  transform: rotateY(180deg);
  backface-visibility: hidden;
  z-index: 2;
}

.letter-body {
  font-family: "Dancing Script", cursive;
  font-size: 1.15rem;
  line-height: 1.5;
  white-space: pre-wrap;
  min-height: 120px;
}

body[data-screen="steed"] .dialogue-box {
  top: auto;
  bottom: calc(108px + env(safe-area-inset-bottom, 0px));
  max-height: min(26vh, 168px);
}

body[data-screen="rating"] #dialogueBox {
  display: none !important;
}

body[data-screen="steed"] .dialogue-panel {
  max-height: 120px;
  overflow-y: auto;
}

.dialogue-box {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 10px;
  z-index: 30;
  background: linear-gradient(180deg, #2b1d14, #3a281b);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--parchment);
  box-shadow: var(--shadow);
}

.dialogue-box.hidden {
  display: none;
}

.dialogue-portrait {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
  background: var(--parchment);
}

.dialogue-panel {
  flex: 1;
  font-size: 0.95rem;
}

.dialogue-name {
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: var(--gold-light);
  margin-bottom: 4px;
}

.dialogue-hint {
  font-size: 0.7rem;
  opacity: 0.7;
}

.achievement-wrap {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 78px);
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(340px, calc(100% - 24px));
  z-index: 25;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.achievement-toast {
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(244, 232, 208, 0.97);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 6px 12px;
  margin: 0;
  animation: toastIn 0.35s ease;
  color: var(--ink);
  font-size: 0.72rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  min-height: 32px;
}

.achievement-toast .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.achievement-toast__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.achievement-toast--out {
  opacity: 0;
  transform: translateY(-8px);
  transition: 0.3s ease;
}

@keyframes toastIn {
  from { transform: translateY(-6px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

[data-screen="oracle"] .title {
  color: #f4e8d0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
}

[data-screen="oracle"] .sub {
  color: #e8d4a8;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}

[data-screen="stars"] #btnCoin {
  color: var(--burgundy-deep);
  background: rgba(252, 245, 232, 0.96);
  border: 2px solid rgba(107, 45, 58, 0.45);
  text-shadow: none;
  margin: 8px 0 12px;
}

#ratingChips .chip-select {
  font-size: 0.8rem;
}

.screen__inner .title,
.screen__inner .kicker {
  scroll-margin-top: calc(env(safe-area-inset-top, 0px) + 68px);
}

.map-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.map-overlay--open {
  display: flex;
}

.map-overlay img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius);
}

.particle-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.decree-wrap .ticket.decree {
  padding-right: 72px;
  padding-bottom: 28px;
}

.wax-stamp-anim {
  position: absolute;
  right: 12px;
  bottom: 8px;
  width: 56px;
  pointer-events: none;
  opacity: 0;
  transform: scale(1.6);
  transition: 0.4s ease;
}

.wax-stamp-anim.stamped {
  opacity: 1;
  transform: scale(1);
}

.title.light {
  color: var(--parchment);
}

.hidden {
  display: none !important;
}

.wobble {
  animation: wiggleSeal 0.4s ease;
}

.icon {
  color: var(--gold-light);
  flex-shrink: 0;
}

:root {
  --sky-phase: 0;
}

body {
  --sky-tint: calc(var(--sky-phase, 0) * 1);
}
