/* Atahaddak V47 — visual-only theme. No game logic, points or audio changes.
   Colors approved on 2026-11-10: outer bronze #554735, card border #463D32,
   matte gold #C8A667, charcoal background, warm white text.
   The approved home illustration is deliberately untouched. */
:root {
  --hima-bg: #141414;
  --hima-panel: #201e1b;
  --hima-panel-raised: #28241f;
  --hima-frame: #554735;
  --hima-card-outline: #463d32;
  --hima-gold: #c8a667;
  --hima-gold-light: #e1c48a;
  --hima-text: #eae7e1;
  --hima-muted: #beb5a9;
  --hima-red: #c33332;
  --hima-green: #339861;
  font-family: "Noto Kufi Arabic", Tahoma, sans-serif;
}

/* Keep the exact approved home picture and interactive hotspot alignment.
   The frame is visual-only: pseudo-element consumes ZERO layout pixels. */
body.home-screen main {
  position: relative !important;
}
body.home-screen main::after {
  content: "" !important;
  position: absolute;
  inset: max(2px, env(safe-area-inset-top)) 2px max(2px, env(safe-area-inset-bottom));
  z-index: 30;
  pointer-events: none;
  border: 1px solid var(--hima-frame);
  border-radius: 15px;
  box-shadow: inset 0 0 0 1px #b3985822;
}

/* Mobile-first shell: safe areas and a narrow, centered readable column. */
body:not(.home-screen) {
  color: var(--hima-text) !important;
  background: radial-gradient(ellipse at 50% -12%, #322a1e 0%, transparent 46%),
    linear-gradient(180deg, #171615, #111111 70%) !important;
  overflow-x: clip;
}
body:not(.home-screen) main {
  width: 100% !important;
  max-width: 490px !important;
  min-width: 0;
  min-height: 100dvh;
  margin-inline: auto !important;
  padding: calc(env(safe-area-inset-top) + 12px) clamp(12px, 3.6vw, 18px)
    calc(env(safe-area-inset-bottom) + 26px) !important;
  border: 1px solid var(--hima-frame);
  border-radius: 0;
  background: linear-gradient(180deg, #191817 0%, #141414 76%) !important;
  overflow-x: clip;
  box-sizing: border-box;
}
body:not(.home-screen) #app {
  min-width: 0;
  width: 100%;
}
body:not(.home-screen) .top {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  min-width: 0;
  margin-bottom: 9px !important;
}
body:not(.home-screen) .brand {
  flex: 1;
  min-width: 0;
  text-align: center;
  color: var(--hima-gold-light) !important;
  font-size: clamp(17px, 4.8vw, 22px) !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
  text-shadow: none !important;
  background: none !important;
  -webkit-text-fill-color: var(--hima-gold-light) !important;
}
body:not(.home-screen) .top .circle {
  flex: 0 0 auto;
  border-color: var(--hima-frame) !important;
}

/* Cards, player chips, navigation: distinguish surface from background subtly. */
body:not(.home-screen) .card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 9px 0 !important;
  padding: 14px 13px !important;
  border: 1px solid var(--hima-card-outline) !important;
  border-radius: 16px !important;
  background: linear-gradient(160deg, #25211e, var(--hima-panel) 70%) !important;
  box-shadow: 0 10px 24px #00000038, inset 0 1px 0 #ffffff06 !important;
}
body:not(.home-screen) .card h2 {
  color: var(--hima-gold-light) !important;
  font-weight: 800 !important;
  font-size: clamp(17px, 4.5vw, 21px) !important;
  line-height: 1.5 !important;
  margin-bottom: 10px !important;
  overflow-wrap: anywhere;
}
body:not(.home-screen) .card h3 {
  color: var(--hima-gold-light) !important;
}
body:not(.home-screen) p,
body:not(.home-screen) label,
body:not(.home-screen) .player {
  overflow-wrap: anywhere;
}
body:not(.home-screen) p {
  line-height: 1.75 !important;
  margin-block: 7px 10px;
}
body:not(.home-screen) .muted,
body:not(.home-screen) small {
  color: var(--hima-muted) !important;
  line-height: 1.6 !important;
}
body:not(.home-screen) label {
  color: var(--hima-gold-light) !important;
  margin: 11px 0 5px !important;
  font-weight: 700 !important;
}
body:not(.home-screen) .player,
body:not(.home-screen) .player.v14-player-row {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-width: 0;
  margin: 7px 0 !important;
  padding: 9px 10px !important;
  border: 1px solid var(--hima-card-outline) !important;
  border-radius: 12px !important;
  background: #2a2621 !important;
  box-shadow: none !important;
}
body:not(.home-screen) .player.v14-player-row > b {
  min-width: 0;
  overflow-wrap: anywhere;
}
body:not(.home-screen) .v14-host,
body:not(.home-screen) .pill {
  border-color: var(--hima-frame) !important;
  background: #413526 !important;
  color: var(--hima-gold-light) !important;
}
body:not(.home-screen) .pill {
  border-radius: 100px !important;
  padding: 5px 10px !important;
  font-variant-numeric: tabular-nums;
}
body:not(.home-screen) .status {
  border: 1px solid #6a593c !important;
  color: #ebdfc6 !important;
  background: #2d281f !important;
  border-radius: 12px !important;
  padding: 10px 12px !important;
  margin: 9px 0 !important;
}
body:not(.home-screen) .status.warn,
body:not(.home-screen) .warn {
  border-color: #98714e !important;
  background-color: #352a22 !important;
}

/* Clickable controls: matte 3D with restraint, accurate focus + tap targets. */
body:not(.home-screen) .btn,
body:not(.home-screen) .choice {
  min-height: 46px !important;
  border-radius: 12px !important;
  font-family: inherit;
  font-weight: 800 !important;
  text-shadow: none !important;
  transition: transform .14s ease, box-shadow .14s ease,
    background-color .14s ease, border-color .14s ease !important;
  touch-action: manipulation;
}
body:not(.home-screen) .btn {
  width: 100%;
  padding: 10px 12px !important;
  margin: 7px 0 !important;
  line-height: 1.5 !important;
  font-size: clamp(14px, 3.6vw, 16px) !important;
  letter-spacing: 0 !important;
  white-space: normal !important;
}
body:not(.home-screen) .btn.gold,
body:not(.home-screen) .btn.blue,
body:not(.home-screen) .btn.purple {
  background: linear-gradient(180deg, #d7b77d, var(--hima-gold) 74%, #b59154) !important;
  color: #201911 !important;
  border: 1px solid #b7955e !important;
  box-shadow: inset 0 1px 0 #fff5dc38, 0 3px 0 #80633b, 0 7px 12px #00000045 !important;
}
body:not(.home-screen) .btn.ghost {
  color: var(--hima-text) !important;
  background: #27231f !important;
  border: 1px solid #705d45 !important;
  box-shadow: inset 0 1px 0 #ffffff0d, 0 2px 0 #16120d !important;
}
body:not(.home-screen) .btn.green {
  color: #f7f8f5 !important;
  border: 1px solid #39764b !important;
  background: linear-gradient(180deg, #408c5e, #256742) !important;
  box-shadow: 0 3px 0 #16472b, 0 7px 12px #00000040 !important;
}
body:not(.home-screen) .btn.red,
body:not(.home-screen) #onAccuse,
body:not(.home-screen) #v24submit {
  color: #fff5f3 !important;
  background: linear-gradient(180deg, #de4a43, #bd292b 76%, #9c2022) !important;
  border: 1px solid #b62e2e !important;
  box-shadow: inset 0 1px 0 #ffffff45, 0 4px 0 #70171a, 0 9px 16px #00000054 !important;
}
body:not(.home-screen) .btn:active:not(:disabled),
body:not(.home-screen) .choice:active:not(:disabled) {
  transform: translateY(2px) !important;
  box-shadow: 0 1px 0 #5a442d !important;
}
body:not(.home-screen) .btn:disabled {
  opacity: .58 !important;
  filter: saturate(.46);
  background: #332f28 !important;
  color: #a8a094 !important;
  border-color: var(--hima-frame) !important;
  box-shadow: none !important;
  cursor: not-allowed;
}
body:not(.home-screen) :is(button, input, select, textarea):focus-visible {
  outline: 2px solid #e7ce9c !important;
  outline-offset: 3px !important;
}
body:not(.home-screen) input:not([type='checkbox']),
body:not(.home-screen) select,
body:not(.home-screen) textarea {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  background: #191816 !important;
  color: var(--hima-text) !important;
  border: 1px solid #65543f !important;
  border-radius: 11px !important;
}
body:not(.home-screen) .choice {
  min-width: 68px;
  flex: 1 1 auto;
  padding: 8px 10px !important;
  background: #2d2822 !important;
  color: #e0d6c7 !important;
  border: 1px solid #67533c !important;
}
body:not(.home-screen) .choice.selected {
  background: #c8a667 !important;
  border-color: #d6b780 !important;
  color: #201a13 !important;
  box-shadow: inset 0 0 0 1px #fff4d833 !important;
}

/* Spy-only text remains visible ONLY to the spy, as enforced by app.js; CSS never reveals it. */
body:not(.home-screen) .mission {
  margin: 12px 0 !important;
  padding: 20px 14px !important;
  background: radial-gradient(ellipse at 50% 0%, #483824 0%, #28231d 72%) !important;
  border: 1px solid #957549 !important;
  border-radius: 17px !important;
  box-shadow: 0 8px 20px #00000035, inset 0 1px 0 #d9b87a17 !important;
  overflow-wrap: anywhere;
}
body:not(.home-screen) .mission h2 {
  color: #e6c58a !important;
  font-weight: 800 !important;
}
body:not(.home-screen) .mission strong {
  color: #fff1d2 !important;
  font-size: clamp(18px, 5vw, 22px) !important;
  line-height: 1.8 !important;
}
body:not(.home-screen) .timer {
  font-size: clamp(42px, 12vw, 66px) !important;
  color: #e6ca92 !important;
  text-shadow: 0 3px 0 #4e3920 !important;
  font-variant-numeric: tabular-nums;
}
body:not(.home-screen) .timer.urgent { color: #e88478 !important; }
body:not(.home-screen) .meter { background: #514737 !important; }
body:not(.home-screen) .meter > span { background: linear-gradient(90deg,#9d763e,#d5ae6d) !important; }

/* Coronation retains V33 fixed-fit hierarchy and actual winner image alignment. */
body:not(.home-screen) .hero.confetti.v25-stage {
  border-color: #987447 !important;
  background: radial-gradient(ellipse at 50% 25%, #4d3920, #191715 77%) !important;
}
body:not(.home-screen) .v33-winner .v23-winner-avatar {
  border-color: var(--hima-gold) !important;
  object-fit: cover !important;
  object-position: center !important;
}
body:not(.home-screen) .v33-rank-row {
  border-color: var(--hima-card-outline) !important;
  background: #29241eec !important;
  color: var(--hima-text) !important;
}
body:not(.home-screen) .v33-rank-row.v33-first {
  border-color: var(--hima-gold) !important;
  background: #453621 !important;
}
body:not(.home-screen) #v23-share {
  background: #c8a667 !important;
  color: #201911 !important;
  border-color: #e1c48a !important;
  box-shadow: 0 3px 0 #7b5f34 !important;
}
/* V33 ceremony is height-constrained. Never expand its elements beyond available viewport. */
body:not(.home-screen):has(.v33-winner) main {
  padding: max(5px, env(safe-area-inset-top)) 11px max(6px, env(safe-area-inset-bottom)) !important;
}
body:not(.home-screen):has(.v33-winner) .hero.confetti.v25-stage {
  padding: 5px 9px !important;
}
body:not(.home-screen):has(.v33-winner) #v23-share {
  min-height: 42px !important;
  height: 42px !important;
  margin: 0 !important;
  padding: 5px !important;
}

/* Do not alter any existing points-table typography, rows, columns or colors. */
@media (min-width: 520px) {
  body:not(.home-screen) main {
    margin-top: 12px !important;
    margin-bottom: 12px !important;
    min-height: calc(100dvh - 24px);
    border-radius: 20px;
    box-shadow: 0 20px 65px #00000055;
  }
  body.home-screen main::after { border-radius: 20px; }
}
@media (max-width: 390px) {
  body:not(.home-screen) main {
    padding-inline: 10px !important;
  }
  body:not(.home-screen) .card {
    padding: 11px 10px !important;
  }
  body:not(.home-screen) .player.v14-player-row {
    padding: 7px 8px !important;
    gap: 8px !important;
  }
  body:not(.home-screen) .mission {
    padding: 16px 11px !important;
  }
}
@media (max-width: 350px) {
  body:not(.home-screen) .brand { font-size: 16px !important; }
  body:not(.home-screen) .card { padding-inline: 8px !important; }
  body:not(.home-screen) .choice { min-width: 58px; }
}
@media (prefers-reduced-motion: reduce) {
  body:not(.home-screen) .btn, body:not(.home-screen) .choice {
    transition: none !important;
  }
}
