
:root {
  --bg: #0b0c0f;
  --surface: #13151a;
  --text: #e6e7ea;
  --muted: #a9adba;
  --primary: #7c5cff;
  --ring: rgba(124, 92, 255, 0.6);
  --danger: #ef4444;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);

  --border-surface: rgba(255, 255, 255, 0.06);
  --border-soft: rgba(255, 255, 255, 0.08);
  --panel-grad: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.02),
      rgba(0, 0, 0, 0.08)
    );
}
[data-theme="auto"] {
  color-scheme: light dark;
}
@media (prefers-color-scheme: light) {
  [data-theme="auto"] {
    --bg: #f6f7fb;
    --surface: #fff;
    --text: #111216;
    --muted: #555a66;
    --primary: #6b46ff;
    --ring: rgba(107, 70, 255, 0.5);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);

    --border-surface: rgba(0, 0, 0, 0.06);
    --border-soft: rgba(0, 0, 0, 0.08);
    --panel-grad: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.02),
      rgba(0, 0, 0, 0.04)
    );
  }
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #fff;
  --text: #111216;
  --muted: #555a66;
  --primary: #6b46ff;
  --ring: rgba(107, 70, 255, 0.5);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);

  --border-surface: rgba(0, 0, 0, 0.06);
  --border-soft: rgba(0, 0, 0, 0.08);
  --panel-grad: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.02),
    rgba(0, 0, 0, 0.04)
  );
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0c0f;
  --surface: #13151a;
  --text: #e6e7ea;
  --muted: #a9adba;
  --primary: #7c5cff;
  --ring: rgba(124, 92, 255, 0.6);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);

  --border-surface: rgba(255, 255, 255, 0.06);
  --border-soft: rgba(255, 255, 255, 0.08);
  --panel-grad: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(0, 0, 0, 0.08)
  );
}

/* Reset simple */
* {
  box-sizing: border-box;
}
html,
body {
  height: 100svh;
  overflow: hidden;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu,
    "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(
      1000px 600px at 80% -10%,
      rgba(124, 92, 255, 0.12),
      transparent 60%
    ),
    var(--bg);
  color: var(--text);
}


.wrap {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}


.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.6rem clamp(0.8rem, 2vw, 1.2rem);
}
.brand {
  font-weight: 700;
  line-height: 1.2;
}
.muted {
  color: var(--muted);
  font-size: 0.95rem;
}
.toolbar {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}


button {
  appearance: none;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.2s ease;
  border-color: rgba(255, 255, 255, 0.1);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.1;
}
button:hover {
  transform: translateY(-1px);
}
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--ring);
}
.btn-ghost {
  background: transparent;
}
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
}


.card {
  width: min(92vw, 72rem);
  margin: 0 auto;
  padding: clamp(0.9rem, 2vw, 1.4rem);
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-surface);


  display: grid;
  grid-template-rows: auto 1fr;
  row-gap: 1rem;

  min-height: clamp(36rem, calc(100svh - 8rem), 52rem);
  max-height: calc(100svh - 4rem);
  overflow: hidden;
}


.card-head .title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}
.subtitle {
  margin: 0.25rem 0 0.75rem;
  line-height: 1.4;
  font-size: 0.95rem;
  max-width: 60ch;
  color: var(--muted);
}
.hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.pill {
  background: var(--panel-grad);
  border: 1px solid var(--border-soft);
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  font-size: 0.9rem;
  line-height: 1.2;
  color: var(--text);
}
.pill b {
  font-weight: 700;
  margin-left: 0.25rem;
}


.play-zone {

  min-height: 0;
  overflow: auto;
  display: grid;
  justify-items: center;
  align-content: start;
  row-gap: 1rem;
  padding-bottom: 1rem;
}


.board-wrapper {
  position: relative;
  width: 100%;
  max-width: 700px;
  aspect-ratio: 4 / 3; 
  border-radius: 12px;
  background: var(--panel-grad);
  border: 1px solid var(--border-soft);
  box-shadow: inset 0 0 20px rgba(0,0,0,.4);
  overflow: hidden;

  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated; 
}

.announce {
  pointer-events: none;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1rem;
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 600;
  color: var(--text);
  text-shadow: 0 2px 6px rgba(0,0,0,.8);
  line-height: 1.4;
  opacity: 1;
}

.touch-pad {
  display: grid;
  gap: 0.75rem;
  place-items: center;
  color: var(--text);
}

.pad-up {
  grid-column: 1;
}

.pad-row {
  display: grid;
  grid-template-columns: repeat(3, 3rem);
  grid-template-rows: 3rem;
  gap: 0.5rem;
  place-items: center;
}

.pad-btn {
  width: 3rem;
  height: 3rem;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.15);
  background: radial-gradient(circle at 30% 30%, #2a2a2f 0%, #111 70%);
  box-shadow:
    0 12px 24px rgba(0,0,0,.6),
    0 2px 2px rgba(255,255,255,.08) inset;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.pad-btn:active {
  background: radial-gradient(circle at 30% 30%, #3a3a40 0%, #1a1a1f 70%);
  box-shadow:
    0 6px 12px rgba(0,0,0,.8),
    0 1px 1px rgba(255,255,255,.1) inset;
  transform: scale(.96);
  transition: transform .05s;
}

.site-footer {
  text-align: center;
  padding: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

@media (max-width: 700px) {
  .card {
    width: min(94vw, 48rem);
    min-height: clamp(34rem, calc(100svh - 7rem), 48rem);
    max-height: calc(100svh - 4rem);
  }

  .pad-row {
    grid-template-columns: repeat(3, 3.5rem);
    grid-template-rows: 3.5rem;
  }
  .pad-btn {
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.1rem;
  }
}

@media (min-width: 1200px) {
  /* .touch-pad { display: none; } */
}



