/* Теона над Уфой: оформление страницы, сама игра рисуется на canvas */
:root {
  --bg: #1b1030;
  --ink: #fff4e6;
  --accent: #ff7a2f;
  --accent-2: #ffb347;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-user-select: none; user-select: none;
}
#game { display: block; width: 100vw; height: 100vh; height: 100dvh; cursor: crosshair; touch-action: none; -webkit-touch-callout: none; }
/* Невидимый блок с безопасными зонами iPad: игра читает их и отодвигает кнопки от выреза и индикатора «Домой» */
#safe { position: fixed; inset: 0; pointer-events: none; visibility: hidden; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.controls.touch { display: none; }
@media (pointer: coarse) { .controls.touch { display: grid; } .controls.kbd { display: none; } }

.overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(20, 10, 40, 0.72); backdrop-filter: blur(6px);
  z-index: 10;
}
.overlay.hidden { display: none; }
.card {
  width: min(92vw, 720px); max-height: 92vh; overflow: auto;
  background: linear-gradient(160deg, #2a1748, #1a0f30);
  border: 2px solid rgba(255, 180, 71, 0.35);
  border-radius: 20px; padding: 24px 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  text-align: center;
}
.card.small { width: min(92vw, 420px); }
.card img { width: 100%; border-radius: 14px; margin-bottom: 14px; display: block; }
h1 { margin: 0 0 6px; font-size: clamp(28px, 5vw, 44px); color: var(--accent-2); letter-spacing: .5px; }
h2 { margin: 0 0 6px; color: var(--accent-2); }
.sub { margin: 0 0 18px; opacity: .85; }
button {
  font: inherit; font-size: 20px; font-weight: 700;
  padding: 12px 36px; border: 0; border-radius: 999px;
  background: var(--accent); color: #fff; cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 122, 47, .4);
}
button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.controls {
  margin-top: 18px; text-align: left; font-size: 14px; line-height: 1.7; opacity: .9;
  display: grid; gap: 2px;
}
.controls b { color: var(--accent-2); }

button:disabled { opacity: .55; cursor: wait; box-shadow: none; transform: none; }

.progress { margin: 0 0 14px; color: var(--accent-2); font-weight: 700; font-size: 17px; }
.progress:empty { display: none; }

/* Родительский уголок: взрослый экран обычной вёрсткой поверх игры */
.card.parent { width: min(94vw, 900px); max-height: 92vh; text-align: left; touch-action: auto; font-size: 16px; line-height: 1.45; }
.card.parent h2 { text-align: center; }
.card.parent h3 { margin: 18px 0 8px; font-size: 17px; color: var(--accent-2); }
.card.parent .psec { border-top: 1px solid rgba(255, 180, 71, 0.2); padding-top: 6px; }
.card.parent .muted { opacity: .75; font-size: 14px; margin: 4px 0; }
.card.parent .row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin: 10px 0; }
.card.parent button { font-size: 16px; padding: 10px 22px; min-height: 44px; }
.card.parent button.ghost { background: rgba(255,255,255,.12); box-shadow: none; }
.card.parent button.danger { background: #c0453a; box-shadow: none; }
.card.parent input[type=text] { font: inherit; font-size: 28px; width: 140px; text-align: center; padding: 8px; border-radius: 12px; border: 2px solid rgba(255,180,71,.5); background: rgba(255,255,255,.08); color: var(--ink); display: block; margin: 8px auto; }
.card.parent input[type=range] { width: 100%; margin: 10px 0; }
.card.parent textarea { width: 100%; font: 12px/1.3 ui-monospace, Menlo, monospace; background: rgba(255,255,255,.08); color: var(--ink); border-radius: 10px; border: 1px solid rgba(255,180,71,.3); padding: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.1); font-size: 14px; min-height: 36px; }
.chip.ok { background: rgba(143,227,154,.18); } .chip.bad { background: rgba(255,107,138,.18); }
.chip input { width: 20px; height: 20px; }
table.log { width: 100%; border-collapse: collapse; font-size: 13px; }
table.log th, table.log td { padding: 4px 6px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.08); }
table.log tr.bad td { color: #ff9aae; }
button.linkish { background: none; box-shadow: none; color: rgba(255,244,230,.55); font-size: 13px; font-weight: 600; padding: 6px 10px; margin-top: 10px; }
button.parent-btn { display: block; margin: 14px auto 0; background: rgba(255,255,255,.12); box-shadow: none; font-size: 16px; padding: 10px 24px; }
button.linkish:hover { color: var(--accent-2); transform: none; filter: none; }
