:root {
  --ink: #12091f;
  --night: #1d0f32;
  --night2: #341a54;
  --panel: #32204f;
  --panel2: #4a2b6d;
  --edge: rgba(255, 220, 139, 0.42);
  --gold: #ffc848;
  --gold2: #fff0b3;
  --parchment: #fff4d3;
  --text: #fff9ed;
  --dim: #ccbce0;
  --good: #72e3ad;
  --bad: #ff8f86;
  --coral: #ff756a;
  --r: 20px;
}

html,
body {
  background: #0c0615;
}

body {
  background-image:
    radial-gradient(circle at 10% 8%, rgba(117, 57, 166, 0.25), transparent 28%),
    radial-gradient(circle at 88% 14%, rgba(255, 184, 46, 0.12), transparent 24%);
}

button:focus-visible {
  outline: 3px solid #fff5bd;
  outline-offset: 2px;
}

#app {
  inset: 0 auto 0 50%;
  width: min(100vw, 540px);
  transform: translateX(-50%);
  background:
    radial-gradient(110% 62% at 50% -4%, #553075 0%, #24123b 55%, #10081c 100%);
}

@media (min-width: 600px) {
  #app {
    border-right: 1px solid rgba(255, 214, 115, 0.22);
    border-left: 1px solid rgba(255, 214, 115, 0.22);
    box-shadow: 0 0 70px rgba(0, 0, 0, 0.72);
  }
}

/* Resource ledger */
#hud {
  min-height: 53px;
  gap: 6px;
  padding: 7px 9px 6px;
  background: linear-gradient(180deg, rgba(20, 9, 35, 0.96), rgba(20, 9, 35, 0.58));
  position: relative;
  z-index: 12;
}

#hud:after {
  content: '';
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 210, 94, 0.55), transparent);
}

.hudpill {
  gap: 5px;
  min-height: 38px;
  padding: 5px 10px 5px 5px;
  background: linear-gradient(180deg, rgba(63, 36, 91, 0.95), rgba(28, 14, 47, 0.96));
  border: 1px solid rgba(255, 220, 139, 0.48);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.11), 0 5px 16px rgba(0, 0, 0, 0.27);
}

.hudpill .ic {
  width: 26px;
  height: 26px;
  flex-basis: 26px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}

.hudpill b {
  font-size: 15px;
  font-weight: 700;
}

#hudRight {
  padding-right: 7px;
}

#hudMid {
  min-width: 92px;
  gap: 3px;
}

#hudVillage {
  max-width: 38vw;
  color: var(--parchment);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.05;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

#hudVillage.back {
  max-width: none;
  padding: 6px 10px;
  color: #402407;
  border: 1px solid #fff0a2;
  border-radius: 99px;
  background: linear-gradient(180deg, #ffe477, #eba722);
  box-shadow: inset 0 1px #fff9ca, 0 3px 9px rgba(0, 0, 0, 0.3);
  font-family: 'Fredoka', sans-serif;
  font-size: 10.5px;
  text-shadow: none;
}

#hudShields {
  gap: 4px;
}

#hudShields .sh {
  width: 10px;
  height: 12px;
  border-radius: 4px 4px 7px 7px;
  transform: perspective(16px) rotateX(-5deg);
}

#hudShields .sh.on {
  background: linear-gradient(135deg, #d9f4ff, #348be8 55%, #244da8);
  border-color: #e4f8ff;
  box-shadow: 0 0 8px rgba(82, 174, 255, 0.85);
}

#hudTimer {
  font-size: 10px;
}

#hudPet.on {
  width: 30px;
  height: 30px;
  margin-left: 1px;
}

/* Painted village stage */
#scr-village {
  padding: 0;
}

.scene,
#vScene {
  min-height: 230px;
  margin: 0 8px;
  border: 2px solid rgba(255, 214, 115, 0.62);
  border-radius: 24px;
  background: #241333;
  box-shadow:
    inset 0 0 0 1px rgba(67, 28, 82, 0.8),
    inset 0 -28px 40px rgba(8, 3, 14, 0.16),
    0 10px 24px rgba(0, 0, 0, 0.42);
}

.bg .bgimg {
  object-position: 50% 50%;
  filter: saturate(1.05) contrast(1.02);
}

.scenewash {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(10, 4, 18, 0.32), transparent 21%, transparent 72%, rgba(10, 4, 18, 0.22)),
    radial-gradient(85% 65% at 50% 62%, transparent 55%, rgba(12, 5, 20, 0.16));
}

.villageplate {
  position: absolute;
  z-index: 5;
  top: 10px;
  left: 10px;
  width: min(59%, 230px);
  padding: 8px 11px 7px;
  color: #3a210e;
  text-align: left;
  border: 1px solid rgba(255, 244, 205, 0.9);
  border-radius: 15px;
  background:
    linear-gradient(135deg, rgba(255, 248, 219, 0.96), rgba(241, 193, 92, 0.94));
  box-shadow: 0 5px 16px rgba(23, 7, 25, 0.35), inset 0 1px #fffce8;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 4px 8px;
}

.villageplate span:first-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.villageplate small {
  color: #754415;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.villageplate b {
  overflow: hidden;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 15px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.villageplate em {
  color: #764813;
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.coach {
  position: absolute;
  z-index: 7;
  top: 10px;
  right: 10px;
  display: none;
  max-width: 34%;
  padding: 7px 9px;
  pointer-events: none;
  flex-direction: column;
  color: #fff8dc;
  text-align: left;
  border: 1px solid rgba(255, 235, 159, 0.9);
  border-radius: 13px;
  background: linear-gradient(150deg, rgba(70, 37, 92, 0.96), rgba(28, 13, 43, 0.96));
  box-shadow: 0 5px 14px rgba(16, 5, 22, 0.42), inset 0 1px rgba(255, 255, 255, 0.1);
}

.coach.on {
  display: flex;
}

.coach b {
  color: #ffd45e;
  font-size: 8px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.coach span {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.15;
}

.vprogress {
  grid-column: 1 / -1;
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(85, 43, 10, 0.25);
  box-shadow: inset 0 1px 2px rgba(45, 20, 4, 0.2);
}

.vprogress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1aa56d, #6ce3a8);
  box-shadow: 0 0 8px rgba(59, 211, 143, 0.6);
  transition: width 0.35s ease;
}

.plots {
  z-index: 2;
}

.plot {
  z-index: 2;
  gap: 0;
  filter: drop-shadow(0 5px 5px rgba(27, 10, 19, 0.42));
}

.plot:nth-child(3),
.plot:nth-child(4),
.plot:nth-child(5) {
  z-index: 3;
}

.bldwrap {
  position: relative;
  width: 112%;
  margin-left: -6%;
  overflow: visible;
}

.bldstage {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.bldstage .generated {
  position: absolute;
  inset: 0;
  clip-path: inset(var(--build-cut) 0 0);
  object-fit: contain;
  object-position: 50% 100%;
  transform-origin: 50% 88%;
  transition: clip-path 0.25s ease, filter 0.25s ease, transform 0.25s ease;
}

.bldstage.level-1 .generated {
  transform: scale(0.82);
  filter: saturate(0.62) brightness(0.78);
}

.bldstage.level-2 .generated {
  transform: scale(0.88);
  filter: saturate(0.75) brightness(0.86);
}

.bldstage.level-3 .generated {
  transform: scale(0.94);
  filter: saturate(0.88) brightness(0.93);
}

.bldstage.level-4 .generated {
  transform: scale(0.98);
  filter: saturate(0.98);
}

.bldstage.level-5 .generated {
  filter: saturate(1.08) drop-shadow(0 0 5px rgba(255, 223, 113, 0.65));
}

.buildscaffold {
  position: absolute;
  inset: 8% 5% 3%;
  width: 90%;
  height: 89%;
  overflow: visible;
  fill: none;
  stroke: #8b5529;
  stroke-width: 4.5;
  stroke-linecap: round;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.42));
  opacity: 0.92;
}

.buildscaffold .rope {
  stroke: #e7b95f;
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

.buildspark {
  position: absolute;
  inset: 7%;
  pointer-events: none;
  border-radius: 50%;
  background:
    radial-gradient(circle at 18% 22%, #fff8c9 0 1.5%, transparent 2.4%),
    radial-gradient(circle at 82% 31%, #ffe16a 0 1.6%, transparent 2.6%),
    radial-gradient(circle at 67% 8%, #fff8c9 0 1.2%, transparent 2.1%);
  animation: glint 1.8s ease-in-out infinite alternate;
}

.buildmarks {
  position: absolute;
  right: 13%;
  bottom: 11%;
  display: flex;
  gap: 2px;
}

.buildmarks i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ffe36b;
  box-shadow: 0 0 5px rgba(255, 218, 79, 0.9);
}

.plot.level-0 .bldwrap {
  opacity: 0;
}

.plot.level-0:before {
  content: '+';
  position: absolute;
  top: 36%;
  left: 50%;
  z-index: 5;
  width: 30px;
  height: 30px;
  margin: -15px;
  color: rgba(255, 246, 207, 0.88);
  font-size: 25px;
  font-weight: 500;
  line-height: 27px;
  border: 2px dashed rgba(255, 245, 205, 0.72);
  border-radius: 50%;
  background: rgba(35, 18, 47, 0.25);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.plot.level-0.affordable:before {
  color: #432207;
  border-style: solid;
  border-color: #fff4b6;
  background: linear-gradient(180deg, #ffe878, #efa72a);
  box-shadow: 0 0 0 4px rgba(255, 206, 76, 0.24), 0 4px 10px rgba(46, 20, 3, 0.36);
}

.plotfoot {
  position: relative;
  z-index: 7;
  gap: 2px;
  margin-top: -13%;
}

.stars {
  gap: 2px;
  padding: 2px 5px;
  border-radius: 99px;
  background: rgba(20, 8, 29, 0.58);
}

.stars .st {
  width: 7px;
  height: 7px;
}

.stars .st.on {
  background: #ffd34d;
  box-shadow: 0 0 6px rgba(255, 210, 67, 0.95);
}

.tag {
  display: flex;
  min-height: 22px;
  align-items: center;
  gap: 3px;
  padding: 2px 7px 2px 4px;
  color: #fff4bb;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid rgba(255, 220, 132, 0.5);
  background: rgba(29, 13, 40, 0.84);
  box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
}

.tag i {
  display: block;
  width: 15px;
  height: 15px;
}

.tag.poor {
  opacity: 0.72;
}

.tag.done {
  padding-left: 7px;
  color: #d9ffea;
  border-color: rgba(111, 232, 169, 0.56);
  background: rgba(18, 80, 58, 0.82);
}

#vDone {
  position: static;
  flex: 0 0 auto;
  padding: 7px 11px 0;
}

#vDone .btn {
  min-height: 45px;
  box-shadow: 0 8px 20px rgba(35, 12, 36, 0.38);
}

@keyframes glint {
  from { opacity: 0.35; transform: scale(0.96); }
  to { opacity: 0.95; transform: scale(1.03); }
}

/* The gilded wishing wheel */
#slot {
  position: relative;
  z-index: 8;
  padding: 5px 9px 7px;
  background:
    linear-gradient(180deg, rgba(18, 8, 30, 0), rgba(18, 8, 30, 0.94) 14%, #100719 100%);
}

#wheelTop {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 5px;
  min-height: 37px;
  padding: 0 4px 5px;
}

#guideBtn {
  min-width: 38px;
  height: 28px;
  padding: 0 7px;
  color: #fff0b6;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid rgba(255, 222, 137, 0.45);
  border-radius: 99px;
  background: linear-gradient(180deg, #563271, #2d183f);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.1);
}

#guideBtn:active {
  transform: translateY(1px);
}

#wheelResult {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.05;
}

#wheelResult b {
  overflow: hidden;
  color: var(--parchment);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#wheelResult span {
  overflow: hidden;
  margin-top: 3px;
  color: var(--dim);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#wheelResult.win b {
  color: #ffe476;
}

#wheelResult.action b {
  color: #ff9b83;
}

#wheelResult.turning b {
  color: #e9dcff;
}

#multiplier {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(255, 221, 143, 0.28);
  border-radius: 99px;
  background: rgba(9, 4, 16, 0.52);
}

#multiplier button {
  min-width: 31px;
  height: 26px;
  padding: 0 7px;
  color: #bfaed7;
  font-size: 10.5px;
  font-weight: 700;
  border: 0;
  border-radius: 99px;
  background: transparent;
}

#multiplier button.on {
  color: #432609;
  background: linear-gradient(180deg, #ffe77c, #efad29);
  box-shadow: 0 2px 7px rgba(255, 183, 41, 0.32), inset 0 1px #fff9c9;
}

#multiplier button:disabled {
  opacity: 0.3;
}

#wheelCabinet {
  position: relative;
  padding: 8px 12px;
  border: 2px solid #f8cf6d;
  border-radius: 22px 22px 17px 17px;
  background:
    linear-gradient(135deg, #844528, #4f241f 35%, #8d4c2c 68%, #46201c),
    #5b2e22;
  box-shadow:
    inset 0 0 0 3px #b67531,
    inset 0 0 0 5px rgba(53, 19, 20, 0.8),
    0 9px 18px rgba(0, 0, 0, 0.5);
}

#wheelCabinet:before,
#wheelCabinet:after {
  content: '';
  position: absolute;
  z-index: 3;
  top: 12%;
  bottom: 12%;
  width: 5px;
  border-radius: 99px;
  background: linear-gradient(180deg, #fff0a6, #d68b18 45%, #ffe384);
  box-shadow: 0 0 8px rgba(255, 205, 82, 0.38);
}

#wheelCabinet:before { left: 5px; }
#wheelCabinet:after { right: 5px; }

.cabinetGem {
  position: absolute;
  z-index: 5;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 2px solid #ffd46d;
  transform: rotate(45deg);
  background: #53d4d0;
  box-shadow: 0 0 8px rgba(83, 226, 223, 0.75);
}

.cabinetGem.left { left: 1px; }
.cabinetGem.right { right: 1px; }

#reels {
  gap: 7px;
  padding: 5px;
  border: 1px solid rgba(255, 241, 193, 0.85);
  border-radius: 14px;
  background: linear-gradient(180deg, #170a24, #2b153e);
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.72), 0 1px rgba(255, 255, 255, 0.16);
}

.reel {
  border: 2px solid #dba942;
  border-radius: 10px;
  background:
    radial-gradient(90% 100% at 50% 40%, #fffaf0, #eedcae 72%, #c29d55);
  box-shadow: inset 0 0 12px rgba(77, 41, 15, 0.26);
}

.reel:after {
  border-radius: 8px;
  box-shadow:
    inset 0 13px 12px -10px rgba(52, 23, 15, 0.72),
    inset 0 -13px 12px -10px rgba(52, 23, 15, 0.72),
    inset 0 0 0 1px rgba(255, 255, 255, 0.52);
}

.face {
  padding: 7%;
}

.face img {
  filter: drop-shadow(0 4px 4px rgba(53, 25, 15, 0.28));
}

#spinRow {
  gap: 8px;
  padding: 8px 2px 1px;
}

#autoBtn {
  width: 62px;
  min-height: 58px;
  padding: 4px 5px;
  color: #d6c6e8;
  border: 1px solid rgba(255, 221, 144, 0.36);
  border-radius: 17px;
  background: linear-gradient(180deg, #43255d, #241331);
  box-shadow: 0 5px 0 #160a20, 0 8px 14px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-size: 10px;
  font-weight: 700;
}

#autoBtn .autoglyph {
  color: #e8dcf7;
  font-size: 24px;
  line-height: 22px;
}

#autoBtn.on {
  color: #3a2307;
  border-color: #fff0a0;
  background: linear-gradient(180deg, #ffe675, #eaa322);
  box-shadow: 0 5px 0 #9c620d, 0 8px 15px rgba(244, 165, 34, 0.28);
}

#autoBtn.on .autoglyph {
  color: #4b2d07;
  animation: autowheel 0.8s linear infinite;
}

#spinBtn {
  position: relative;
  min-height: 60px;
  overflow: hidden;
  border: 2px solid #fff1a3;
  border-radius: 19px;
  background:
    radial-gradient(circle at 50% 0, #fff399, transparent 47%),
    linear-gradient(180deg, #ffd85d, #efa51f);
  box-shadow:
    0 6px 0 #a7650a,
    0 11px 22px rgba(255, 172, 30, 0.3),
    inset 0 1px #fffbd5;
  color: #402407;
  text-shadow: 0 1px rgba(255, 255, 255, 0.4);
}

#spinBtn:before,
#spinBtn:after {
  content: '';
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  transform: rotate(45deg);
  background: rgba(121, 66, 8, 0.42);
}

#spinBtn:before { left: 16px; }
#spinBtn:after { right: 16px; }

#spinBtn .spinword {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1.6px;
}

#spinBtn .cost {
  padding: 3px 8px;
  border-radius: 99px;
  background: rgba(83, 45, 5, 0.2);
  font-size: 12px;
  font-weight: 700;
}

#spinBtn .cnt {
  display: none;
}

#spinBtn.teach {
  animation: teachspin 0.82s ease-in-out 4;
}

@keyframes teachspin {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.025); box-shadow: 0 8px 0 #a7650a, 0 0 28px rgba(255, 217, 88, 0.75), inset 0 1px #fffbd5; }
}

@keyframes autowheel {
  to { transform: rotate(360deg); }
}

/* Sequence screens */
#scr-attack,
#scr-raid {
  padding-bottom: 8px;
  background: linear-gradient(180deg, rgba(54, 27, 79, 0.66), rgba(18, 8, 29, 0.15));
}

.rivalbar {
  min-height: 58px;
  margin: 2px 10px 0;
  padding: 7px 9px;
  border: 1px solid rgba(255, 219, 133, 0.3);
  border-radius: 17px;
  background: linear-gradient(180deg, rgba(68, 38, 94, 0.92), rgba(38, 20, 57, 0.92));
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.25);
}

.rivalbar .avatar {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  border: 2px solid #f0c76e;
  background: #2b153c;
}

.rivalbar .who b {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 16px;
}

.powerchip {
  min-width: 31px;
  padding: 4px 7px;
  color: #3c2207;
  border-radius: 99px;
  background: linear-gradient(180deg, #ffe57a, #e8a324);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.hintline {
  margin: 5px 15px 7px;
  color: #e2d4ef;
  font-size: 12px;
}

.scene.atk,
.scene.raid {
  margin: 0 9px;
}

.hole {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: visible;
}

.hole .mound {
  width: 82%;
  height: 82%;
  margin-top: auto;
  object-fit: contain;
  object-position: 50% 100%;
  transform-origin: 50% 100%;
}

.hole .chest {
  width: 70%;
  height: 70%;
  margin-top: auto;
  object-fit: contain;
  object-position: 50% 100%;
  transform-origin: 50% 100%;
}

.hole.foundchest {
  filter: drop-shadow(0 0 10px rgba(255, 214, 86, 0.75));
  animation: chestpop 0.35s cubic-bezier(0.2, 1.5, 0.4, 1);
}

.seqfoot {
  gap: 7px;
  padding: 9px 14px 0;
}

.seqtotal {
  color: #fff0ae;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 17px;
}

.seqtotal small {
  display: block;
  margin-top: 3px;
  color: var(--dim);
  font-family: 'Fredoka', sans-serif;
  font-size: 11px;
}

@keyframes chestpop {
  from { transform: scale(0.6) rotate(-8deg); }
  to { transform: scale(1) rotate(0); }
}

/* Story pages */
.screen.scrolls {
  padding: 5px 13px 19px;
  background:
    radial-gradient(100% 55% at 50% 0, rgba(79, 42, 112, 0.5), transparent 70%),
    linear-gradient(180deg, #1b0d2c, #100719);
}

.pagehead {
  min-height: 48px;
  align-items: center;
  padding: 4px 2px 9px;
  background: linear-gradient(#1b0d2c 74%, rgba(27, 13, 44, 0));
}

.pagehead h2 {
  color: var(--parchment);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 23px;
  font-weight: 700;
}

.pagehead span {
  color: #d5c5e5;
}

.treasuryhero,
.companionhero,
.albumhero,
.roadhero,
.helpintro {
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 220, 138, 0.38);
  border-radius: 19px;
  background:
    radial-gradient(circle at 14% 0, rgba(255, 208, 91, 0.18), transparent 37%),
    linear-gradient(135deg, rgba(76, 41, 105, 0.96), rgba(37, 19, 55, 0.96));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28), inset 0 1px rgba(255, 255, 255, 0.08);
}

.treasuryhero,
.companionhero,
.albumhero {
  min-height: 116px;
  padding: 11px 13px;
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  gap: 10px;
}

.treasuryhero > span,
.companionhero > span {
  width: 96px;
  height: 96px;
  filter: drop-shadow(0 7px 7px rgba(0, 0, 0, 0.35));
}

.treasuryhero div,
.companionhero div,
.albumhero > div:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.treasuryhero small,
.companionhero small,
.albumhero small,
.roadhero small,
.petmeta small {
  color: #ffd76d;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}

.treasuryhero b,
.companionhero b,
.albumhero b,
.roadhero b,
.helpintro b {
  margin-top: 2px;
  color: #fff3cb;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 16px;
  line-height: 1.15;
}

.treasuryhero p,
.companionhero p,
.albumhero p,
.roadhero p,
.helpintro p {
  margin: 5px 0 0;
  color: #d1c0df;
  font-size: 11px;
  line-height: 1.35;
}

.chestlist {
  gap: 9px;
}

.chestcard {
  position: relative;
  min-height: 105px;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 220, 138, 0.34);
  border-radius: 18px;
  background:
    linear-gradient(110deg, rgba(76, 42, 102, 0.94), rgba(39, 20, 58, 0.94));
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.24), inset 0 1px rgba(255, 255, 255, 0.07);
}

.chestcard:after {
  content: '';
  position: absolute;
  inset: 5px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 13px;
}

.chestcard[data-poor] {
  opacity: 0.58;
}

.chestart {
  display: flex;
  align-items: flex-end;
  width: 88px;
  height: 88px;
  flex-basis: 88px;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.34));
}

.chestart > img {
  object-position: 50% 100%;
}

.chestmeta {
  gap: 1px;
}

.chestmeta small {
  color: #cdb8df;
  font-size: 9px;
  text-transform: uppercase;
}

.chestmeta b {
  color: #fff0c9;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 16px;
}

.chestmeta em {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}

.chestmeta em span {
  width: 17px;
  height: 17px;
}

.chestcard > strong {
  align-self: center;
  padding: 6px 8px;
  color: #3a2208;
  border-radius: 99px;
  background: linear-gradient(180deg, #ffe477, #eaa427);
  font-size: 10px;
}

.albumhero {
  grid-template-columns: 118px 1fr;
}

.cardfan {
  position: relative;
  width: 112px;
  height: 98px;
}

.cardfan span {
  position: absolute;
  top: 3px;
  left: 35px;
  display: block;
  width: 61px;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.32));
}

.cardfan span:first-child { left: 3px; transform: rotate(-13deg); }
.cardfan span:nth-child(2) { z-index: 2; left: 27px; transform: translateY(-3px); }
.cardfan span:nth-child(3) { left: 51px; transform: rotate(13deg); }
.cardfan svg,
.cardfan img { width: 100%; height: auto; }

.setlist {
  gap: 9px;
}

.setblock {
  border-color: rgba(255, 219, 132, 0.29);
  border-radius: 18px;
  background: linear-gradient(130deg, rgba(68, 36, 93, 0.88), rgba(35, 17, 53, 0.9));
  box-shadow: 0 5px 13px rgba(0, 0, 0, 0.2);
}

.setrow {
  min-height: 53px;
  padding: 12px 14px;
}

.setname {
  color: #fff1d1;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 16px;
}

.cardgrid {
  gap: 8px;
  padding: 0 10px 11px;
}

.cardslot svg,
.cardslot img {
  border-radius: 10px;
  box-shadow: 0 5px 9px rgba(0, 0, 0, 0.28);
}

.companionhero > span {
  transform: scale(1.08);
}

.petlist {
  gap: 9px;
}

.petcard {
  min-height: 114px;
  gap: 10px;
  padding: 9px 11px;
  border-color: rgba(255, 219, 132, 0.3);
  border-radius: 18px;
  background: linear-gradient(120deg, rgba(69, 39, 94, 0.92), rgba(36, 18, 54, 0.92));
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.22), inset 0 1px rgba(255, 255, 255, 0.06);
}

.petcard.awake {
  border-color: rgba(255, 216, 97, 0.72);
  box-shadow: 0 0 0 2px rgba(255, 196, 58, 0.12), 0 7px 18px rgba(0, 0, 0, 0.24);
}

.petcard.locked {
  opacity: 0.58;
}

.petart {
  display: flex;
  align-items: flex-end;
  width: 90px;
  height: 90px;
  flex-basis: 90px;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.3));
}

.petart > img {
  object-position: 50% 100%;
}

.petmeta b {
  color: #fff0cb;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 17px;
}

.petmeta i {
  color: #d3c4e1;
}

.roadhero {
  display: flex;
  min-height: 76px;
  flex: 0 0 auto;
  flex-direction: column;
  justify-content: center;
  padding: 14px 15px;
}

.maplist {
  padding: 0;
}

.maprow {
  min-height: 91px;
  margin-bottom: 8px;
  gap: 10px;
  padding: 8px 10px 8px 8px;
  border: 1px solid rgba(255, 220, 138, 0.25);
  border-radius: 17px;
  background: linear-gradient(110deg, rgba(67, 37, 92, 0.86), rgba(34, 17, 51, 0.9));
  box-shadow: 0 5px 13px rgba(0, 0, 0, 0.2);
}

.maprow:before {
  display: none;
}

.mapdot {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 4;
  width: 12px;
  height: 12px;
  flex-basis: 12px;
  border-width: 2px;
}

.mapthumb {
  position: relative;
  width: 70px;
  height: 70px;
  flex: 0 0 70px;
  overflow: hidden;
  border: 1px solid rgba(255, 232, 174, 0.52);
  border-radius: 13px;
  background: #241536;
}

.mapthumb > .bg {
  position: absolute;
  inset: 0;
}

.mapthumb .bgimg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 32%;
}

.mapthumb .sky,
.mapthumb .stars,
.mapthumb .moon,
.mapthumb .hills,
.mapthumb .ground,
.mapthumb .road {
  position: absolute;
}

.mapname {
  min-width: 0;
  flex: 1 1 auto;
}

.mapname b {
  color: #fff0cc;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 15px;
}

.maprow.ahead .mapname b {
  color: #c1afd2;
}

.maprow > em {
  padding: 4px 7px;
  color: #bfaed0;
  border-radius: 99px;
  background: rgba(13, 6, 22, 0.42);
  font-size: 8.5px;
  font-style: normal;
  font-weight: 700;
  text-transform: uppercase;
}

.maprow.here {
  border-color: rgba(255, 210, 76, 0.67);
}

.maprow.here > em {
  color: #402307;
  background: #ffd45b;
}

.maprow.ahead .mapthumb {
  filter: saturate(0.25) brightness(0.58);
}

.helpintro {
  padding: 14px 15px;
}

.helpwrap {
  gap: 9px;
}

.helprow {
  gap: 11px;
  padding: 10px;
  border: 1px solid rgba(255, 220, 138, 0.24);
  border-radius: 15px;
  background: rgba(61, 33, 84, 0.62);
}

.helpsym {
  width: 52px;
  height: 52px;
  flex-basis: 52px;
}

.helprow b {
  color: #fff0ce;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 15px;
}

/* Shared controls and chrome */
.btn {
  border-color: rgba(255, 219, 132, 0.35);
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(83, 48, 111, 0.96), rgba(47, 25, 69, 0.96));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08), 0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn.gold {
  border-color: #fff0a5;
  background: linear-gradient(180deg, #ffe071, #e9a321);
  box-shadow: inset 0 1px #fff9cb, 0 5px 12px rgba(240, 161, 28, 0.22);
}

#dock {
  min-height: 60px;
  padding: 4px 5px 2px;
  border-top: 1px solid rgba(255, 211, 99, 0.25);
  background:
    linear-gradient(180deg, rgba(28, 14, 43, 0.97), rgba(12, 6, 20, 0.99));
  box-shadow: 0 -6px 18px rgba(5, 2, 10, 0.28);
}

#dock button {
  position: relative;
  min-height: 53px;
  gap: 1px;
  padding: 5px 1px 3px;
  color: #bba8d0;
  font-size: 9.5px;
}

#dock button svg {
  width: 23px;
  height: 23px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}

#dock button.on {
  color: #ffd655;
}

#dock button.on:before {
  content: '';
  position: absolute;
  top: -5px;
  left: 30%;
  right: 30%;
  height: 3px;
  border-radius: 99px;
  background: #ffd655;
  box-shadow: 0 0 8px rgba(255, 204, 57, 0.75);
}

#toast {
  top: calc(env(safe-area-inset-top) + 58px);
  border-color: rgba(255, 220, 139, 0.48);
  background: rgba(25, 12, 38, 0.96);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

#modal {
  background: rgba(8, 3, 14, 0.78);
  backdrop-filter: blur(6px);
}

.sheet {
  border: 2px solid rgba(255, 220, 135, 0.65);
  border-radius: 24px;
  background:
    radial-gradient(85% 45% at 50% 0, rgba(130, 73, 168, 0.42), transparent 75%),
    linear-gradient(180deg, #3a2253, #21132f);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 26px 70px rgba(0, 0, 0, 0.68);
}

.sheetArt {
  width: 108px;
  height: 108px;
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.34));
}

.quickstart {
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: left;
}

.quickstep {
  display: grid;
  grid-template-columns: 31px 1fr;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border: 1px solid rgba(255, 222, 139, 0.24);
  border-radius: 13px;
  background: rgba(25, 11, 39, 0.54);
}

.quickstep > b {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: #422607;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffe77b, #e9a321);
  box-shadow: inset 0 1px #fff7c5;
}

.quickstep span {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.quickstep strong {
  color: #fff2cb;
  font-size: 12px;
}

.quickstep small {
  margin-top: 2px;
  color: #cdbdde;
  font-size: 10px;
  line-height: 1.25;
}

.sheet h2 {
  color: #fff1cb;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 23px;
}

.revealcard {
  width: 88px;
}

@media (max-height: 760px) {
  #hud { min-height: 47px; padding-top: 4px; }
  .hudpill { min-height: 34px; }
  .hudpill .ic { width: 23px; height: 23px; flex-basis: 23px; }
  #wheelTop { min-height: 31px; }
  #wheelResult span { display: none; }
  #wheelCabinet { padding-top: 6px; padding-bottom: 6px; }
  #spinRow { padding-top: 6px; }
  #spinBtn { min-height: 52px; }
  #autoBtn { min-height: 50px; }
  #dock { min-height: 54px; }
  #dock button { min-height: 48px; }
}

@media (max-height: 650px) {
  .scene, #vScene { min-height: 100px; }
  .villageplate { top: 6px; left: 6px; padding: 6px 8px; }
  .villageplate b { font-size: 13px; }
  .villageplate em { display: none; }
  #multiplier button { min-width: 28px; height: 23px; padding: 0 5px; }
  #wheelCabinet { padding: 5px 10px; }
  #slot { padding-top: 2px; }
  .stars { display: none; }
  .coach { top: 6px; right: 6px; padding: 5px 7px; }
}

@media (max-height: 540px) {
  #hud { min-height: 44px; }
  .scene, #vScene { min-height: 90px; }
  #wheelCabinet,
  #spinRow { width: min(100%, 430px); margin-right: auto; margin-left: auto; }
  #spinBtn { min-height: 48px; }
  #autoBtn { min-height: 46px; }
  #dock { min-height: 49px; }
  #dock button { min-height: 43px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
