@import url("https://fonts.googleapis.com/css2?family=Aref+Ruqaa:wght@400;700&family=Noto+Sans+Arabic:wght@400;500;600;700&display=swap");

:root {
  color-scheme: dark;
  --ink: #102f37;
  --deep: #071f28;
  --gold: #e4b96a;
  --sand: #f4e3bf;
  --teal: #73cfc5;
  --muted: #a5b9b6;
  --line: rgba(228, 185, 106, 0.26);
  font-family: "Noto Sans Arabic", Tahoma, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--deep);
  color: var(--sand);
  overflow: hidden;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.55;
}
button:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 5px;
}
button[hidden],
[hidden] {
  display: none !important;
}
#game {
  width: 100%;
  height: 100svh;
  min-height: 360px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(7, 31, 40, 0.65),
    transparent 25%,
    transparent 70%,
    rgba(7, 31, 40, 0.65)
  );
}
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 26px 38px;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: space-between;
  z-index: 4;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--gold);
  text-decoration: none;
  direction: ltr;
}
.brand img {
  width: 44px;
  height: 58px;
  object-fit: contain;
}
.loadout {
  border: 0;
  padding: 0;
  margin: 14px 0;
}
.loadout legend {
  color: var(--teal);
  font-size: 10px;
  padding: 0 0 8px;
}
.blessings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.blessings label {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 5px;
  text-align: center;
  border: 1px solid var(--line);
  cursor: pointer;
  background: #0c2b34d9;
  transition:
    border-color 0.2s,
    background 0.2s;
}
.blessings label:has(input:checked) {
  border-color: var(--gold);
  background: #54452cdb;
}
.blessings label:has(input:focus-visible) {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}
.blessings input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.blessings strong {
  font-size: 10px;
  font-weight: 600;
  color: var(--sand);
}
.blessings small {
  font-size: 8px;
  color: var(--muted);
}
.panel .records {
  color: var(--gold);
  font-size: 10px;
  margin: 9px 0 15px;
}
.run-status {
  position: absolute;
  top: 124px;
  left: 38px;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-inline-start: 2px solid var(--gold);
  background: #08222dcc;
  color: var(--sand);
  font-size: 10px;
  z-index: 4;
  pointer-events: none;
}
.run-status span:last-child {
  color: var(--muted);
  font-size: 9px;
}
@media (max-width: 560px) {
  .brand img {
    width: 36px;
    height: 44px;
  }
  .loadout {
    margin: 9px 0;
  }
  .loadout legend {
    padding-bottom: 5px;
    font-size: 9px;
  }
  .blessings label {
    padding: 7px 3px;
    gap: 3px;
  }
  .blessings strong {
    font-size: 9px;
  }
  .blessings small {
    font-size: 7px;
  }
  .panel .records {
    font-size: 8px;
    margin: 7px 0 10px;
  }
  .run-status {
    top: 178px;
    left: 20px;
    max-width: 230px;
    font-size: 9px;
    padding: 6px 9px;
  }
  .run-status span:last-child {
    font-size: 8px;
  }
  #game .toast {
    top: 238px;
    font-size: 10px;
  }
  #game[data-mode="ready"] .panel {
    bottom: 36px;
  }
  #game[data-mode="ready"] h1 {
    font-size: 48px;
    margin: 10px 0;
  }
  #game[data-mode="ready"] .brief {
    margin: 9px 0;
    padding: 7px 0;
  }
  #game[data-mode="ready"] #panel-description {
    margin: 8px 0;
    line-height: 1.85;
    font-size: 11px;
  }
  #game[data-mode="ready"] .bottom-note {
    display: none;
  }
}
.brand > span:first-child {
  font-family: "Segoe UI Historic", serif;
  font-size: 47px;
  line-height: 1;
}
.brand > span:last-child {
  font-family: Georgia, serif;
  font-size: 21px;
  letter-spacing: 6px;
}
.brand small {
  display: block;
  font:
    8px/2.3 Arial,
    sans-serif;
  letter-spacing: 2.1px;
  color: var(--muted);
}
.tools {
  display: flex;
  gap: 9px;
}
.icon-button {
  width: 43px;
  height: 43px;
  border: 1px solid var(--line);
  color: var(--sand);
  background: rgba(7, 31, 40, 0.6);
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  transition:
    background 0.2s,
    transform 0.2s;
}
.icon-button:hover {
  background: var(--ink);
  transform: translateY(-2px);
}
.panel {
  position: absolute;
  right: 7%;
  top: 50%;
  transform: translateY(-50%);
  width: 360px;
  z-index: 3;
  padding: 18px 0;
}
.panel::before {
  content: "";
  position: absolute;
  inset: -110px -180px -100px -90px;
  background: radial-gradient(
    ellipse at 65% 50%,
    rgba(7, 31, 40, 0.98) 16%,
    rgba(7, 31, 40, 0.8) 40%,
    transparent 70%
  );
  z-index: -1;
  pointer-events: none;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--teal);
  font-size: 11px;
  letter-spacing: 0.5px;
}
.eyebrow > span:first-child {
  width: 22px;
  height: 1px;
  background: var(--teal);
}
h1 {
  font:
    700 clamp(62px, 6.5vw, 92px) / 1.05 "Aref Ruqaa",
    Georgia,
    serif;
  margin: 18px 0 20px;
}
h1 em {
  color: var(--gold);
  font-style: normal;
}
.panel p {
  font-size: 13px;
  line-height: 2.15;
  max-width: 330px;
  color: #c0cfca;
  margin: 18px 0;
}
.brief {
  display: flex;
  gap: 23px;
  margin: 18px 0;
  padding: 17px 0;
  border-block: 1px solid var(--line);
  font-size: 10px;
  color: var(--muted);
}
.brief span {
  display: flex;
  align-items: center;
  gap: 7px;
}
.brief strong {
  font-size: 23px;
  font-weight: 500;
  color: var(--sand);
}
.primary {
  width: 100%;
  min-height: 57px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 23px;
  color: #172c2c;
  background: var(--gold);
  border: 1px solid #ffe1a3;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 5px 27px #071f2870;
  transition:
    transform 0.18s,
    background 0.18s;
}
.primary:hover:not(:disabled) {
  background: #f3cc87;
  transform: translateY(-2px);
}
.primary:active:not(:disabled) {
  transform: translateY(1px);
}
.primary > span:last-child {
  font-size: 25px;
  font-weight: 400;
}
.secondary {
  width: 100%;
  min-height: 45px;
  margin-top: 10px;
  color: var(--sand);
  background: transparent;
  border: 1px solid var(--line);
}
.panel .load-status {
  font-size: 10px;
  margin: 7px 0;
  color: var(--teal);
  min-height: 21px;
}
.instructions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  font-size: 10px;
  color: var(--muted);
}
.instructions > div {
  display: flex;
  align-items: center;
  gap: 12px;
}
kbd {
  font:
    9px/1.5 Arial,
    sans-serif;
  padding: 5px 7px;
  border: 1px solid #6d88844d;
  border-bottom-width: 2px;
  border-radius: 3px;
  color: var(--sand);
  background: #11303a;
  min-width: 23px;
  text-align: center;
}
.key-group {
  display: flex;
  gap: 3px;
}
.instructions .touch-instruction {
  display: none;
  font-size: 11px;
  margin: 0;
}
.bottom-note {
  position: absolute;
  bottom: 25px;
  left: 38px;
  right: 38px;
  display: flex;
  gap: 11px;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
  pointer-events: none;
}
.bottom-note > span:first-child {
  color: var(--gold);
  font:
    24px "Segoe UI Historic",
    serif;
}
.prototype {
  margin-right: auto;
  font-size: 9px;
  letter-spacing: 0.6px;
}
.hud {
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 26px;
  border: 1px solid var(--line);
  background: #08222dd9;
  padding: 11px 23px;
  backdrop-filter: blur(10px);
  z-index: 5;
}
.hud-label {
  display: block;
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 6px;
  white-space: nowrap;
}
.time-status {
  min-width: 62px;
  text-align: center;
  border-inline: 1px solid var(--line);
  padding-inline: 22px;
}
.time-status strong {
  font:
    23px Georgia,
    serif;
  font-variant-numeric: tabular-nums;
}
.time-status strong.urgent {
  color: #ff9986;
}
.health-status strong {
  color: #eeac82;
  font:
    16px/1.5 Georgia,
    serif;
  letter-spacing: 3px;
  white-space: nowrap;
}
.gem-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  max-width: 132px;
  align-items: center;
  min-height: 26px;
}
.gem {
  width: 11px;
  height: 15px;
  background: #35535a;
  border: 1px solid #52706f;
  clip-path: polygon(50% 0, 100% 30%, 80% 85%, 50% 100%, 20% 85%, 0 30%);
  transition: background 0.3s;
}
.gem.collected {
  background: var(--gold);
  border-color: #ffe4a8;
}
.toast {
  position: absolute;
  top: 120px;
  left: 50%;
  transform: translate(-50%, -10px);
  border: 1px solid var(--line);
  padding: 9px 20px;
  background: #102f37e8;
  color: var(--sand);
  font-size: 12px;
  opacity: 0;
  transition:
    opacity 0.2s,
    transform 0.2s;
  pointer-events: none;
  z-index: 6;
  white-space: nowrap;
}
.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.play-controls {
  position: absolute;
  inset: auto 40px 38px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  direction: ltr;
  pointer-events: none;
  z-index: 5;
}
#joystick {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 1px solid #e4b96a50;
  background: #102f375c;
  position: relative;
  touch-action: none;
  pointer-events: auto;
  user-select: none;
}
.joystick-axis::before,
.joystick-axis::after {
  content: "";
  position: absolute;
  background: #e4b96a33;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.joystick-axis::before {
  width: 80%;
  height: 1px;
}
.joystick-axis::after {
  height: 80%;
  width: 1px;
}
#stick {
  position: absolute;
  width: 52px;
  height: 52px;
  left: calc(50% - 26px);
  top: calc(50% - 26px);
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d7b16b, #6a552f);
  box-shadow: 0 3px 18px #0005;
  pointer-events: none;
}
.dash-group {
  text-align: center;
  pointer-events: auto;
}
#dash {
  width: 77px;
  height: 77px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: #133943d9;
  color: var(--gold);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
}
#dash > span {
  font:
    30px Georgia,
    serif;
  line-height: 1.1;
}
#dash small {
  font-size: 10px;
}
#dash:disabled {
  cursor: default;
}
#dash-status {
  font-size: 10px;
  color: var(--sand);
  display: block;
  margin-top: 8px;
}
#minimap {
  position: absolute;
  width: 112px;
  height: 112px;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  background: #08222dd9;
  display: block;
}
.campaign {
  display: flex;
  list-style: none;
  gap: 12px;
  padding: 0;
  margin: 14px 0;
  color: var(--muted);
  font-size: 9px;
}
.campaign li {
  flex: 1;
  border-top: 2px solid var(--line);
  padding-top: 8px;
}
.campaign [aria-current] {
  color: var(--gold);
  border-color: var(--gold);
}
.campaign .complete {
  color: var(--teal);
  border-color: var(--teal);
}
.stage-status {
  min-width: 64px;
  text-align: center;
}
.stage-status strong {
  font-size: 18px;
  color: var(--gold);
}
.score-label {
  position: absolute;
  left: 50%;
  bottom: 120px;
  transform: translateX(-50%);
  text-align: center;
  font-size: 10px;
  color: var(--sand);
  white-space: nowrap;
}
.score-label strong {
  color: var(--gold);
  margin-inline: 6px;
}
.score-label small {
  display: block;
  font-size: 8px;
  color: var(--muted);
}
.toast {
  max-width: calc(100% - 36px);
  white-space: normal;
  text-align: center;
}
@media (max-width: 560px) {
  #minimap {
    display: block;
    width: 76px;
    height: 76px;
  }
  .score-label {
    bottom: 84px;
  }
  .score-label small {
    display: none;
  }
  .campaign {
    margin: 14px 0;
    gap: 8px;
    font-size: 8px;
  }
  .stage-status {
    position: absolute;
    top: calc(100% + 7px);
    right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #08222dd9;
    padding: 4px 10px;
  }
  .stage-status .hud-label {
    margin: 0;
  }
  .stage-status strong {
    font-size: 12px;
  }
  .hud .gem-row {
    max-width: 108px;
    gap: 3px;
  }
  .hud .gem {
    width: 8px;
  }
  .panel h1 {
    font-size: clamp(42px, 14vw, 65px);
  }
  .hud .time-status {
    padding-inline: 10px;
  }
  .hud .health-status strong {
    font-size: 14px;
    letter-spacing: 1px;
  }
  .hud {
    gap: 9px;
  }
}
#hit-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 180px #d13d3980;
  opacity: 0;
  z-index: 9;
}
#hit-flash.active {
  animation: hit 0.5s ease-out;
}
@keyframes hit {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
#game[data-mode="playing"] .bottom-note,
#game[data-mode="paused"] .bottom-note {
  display: none;
}
#game[data-mode="paused"] .panel,
#game[data-mode="won"] .panel,
#game[data-mode="lost"] .panel {
  right: 50%;
  transform: translate(50%, -50%);
  background: #092832f2;
  border: 1px solid var(--line);
  padding: 30px;
  width: min(420px, 90vw);
  text-align: center;
}
#game[data-mode="paused"] .panel::before,
#game[data-mode="won"] .panel::before,
#game[data-mode="lost"] .panel::before {
  display: none;
}
#game:not([data-mode="ready"]) h1 {
  font-size: 58px;
  margin: 20px 0;
}
#game:not([data-mode="ready"]) .eyebrow {
  justify-content: center;
}
.no-script {
  position: absolute;
  inset: 35% 15%;
  background: var(--ink);
  padding: 30px;
  z-index: 20;
}
@media (pointer: fine) {
  #joystick {
    display: none;
  }
  .play-controls {
    justify-content: flex-end;
  }
}
@media (max-width: 800px) {
  .topbar {
    padding: 19px 20px;
  }
  .brand > span:first-child {
    font-size: 36px;
  }
  .brand > span:last-child {
    font-size: 16px;
    letter-spacing: 4px;
  }
  .brand small {
    font-size: 7px;
    letter-spacing: 1.5px;
  }
  .panel {
    right: 7%;
    width: 310px;
  }
  .hud {
    top: 84px;
    width: calc(100% - 40px);
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
  }
  .toast {
    top: 168px;
  }
  .bottom-note {
    left: 20px;
    right: 20px;
    bottom: 18px;
  }
  .play-controls {
    bottom: max(25px, env(safe-area-inset-bottom));
    left: 24px;
    right: 24px;
  }
}
@media (min-width: 801px) and (max-width: 1100px) {
  .hud {
    top: 90px;
  }
  .toast {
    top: 184px;
  }
}
@media (max-width: 560px) {
  .panel {
    top: auto;
    bottom: 65px;
    right: 24px;
    width: calc(100% - 48px);
    transform: none;
    padding: 15px 0;
  }
  .panel::before {
    inset: -130px -70px -100px;
    background: linear-gradient(0deg, #071f28 15%, #071f28ed 67%, transparent);
  }
  h1 {
    font-size: 65px;
    margin: 18px 0;
  }
  h1 br {
    display: none;
  }
  h1 em {
    margin-right: 15px;
  }
  .panel p {
    font-size: 12px;
    max-width: none;
    margin: 12px 0;
  }
  .brief {
    margin: 14px 0;
    padding: 11px 0;
    justify-content: space-between;
  }
  .instructions > div {
    display: none;
  }
  .instructions .touch-instruction {
    display: block;
  }
  .instructions {
    margin-top: 10px;
  }
  .panel .load-status {
    margin: 3px 0;
  }
  .eyebrow {
    font-size: 9px;
  }
  .prototype {
    font-size: 8px;
  }
  #game[data-mode="paused"] .panel,
  #game[data-mode="won"] .panel,
  #game[data-mode="lost"] .panel {
    top: 50%;
    bottom: auto;
  }
  .hud {
    top: 80px;
  }
  .time-status {
    padding-inline: 13px;
  }
  .gem-row {
    gap: 6px;
  }
  .gem {
    width: 9px;
  }
  .hud-label {
    font-size: 8px;
  }
}
@media (max-height: 800px) and (min-width: 561px) {
  .panel {
    width: 310px;
    top: 51%;
    padding: 0;
  }
  h1 {
    font-size: 58px;
    margin: 12px 0;
  }
  h1 br {
    display: none;
  }
  h1 em {
    margin-right: 12px;
  }
  .brief {
    margin: 10px 0;
    padding: 8px 0;
  }
  .panel p {
    font-size: 11px;
    margin: 10px 0;
  }
  .instructions {
    margin-top: 8px;
    display: flex;
    gap: 10px;
    font-size: 8px;
  }
  .topbar {
    padding: 15px 25px;
  }
  .hud {
    top: 15px;
  }
  .bottom-note {
    bottom: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
