@font-face {
  font-family: "Vazirmatn";
  src: url("assets/fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazirmatn";
  src: url("assets/fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --cream: #fff6e2;
  --gold: #d9a441;
  --crimson: #c9302c;
  --ink: #2a1a10;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: #120b07;
  color: var(--cream);
  font-family: "Vazirmatn", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

#pixi-container {
  position: absolute;
  inset: 0;
}

#pixi-container canvas {
  display: block;
  touch-action: none;
}

/* UI layered over the canvas. Only its children take pointer input. */
#ui {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

#ui > * {
  pointer-events: auto;
}

/* Menu */

.menu {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #150d08;
  transition:
    opacity 0.5s ease,
    visibility 0.5s ease;
}

/* The map itself, blurred and dimmed, behind the title */
.menu::before {
  content: "";
  position: absolute;
  inset: -24px;
  background:
    linear-gradient(rgba(18, 11, 7, 0.68), rgba(18, 11, 7, 0.94)),
    url("assets/map/map.jpg") center / cover;
  filter: blur(6px);
}

.menu.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.menu-inner {
  position: relative;
  max-width: 620px;
  padding: 40px 28px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}

.menu h1 {
  margin: 0 0 14px;
  color: #f7dfa8;
  font-size: clamp(2.4rem, 8vw, 4rem);
  line-height: 1.2;
  text-shadow:
    0 4px 0 rgba(0, 0, 0, 0.45),
    0 0 48px rgba(217, 164, 65, 0.35);
}

.lead {
  margin: 0 auto 30px;
  max-width: 30em;
  color: rgba(255, 246, 226, 0.82);
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  line-height: 1.95;
}

.note {
  display: block;
  margin-top: 14px;
  min-height: 1.4em;
  color: rgba(255, 246, 226, 0.6);
  font-size: 0.9rem;
}

/* Buttons */

button {
  font-family: inherit;
}

.primary {
  border: 0;
  border-radius: 999px;
  padding: 14px 40px;
  cursor: pointer;
  background: linear-gradient(#c9302c, #8f1d1a);
  color: var(--cream);
  font-size: 1.1rem;
  font-weight: 700;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 10px 26px rgba(0, 0, 0, 0.4);
  transition:
    transform 0.15s ease,
    filter 0.15s ease,
    opacity 0.15s ease;
}

.primary:not(:disabled):hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.primary:not(:disabled):active {
  transform: translateY(1px) scale(0.99);
}

.primary:disabled {
  cursor: default;
  opacity: 0.55;
}

.primary:focus-visible,
.option:focus-visible,
.close:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

/* Question panel */

.panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: end center;
}

.panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 6, 4, 0.62);
  backdrop-filter: blur(2px);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(560px, 100%);
  max-height: min(82dvh, 760px);
  overflow-y: auto;
  padding: 26px 24px calc(24px + env(safe-area-inset-bottom));
  border: 1px solid rgba(217, 164, 65, 0.45);
  border-radius: 22px 22px 0 0;
  background: linear-gradient(180deg, #3a2416, #221407);
  box-shadow: 0 -12px 60px rgba(0, 0, 0, 0.55);
  animation: rise 0.28s ease both;
}

@keyframes rise {
  from {
    transform: translateY(28px);
    opacity: 0;
  }
}

@media (min-width: 640px) {
  .panel {
    place-items: center;
  }

  .card {
    border-radius: 22px;
    padding-bottom: 24px;
  }
}

.close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(217, 164, 65, 0.35);
  border-radius: 50%;
  background: rgba(255, 246, 226, 0.06);
  color: var(--cream);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.close:hover {
  background: rgba(255, 246, 226, 0.14);
}

.hint {
  margin: 0 8px 6px;
  color: var(--gold);
  font-size: 0.85rem;
}

.card h2 {
  margin: 0 4px 4px;
  color: #fff1d2;
  font-size: clamp(1.15rem, 2.6vw, 1.4rem);
  line-height: 1.85;
  font-weight: 700;
}

.options {
  display: grid;
  gap: 10px;
  margin: 18px 0 20px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  text-align: right;
  border: 1px solid rgba(217, 164, 65, 0.35);
  border-radius: 14px;
  background: rgba(255, 246, 226, 0.06);
  color: var(--cream);
  font-size: 1rem;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.option:hover:not(:disabled) {
  background: rgba(255, 246, 226, 0.12);
  border-color: rgba(217, 164, 65, 0.7);
}

.option[aria-pressed="true"] {
  background: rgba(217, 164, 65, 0.22);
  border-color: var(--gold);
}

.option:disabled {
  cursor: default;
  opacity: 0.6;
}

.option-number {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(217, 164, 65, 0.5);
  border-radius: 50%;
  background: rgba(217, 164, 65, 0.16);
  font-size: 0.95rem;
  font-weight: 700;
}

.status {
  margin: 0 4px 14px;
  color: #9fd8b4;
  font-size: 0.95rem;
}

.answers {
  display: grid;
  gap: 8px;
  margin: 18px 0 20px;
  padding: 0;
  max-height: 46dvh;
  overflow-y: auto;
  list-style: none;
}

.answers li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 164, 65, 0.22);
  border-radius: 12px;
  background: rgba(255, 246, 226, 0.06);
  font-size: 0.98rem;
}

.answers li.empty {
  justify-content: center;
  border-style: dashed;
  color: rgba(255, 246, 226, 0.6);
}

.answer-index {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(217, 164, 65, 0.45);
  border-radius: 50%;
  background: rgba(217, 164, 65, 0.16);
  font-size: 0.85rem;
  font-weight: 700;
}

.card .primary {
  align-self: flex-start;
}

/* Toast */

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  padding: 10px 20px;
  border: 1px solid rgba(217, 164, 65, 0.5);
  border-radius: 999px;
  background: rgba(42, 26, 16, 0.96);
  color: var(--cream);
  font-size: 0.92rem;
  opacity: 0;
  transform: translate(-50%, 16px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
