:root {
  color-scheme: dark;
  --ink: #151714;
  --paper: #f7ecdb;
  --soft: #c9c1b1;
  --muted: #a49d8e;
  --edge: #393c33;
  --card: #20231e;
  --gold: #f0ba77;
  --green: #b8cc9f;
  font:
    15px/1.45 "DM Sans",
    system-ui,
    sans-serif;
  background: var(--ink);
  color: var(--paper);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: radial-gradient(ellipse at 42% 0%, #242920 0%, transparent 66%);
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button:disabled {
  opacity: 0.6;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 2px solid #ffd38e;
  outline-offset: 3px;
}
button:not(:disabled):active {
  transform: translateY(1px);
}
[hidden] {
  display: none !important;
}
a {
  color: inherit;
}

.shell {
  width: min(1340px, calc(100% - 88px));
  margin-inline: auto;
}
.topbar {
  border-bottom: 1px solid #34372c;
  background: #181b16d9;
}
.topbar-inner {
  min-height: 65px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  color: var(--soft);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 650;
}
.back:hover,
.credits a:hover {
  color: var(--gold);
}
.back span {
  font-size: 1.1rem;
}
.music {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: #352d21;
  border: 1px solid #6b573c;
  border-radius: 30px;
  padding: 0 13px;
  font-size: 0.85rem;
  font-weight: 700;
}
.music-note {
  color: var(--gold);
  font-size: 1.15rem;
}
.music-indicator {
  width: 7px;
  height: 7px;
  background: #726d61;
  border-radius: 100%;
  margin-left: 4px;
}
.music[aria-pressed="true"] {
  border-color: #8d7653;
}
.music[aria-pressed="true"] .music-indicator {
  background: var(--green);
  box-shadow: 0 0 9px #c6ec9499;
}
.music:hover {
  background: #53422e;
}
.audio-error {
  color: var(--gold);
  margin: 12px 0;
  font-size: 0.88rem;
}

.intro {
  margin: 29px 0 23px;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.71rem;
  font-weight: 750;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}
.flower {
  font-size: 1.15rem;
  line-height: 1;
}
h1 {
  font:
    500 clamp(3.15rem, 6vw, 5.5rem)/0.99 "Instrument Serif",
    Georgia,
    serif;
  letter-spacing: -0.063em;
  margin: 0;
}
h1 em {
  font-weight: 400;
  color: var(--gold);
  font-size: 0.74em;
  margin-left: 0.05em;
}
.intro > p:last-child {
  color: var(--soft);
  margin: 10px 0 0;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(292px, 27vw, 335px);
  gap: 18px;
  align-items: start;
}
.stage {
  height: clamp(515px, 63vh, 680px);
  isolation: isolate;
  position: relative;
  overflow: hidden;
  border-radius: 17px;
  border: 1px solid #515342;
  background: #23423f url("./kampung.jpg") center center / cover;
  box-shadow: 0 13px 35px #0b0e0b73;
}
.stage::before,
.stage::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
}
.stage::before {
  background: radial-gradient(
    ellipse at 50% 50%,
    transparent 44%,
    #10150f61 100%
  );
  z-index: -1;
}
.stage::after {
  background: linear-gradient(
    #10181070,
    transparent 20%,
    transparent 78%,
    #11140ed9
  );
  z-index: 1;
}
#scene {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
  cursor: grab;
  position: relative;
}
#scene:active {
  cursor: grabbing;
}
#scene:focus-visible {
  outline-offset: -4px;
}
.stage-top,
.stage-bottom {
  position: absolute;
  inset-inline: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  z-index: 2;
  pointer-events: none;
}
.stage-top {
  top: 15px;
}
.stage-bottom {
  bottom: 14px;
}
.stage-top button,
.stage-bottom button {
  pointer-events: auto;
}
.pose,
.camera,
.variants {
  border: 1px solid #f4d7a840;
  background: #171c16e0;
  box-shadow: 0 2px 9px #0002;
  border-radius: 50px;
}
.pose {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  font-size: 0.72rem;
  font-weight: 700;
}
.pose span {
  width: 7px;
  height: 7px;
  border-radius: 100%;
  background: #cce3a7;
  box-shadow: 0 0 8px #cce3a77f;
}
.camera {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
}
.camera:hover,
.variants button:hover {
  background: #3a4131;
}
.variants {
  display: flex;
  padding: 3px;
}
.variants button {
  border: 1px solid transparent;
  border-radius: 30px;
  min-height: 38px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--soft);
  font-size: 0.75rem;
  font-weight: 700;
}
.variants button[aria-pressed="true"] {
  background: #f6e5bf29;
  color: var(--paper);
  border-color: #f6e5bf33;
}
.variants i {
  width: 10px;
  height: 10px;
  display: block;
  background: #df6a54;
  border-radius: 50%;
}
.variants [data-variant="white"] i {
  background: #f9edce;
}
.hint {
  font-size: 0.72rem;
  color: #f3e5cd;
  text-shadow: 0 2px 4px #000;
  text-align: right;
}

.controls {
  display: grid;
  gap: 12px;
}
.card {
  padding: 15px 17px;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 15px;
}
.card h2 {
  font:
    500 1.45rem/1.13 "Instrument Serif",
    Georgia,
    serif;
  letter-spacing: -0.035em;
  margin: 0 0 12px;
}
.move-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.action {
  min-height: 48px;
  border: 1px solid #4a4d42;
  border-radius: 9px;
  background: #292e26;
  font-weight: 720;
}
.action > span:first-child {
  margin-right: 4px;
  font-size: 0.86em;
}
.action:hover {
  background: #3a4232;
}
.action.primary {
  background: var(--gold);
  color: #2b2014;
  border-color: var(--gold);
}
.action.primary:hover {
  background: #ffd299;
}
.action[aria-pressed="true"] {
  box-shadow: inset 0 0 0 2px var(--gold);
}
.action.primary[aria-pressed="true"] {
  box-shadow: inset 0 0 0 2px #71512d;
}

.costume {
  padding-bottom: 12px;
}
.costume h2 {
  margin-bottom: 8px;
}
.costume button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  background: transparent;
  text-align: left;
  border: 0;
  border-radius: 8px;
  padding: 8px 3px;
}
.costume button + button {
  border-top: 1px solid #3a3c33;
}
.costume button:hover {
  background: #31372c;
}
.costume-icon {
  display: grid;
  place-items: center;
  flex: 0 0 35px;
  height: 35px;
  border-radius: 8px;
  background: #35352a;
  color: var(--gold);
  font-size: 1.2rem;
}
.costume-label {
  flex: 1;
  display: grid;
  gap: 2px;
}
.costume-label strong {
  font-size: 0.83rem;
}
.costume-label small {
  font-size: 0.73rem;
  color: var(--soft);
}
.costume-arrow {
  color: var(--gold);
  font-size: 1.1rem;
  padding-right: 5px;
}

.mission-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.mission-title h2 {
  margin-bottom: 8px;
}
.mission-title span {
  font-size: 0.75rem;
  font-weight: 750;
  color: var(--gold);
}
progress {
  width: 100%;
  height: 5px;
  appearance: none;
  border: 0;
  border-radius: 20px;
  display: block;
  background: #393c32;
  accent-color: var(--gold);
}
progress::-webkit-progress-bar {
  background: #393c32;
  border-radius: 20px;
}
progress::-webkit-progress-value {
  background: var(--gold);
  border-radius: 20px;
  transition: width 0.25s;
}
progress::-moz-progress-bar {
  background: var(--gold);
  border-radius: 20px;
}
.mission ul {
  list-style: none;
  padding: 0;
  margin: 11px 0 0;
  display: grid;
  gap: 7px;
}
.mission li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.79rem;
  color: var(--soft);
}
.mission li > span {
  border-radius: 50%;
  border: 1px solid #6c6f60;
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
}
.mission li.done {
  color: #d1e5ba;
}
.mission li.done > span {
  color: #21291b;
  background: var(--green);
  border-color: var(--green);
}
.mission li.done > span::after {
  content: "✓";
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}
#won {
  font-size: 0.8rem;
  font-weight: 700;
  margin: 11px 0 0;
  color: var(--gold);
}

.credits {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 7px 18px;
  color: var(--muted);
  font-size: 0.73rem;
  padding: 15px 0 25px;
}
.credits a {
  text-underline-offset: 2px;
}
.error {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
  background: #151714eb;
}
.error h2 {
  font:
    1.9rem/1.1 "Instrument Serif",
    Georgia,
    serif;
}
.error a {
  color: var(--gold);
}

@media (max-width: 940px) {
  .shell {
    width: calc(100% - 40px);
  }
}
@media (max-width: 760px) {
  .shell {
    width: calc(100% - 26px);
  }
  .topbar-inner {
    min-height: 54px;
  }
  .intro {
    margin: 18px 0 15px;
  }
  .intro > p:last-child {
    font-size: 0.85rem;
    margin-top: 7px;
  }
  .layout {
    grid-template-columns: 1fr;
    gap: 11px;
  }
  .stage {
    height: clamp(319px, 48svh, 505px);
    border-radius: 13px;
  }
  .stage-top,
  .stage-bottom {
    inset-inline: 9px;
  }
  .stage-top {
    top: 9px;
  }
  .stage-bottom {
    bottom: 8px;
  }
  .controls {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }
  .mission {
    grid-column: 1/-1;
  }
  .mission ul {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 480px) {
  .controls {
    grid-template-columns: 1fr;
  }
  .costume {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 8px;
  }
  .costume h2 {
    grid-column: 1/-1;
  }
  .costume button {
    gap: 6px;
    align-items: center;
    padding: 5px 3px;
  }
  .costume button + button {
    border-top: 0;
  }
  .costume-arrow {
    display: none;
  }
  .costume-label strong {
    font-size: 0.74rem;
  }
  .costume-icon {
    flex-basis: 28px;
    height: 30px;
  }
  .card {
    padding: 11px 12px;
  }
  .card h2 {
    margin-bottom: 8px;
    font-size: 1.3rem;
  }
  .credits {
    flex-direction: column;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
