body {
  margin: 16px;
  font-family: system-ui, -apple-system, sans-serif;
}
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 800px at 30% 20%, rgba(59, 130, 246, 0.18), transparent 55%),
    radial-gradient(900px 650px at 70% 65%, rgba(249, 115, 22, 0.18), transparent 60%),
    rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.intro-overlay[hidden] {
  display: none;
}
.intro-card {
  width: min(720px, calc(100vw - 32px));
  padding: 22px 20px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.9));
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.45);
  color: #f8fafc;
  text-align: center;
}
.intro-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.intro-sub {
  margin-top: 10px;
  font-size: 0.98rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.85);
}
.intro-warning {
  margin-top: 14px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(127, 29, 29, 0.22);
  color: #fecaca;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.25;
  text-transform: uppercase;
}
.intro-consent {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}
.intro-consent__q {
  font-weight: 800;
  color: rgba(226, 232, 240, 0.92);
}
.intro-consent__row {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.intro-consent__btn {
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.08);
  color: #f8fafc;
  font-weight: 850;
  cursor: pointer;
}
.intro-consent__btn:hover {
  background: rgba(148, 163, 184, 0.14);
}
.intro-consent__btn--danger {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
}
.intro-consent__meta {
  margin-top: 10px;
  font-size: 0.92rem;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.78);
}
.intro-start {
  margin-top: 16px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.55);
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  overflow: hidden;
  min-width: 140px;
}
.intro-start:active {
  transform: translateY(1px);
}
.intro-explosion {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  opacity: 0;
  transform: scale(0.2);
  background: radial-gradient(circle, rgba(253, 224, 71, 1) 0%, rgba(249, 115, 22, 1) 55%, rgba(239, 68, 68, 0.9) 100%);
  filter: blur(0.2px);
}
.intro-start.intro-start--boom .intro-explosion {
  animation: introBoom 900ms ease-out forwards;
}
.intro-explosion--1 { left: 24%; top: 45%; }
.intro-explosion--2 { left: 52%; top: 35%; }
.intro-explosion--3 { left: 72%; top: 55%; }
@keyframes introBoom {
  0% { opacity: 0; transform: scale(0.2); }
  8% { opacity: 1; transform: scale(1.8); }
  45% { opacity: 0.9; transform: scale(3.8); }
  100% { opacity: 0; transform: scale(5.6); }
}
.play-layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 36px;
  max-width: fit-content;
}
.field-wrap {
  flex: 0 0 auto;
  padding: 8px;
  background: #0f172a;
  border-radius: 10px;
}
#canvas {
  border: 1px solid #1e40af;
  border-radius: 2px;
  display: block;
  background: #000080;
}
.side-green {
  width: 148px;
  min-height: 100%;
  align-self: stretch;
  padding: 10px;
  box-sizing: border-box;
  background: linear-gradient(180deg, #bbf7d0 0%, #4ade80 45%, #15803d 100%);
  border-radius: 12px;
  box-shadow:
    inset 2px 0 8px rgba(255, 255, 255, 0.25),
    0 4px 14px rgba(21, 128, 61, 0.25);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}
.side-green .side-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #14532d;
  text-align: center;
  margin-bottom: 8px;
  line-height: 1.2;
  max-width: 100%;
}
#greenCanvas {
  display: block;
  border-radius: 6px;
  border: 1px solid rgba(21, 128, 61, 0.45);
  background: transparent;
  flex: 0 0 auto;
}
.side-grey {
  width: 540px;
  max-width: 100%;
  min-height: 100%;
  align-self: stretch;
  padding: 10px;
  box-sizing: border-box;
  background: linear-gradient(180deg, #e2e8f0 0%, #94a3b8 42%, #475569 100%);
  border-radius: 12px;
  box-shadow:
    inset 0 2px 10px rgba(255, 255, 255, 0.35),
    0 6px 18px rgba(30, 41, 59, 0.35);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}
.side-grey.shake--light {
  animation: cameraShakeLight 420ms ease-in-out infinite;
}
.side-grey.shake--strong {
  animation: cameraShakeStrong 220ms ease-in-out infinite;
}
@keyframes cameraShakeLight {
  0% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(1px, -1px) rotate(-0.25deg); }
  50% { transform: translate(-1px, 1px) rotate(0.25deg); }
  75% { transform: translate(1px, 1px) rotate(0.15deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
@keyframes cameraShakeStrong {
  0% { transform: translate(0, 0) rotate(0deg); }
  20% { transform: translate(3px, -2px) rotate(-0.8deg); }
  40% { transform: translate(-3px, 2px) rotate(0.8deg); }
  60% { transform: translate(2px, 3px) rotate(-0.5deg); }
  80% { transform: translate(-2px, -3px) rotate(0.5deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
.side-grey .side-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #1e293b;
  text-align: center;
  margin-bottom: 8px;
  line-height: 1.2;
  max-width: 100%;
}
#greyCanvas {
  display: block;
  width: 100%;
  max-width: 520px;
  height: auto;
  border-radius: 8px;
  border: 1px solid rgba(30, 41, 59, 0.5);
  background: linear-gradient(180deg, #78716c 0%, #57534e 50%, #44403c 100%);
  flex: 0 0 auto;
}
@media (max-width: 620px) {
  .play-layout {
    flex-direction: column;
    gap: 20px;
  }
  .side-green {
    width: 100%;
    min-height: auto;
    padding: 12px;
  }
  #greenCanvas {
    margin: 0 auto;
  }
  .side-grey {
    width: 100%;
  }
  #greyCanvas {
    margin: 0 auto;
  }
}
.hud {
  display: flex;
  gap: 24px;
  align-items: baseline;
  margin-bottom: 10px;
  font-size: 1.05rem;
}
.hud-help {
  margin-left: 2px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
  font-weight: 900;
  cursor: pointer;
  line-height: 1;
}
.hud-help:hover {
  background: rgba(37, 99, 235, 0.14);
}
.hud strong {
  color: #2563eb;
  font-variant-numeric: tabular-nums;
  display: inline-block;
  min-width: 8ch;
  text-align: right;
}
.hud strong#coins {
  min-width: 11ch;
}
.hud .label {
  color: #64748b;
  font-size: 0.85rem;
}
.shop {
  margin: 12px 0 14px;
  padding: 12px 14px;
  max-width: 560px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.shop-layout {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
}
.codes-panel {
  margin: 12px 0 14px;
  padding: 12px 14px;
  width: 320px;
  max-width: 100%;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  color: #0f172a;
}
.codes-panel h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}
.codes-panel__section + .codes-panel__section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #e2e8f0;
}
.codes-panel h4 {
  margin: 0 0 8px;
  font-size: 0.9rem;
  font-weight: 800;
  color: #334155;
}
.codes-panel__list {
  margin: 0;
  padding-left: 18px;
  color: #334155;
  font-size: 0.92rem;
  line-height: 1.35;
}
.codes-panel__row {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.codes-panel__row input[type="text"] {
  padding: 8px 10px;
  font-size: 0.9rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  min-width: 160px;
}
.codes-panel__row button {
  padding: 8px 14px;
  font-size: 0.9rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
}
.codes-panel__row button:hover:not(:disabled) {
  background: #f1f5f9;
}
.codes-panel__row button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.codes-panel__meta {
  margin-top: 8px;
  color: #64748b;
  font-size: 0.88rem;
  font-weight: 650;
}
.codes-panel code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}
.shop h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
}
.shop-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.shop-row p {
  margin: 0;
  flex: 1;
  min-width: 180px;
  font-size: 0.95rem;
  color: #334155;
}
.shop-row input[type="text"] {
  padding: 8px 10px;
  font-size: 0.9rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  min-width: 120px;
}
.shop-row input[type="text"]::placeholder {
  color: #94a3b8;
}
.shop button {
  padding: 8px 14px;
  font-size: 0.9rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
}
.shop button:hover:not(:disabled) {
  background: #f1f5f9;
}
.shop button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.shop button.shop-row__danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}
.shop button.shop-row__danger:hover:not(:disabled) {
  background: #fee2e2;
}
.shop-meta {
  margin-top: 8px;
  font-size: 0.85rem;
  color: #64748b;
}
.orange-zone {
  margin: 12px 0 14px;
  padding: 10px 14px;
  max-width: 560px;
  border-radius: 12px;
  border: 1px solid rgba(249, 115, 22, 0.35);
  background: linear-gradient(135deg, #ffedd5 0%, #fdba74 55%, #f97316 100%);
  color: #7c2d12;
  box-shadow: 0 10px 24px rgba(249, 115, 22, 0.22);
  font-weight: 700;
  letter-spacing: 0.01em;
}
.orange-zone[hidden] {
  display: none;
}
.orange-zone.orange-zone--danger {
  border-color: rgba(239, 68, 68, 0.5);
  background: linear-gradient(135deg, #fee2e2 0%, #fca5a5 55%, #ef4444 100%);
  color: #7f1d1d;
  box-shadow: 0 10px 24px rgba(239, 68, 68, 0.22);
}
.orange-zone small {
  display: block;
  margin-top: 2px;
  font-weight: 600;
  color: rgba(124, 45, 18, 0.75);
  letter-spacing: 0;
}
.orange-zone.orange-zone--danger small {
  color: rgba(127, 29, 29, 0.75);
}
.orange-zone.orange-zone--emergency {
  border-color: rgba(147, 51, 234, 0.45);
  background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 45%, #a855f7 100%);
  color: #581c87;
  box-shadow: 0 10px 24px rgba(147, 51, 234, 0.28);
}
.orange-zone.orange-zone--emergency small {
  color: rgba(88, 28, 135, 0.82);
}
.save-toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #f8fafc;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.35);
  font-size: 0.95rem;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transition:
    opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}
.save-toast.save-toast--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.save-toast__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #16a34a;
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  transform: scale(0.6);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}
.save-toast.save-toast--visible .save-toast__icon {
  transform: scale(1);
  opacity: 1;
  animation: saveToastPulse 0.9s ease 0.15s 1;
}
@keyframes saveToastPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
  }
}
.save-toast__text {
  letter-spacing: 0.02em;
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(2, 6, 23, 0.55);
  display: grid;
  place-items: end center;
  padding: 18px;
}
.tutorial-overlay[hidden] {
  display: none;
}
.tutorial-card {
  width: min(780px, calc(100vw - 36px));
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.92));
  color: #f8fafc;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.45);
  padding: 14px 14px 12px;
}
.tutorial-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.tutorial-title {
  font-weight: 900;
  letter-spacing: 0.01em;
}
.tutorial-progress {
  color: rgba(226, 232, 240, 0.75);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.tutorial-body {
  margin-top: 10px;
}
.tutorial-text {
  color: rgba(226, 232, 240, 0.9);
  line-height: 1.35;
  font-weight: 650;
}
.tutorial-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.tutorial-btn {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.08);
  color: #f8fafc;
  cursor: pointer;
  font-weight: 750;
}
.tutorial-btn:hover {
  background: rgba(148, 163, 184, 0.13);
}
.tutorial-btn--primary {
  border-color: rgba(59, 130, 246, 0.55);
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
}
.tutorial-btn--ghost {
  margin-left: auto;
  border-color: rgba(148, 163, 184, 0.22);
  background: transparent;
  color: rgba(226, 232, 240, 0.8);
}
.tutorial-highlight {
  outline: 3px solid rgba(59, 130, 246, 0.85);
  outline-offset: 6px;
  border-radius: 12px;
}
