@import url("https://fonts.googleapis.com/css2?family=Zilla+Slab:wght@400;600;700;800&display=swap");

:root {
  color-scheme: light;
  --sky: #ffe7c5;
  --sky-deep: #ffcf9c;
  --field: #8ccf7a;
  --field-deep: #5aa86a;
  --ink: #1c1a17;
  --muted: #5d5348;
  --accent: #e2553f;
  --accent-2: #1d8b7c;
  --accent-3: #2b5b86;
  --card: #fffaf2;
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Zilla Slab", "Trebuchet MS", "Avenir Next", "Futura", serif;
  background: radial-gradient(circle at top, #fff4e6 0%, #f4dcc4 45%, #e8cbb2 100%);
  color: var(--ink);
  font-size: clamp(13px, 2.6vw, 16px);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

body.prod {
  background: transparent;
  padding: 0;
  min-height: auto;
  display: block;
}

body.prod .stage {
  margin: 0 auto;
  width: min(100vw, 640px, calc(100vh * 2 / 3));
}

body.prod canvas {
  box-shadow: none;
  border-radius: 0;
  background: transparent;
}


button {
  background: var(--accent);
  border: none;
  color: white;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
}

button:hover {
  background: #d44d38;
}

.icon-button {
  width: 46px;
  height: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 36px;
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.25);
  color: #fff9f0;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(6px);
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.35);
}


button.ghost {
  background: transparent;
  color: var(--accent-3);
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: none;
}

button.ghost:hover {
  background: rgba(43, 91, 134, 0.08);
}

button.danger {
  background: #e24337;
}

button.danger:hover {
  background: #cb3b30;
}

.stage {
  position: relative;
  width: min(90vw, 640px, calc(82vh * 2 / 3));
}

canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  max-height: 82vh;
  display: block;
  touch-action: none;
  border-radius: 26px;
  background: #b3b1af;
  box-shadow: var(--shadow);
}

.status {
  position: absolute;
  left: 20px;
  bottom: 18px;
  background: rgba(255, 255, 255, 0.8);
  padding: clamp(6px, 1.8vw, 10px) clamp(8px, 2.2vw, 14px);
  border-radius: 14px;
  font-weight: 600;
  color: var(--accent-3);
  font-size: clamp(0.7rem, 2.2vw, 0.95rem);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.lives {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: clamp(6px, 1.6vw, 10px);
  align-items: center;
}

.life-bag {
  width: clamp(18px, 4vw, 24px);
  height: clamp(18px, 4vw, 24px);
  display: grid;
  place-items: center;
  box-shadow: none;
  border: none;
  border-radius: 0;
}

.life-bag svg {
  width: 100%;
  height: 100%;
  display: block;
}

.life-bag svg path {
  fill: #e24337;
}

.life-bag.lost {
  opacity: 0.25;
  filter: grayscale(0.6);
}

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(12, 12, 16, 0.55);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.screen.show {
  opacity: 1;
  pointer-events: auto;
}

.screen-card {
  background: var(--card);
  border-radius: 18px;
  padding: 22px;
  width: min(88vw, 420px);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: grid;
  gap: 12px;
  text-align: center;
}

.screen-card h2 {
  font-size: 1.6rem;
}

.screen-card p {
  color: var(--muted);
}

.screen-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(18, 14, 10, 0.45);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.modal.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--card);
  border-radius: 18px;
  padding: 20px 22px;
  width: min(90vw, 420px);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: grid;
  gap: 12px;
}

.modal-card h3 {
  font-size: 1.3rem;
}

.modal-card p {
  color: var(--muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.test-controls {
  margin-top: 18px;
  width: min(90vw, 640px);
  background: var(--card);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: grid;
  gap: 12px;
}

.test-header {
  display: grid;
  gap: 4px;
}

.test-header h3 {
  font-size: 1.1rem;
}

.test-header p {
  color: var(--muted);
  font-size: 0.9rem;
}

.test-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 10px;
  align-items: center;
}

.test-row label {
  font-weight: 700;
  color: var(--accent-3);
  font-size: 0.9rem;
}

.test-row input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  padding: 8px 10px;
  font-weight: 600;
  color: var(--ink);
  background: #fffdf9;
}

.test-row-buttons {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.test-row-buttons button {
  width: 100%;
}

@media (max-width: 720px) {


  .stage {
    width: min(92vw, 520px, calc(70vh * 2 / 3));
  }

  .status {
    position: static;
    margin-top: 12px;
    font-size: 0.85rem;
    padding: 8px 10px;
  }

  .lives {
    gap: 6px;
    bottom: 50px;
  }

  .life-bag {
    width: 20px;
    height: 20px;
  }

  button {
    padding: 8px 14px;
  }

  .screen-card {
    padding: 18px;
    width: min(92vw, 360px);
  }

  .screen-card h2 {
    font-size: 1.3rem;
  }

  .modal-card {
    padding: 18px;
    width: min(92vw, 360px);
  }

  .test-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}
