/* FILE: styles.css */
:root {
  --bg: #0c0f12;
  --panel: rgba(255, 255, 255, 0.06);
  --panel2: rgba(255, 255, 255, 0.09);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.62);
  --line: rgba(255, 255, 255, 0.10);

  --good: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;

  --radius: 18px;
  --radius2: 24px;

  --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  --shadow2: 0 10px 26px rgba(0, 0, 0, 0.35);

  --safeT: env(safe-area-inset-top, 0px);
  --safeB: env(safe-area-inset-bottom, 0px);
  --safeL: env(safe-area-inset-left, 0px);
  --safeR: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  margin: 0;
  background: radial-gradient(1200px 600px at 50% 0%, rgba(52, 211, 153, 0.12), transparent 60%),
    radial-gradient(900px 500px at 0% 100%, rgba(251, 191, 36, 0.08), transparent 55%),
    radial-gradient(900px 500px at 100% 100%, rgba(251, 113, 133, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  overflow: hidden; /* no page scroll */
}

.app {
  min-height: 100%;
  padding: calc(10px + var(--safeT)) calc(10px + var(--safeR)) calc(10px + var(--safeB))
    calc(10px + var(--safeL));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.05));
  border-radius: var(--radius2);
  box-shadow: var(--shadow2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logoDot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.85), rgba(52, 211, 153, 0.95));
  box-shadow: 0 0 18px rgba(52, 211, 153, 0.45);
  flex: 0 0 auto;
}

.brandText {
  min-width: 0;
}

.title {
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: 16px;
  line-height: 1.1;
}

.subtitle {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud {
  display: flex;
  gap: 10px;
  align-items: center;
}

.hudItem {
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  min-width: 72px;
  text-align: center;
}

.hudLabel {
  font-size: 11px;
  color: var(--muted);
}

.hudValue {
  margin-top: 2px;
  font-weight: 800;
  font-size: 14px;
}

.actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.iconBtn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
}

.iconBtn:active {
  transform: translateY(1px);
}

.stage {
  flex: 1;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 10px;
  min-height: 0;
}

.gameShell {
  position: relative;
  height: 100%;
  border-radius: var(--radius2);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  box-shadow: var(--shadow);
  overflow: hidden;
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none; /* we handle swipe */
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: radial-gradient(900px 500px at 50% 0%, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.55));
}

.overlay[hidden] {
  display: none;
}

.overlayCard {
  width: min(520px, 96vw);
  border-radius: var(--radius2);
  border: 1px solid var(--line);
  background: rgba(15, 18, 22, 0.72);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  padding: 18px;
}

.overlayTitle {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.2px;
}

.overlayText {
  margin: 10px 0 14px 0;
  color: var(--muted);
  line-height: 1.35;
}

.overlayRow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primaryBtn,
.ghostBtn,
.pillBtn {
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  font-weight: 800;
  cursor: pointer;
  color: var(--text);
  background: var(--panel);
}

.primaryBtn {
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.34), rgba(52, 211, 153, 0.18));
  border-color: rgba(52, 211, 153, 0.35);
}

.primaryBtn:active,
.ghostBtn:active,
.pillBtn:active {
  transform: translateY(1px);
}

.overlayHints {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hintPill {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 10px;
  border-radius: 999px;
}

.controls {
  border-radius: var(--radius2);
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 10px;
  box-shadow: var(--shadow2);
}

.controlRow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: space-between;
}

.pillBtn {
  flex: 1 1 120px;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
}

.dpadWrap {
  margin-top: 10px;
  display: grid;
  place-items: center;
}

.dpad {
  width: 210px;
  height: 210px;
  position: relative;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.dpadBtn {
  position: absolute;
  width: 68px;
  height: 68px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
}

.dpadBtn.up {
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
}

.dpadBtn.down {
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
}

.dpadBtn.left {
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.dpadBtn.right {
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.dpadCenter {
  position: absolute;
  inset: 78px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
}

.fineprint {
  margin: 10px 2px 0 2px;
  font-size: 12px;
  color: var(--muted);
}

/* Modal */
.modal {
  width: min(560px, 94vw);
  border: none;
  border-radius: var(--radius2);
  padding: 0;
  background: rgba(15, 18, 22, 0.92);
  color: var(--text);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.modalInner {
  border: 1px solid var(--line);
  border-radius: var(--radius2);
  overflow: hidden;
}

.modalHeader {
  padding: 14px 14px 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.modalTitle {
  margin: 0;
  font-size: 16px;
}

.modalBody {
  padding: 14px;
  display: grid;
  gap: 14px;
}

.section h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
}

.muted {
  margin: 8px 0 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.segRow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.segBtn {
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-weight: 800;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.modalFooter {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  background: rgba(255, 255, 255, 0.05);
}

/* Desktop tweaks */
@media (min-width: 900px) {
  .hudItem {
    min-width: 86px;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .iconBtn:active,
  .primaryBtn:active,
  .ghostBtn:active,
  .pillBtn:active {
    transform: none;
  }
}

/* Optional high-contrast mode (we’ll toggle by adding .contrast on <body>) */
body.contrast {
  --panel: rgba(255, 255, 255, 0.10);
  --panel2: rgba(255, 255, 255, 0.14);
  --line: rgba(255, 255, 255, 0.16);
}
