:root { --sky: #4FB3F0; --sky-light: #BFE6FF; --grass: #6CC04A; --grass-dark: #3F8F2A; --sun: #FFD84A; --ink: #24405A; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sky-light); touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; font-family: ui-rounded, "Nunito", "Arial Rounded MT Bold", system-ui, sans-serif; color: var(--ink); }
#unity-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; background: var(--sky-light); outline: none; }

/* Loading screen and "Tap to play" */
#splash { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4vmin; background: linear-gradient(var(--sky) 0%, var(--sky-light) 70%, var(--grass) 70%, var(--grass) 100%); }
#splash img { width: min(32vmin, 200px); height: auto; border-radius: 22%; box-shadow: 0 8px 0 rgba(0,0,0,.12); }
#bar { width: min(60vw, 420px); height: 28px; border-radius: 14px; background: rgba(255,255,255,.8); overflow: hidden; box-shadow: 0 4px 0 rgba(0,0,0,.1); }
#fill { width: 0; height: 100%; border-radius: 14px; background: var(--grass); transition: width .2s; }
#play { font: inherit; font-size: clamp(28px, 7vmin, 48px); font-weight: 800; color: var(--ink); background: var(--sun); border: 0; border-radius: 999px; padding: .5em 1.4em; min-height: 64px; box-shadow: 0 8px 0 #E0A800; cursor: pointer; animation: bob 1.6s ease-in-out infinite; }
#play:active { transform: translateY(6px); box-shadow: 0 2px 0 #E0A800; animation: none; }
#play:focus-visible { outline: 4px solid #fff; outline-offset: 4px; }
@keyframes bob { 50% { transform: scale(1.06); } }
#error { max-width: 80vw; text-align: center; font-size: 18px; }

/* Portrait on a phone: picture-only hint to turn the device sideways. */
#rotate { display: none; position: fixed; inset: 0; z-index: 20; background: var(--sky-light); align-items: center; justify-content: center; }
#rotate svg { width: 40vw; max-width: 220px; animation: turn 2.4s ease-in-out infinite; }
@keyframes turn { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
/* Touch devices only: a desktop window can't be rotated, so never block it. */
@media (orientation: portrait) and (pointer: coarse) { #rotate { display: flex; } }

/* Grown-up restore form and messages */
#restore { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(20,40,60,.55); touch-action: auto; -webkit-user-select: text; user-select: text; }
#restore[hidden], #restore form[hidden], #safari-toast[hidden] { display: none; }
.card { background: #fff; border-radius: 24px; padding: 24px; width: min(90vw, 460px); max-height: 90vh; overflow: auto; box-shadow: 0 10px 0 rgba(0,0,0,.15); box-sizing: border-box; }
.card h2 { margin: 0 0 8px; font-size: 26px; }
.card p { margin: 0 0 16px; font-size: 18px; line-height: 1.35; }
.card label { display: block; font-weight: 700; font-size: 18px; margin-bottom: 6px; }
.card input { font: inherit; font-size: 22px; width: 100%; box-sizing: border-box; padding: 12px 14px; border: 3px solid var(--sky); border-radius: 14px; min-height: 56px; }
.card input:focus { outline: none; border-color: var(--grass-dark); }
#restore-code { letter-spacing: .4em; text-align: center; }
.row { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.card button { font: inherit; font-size: 20px; font-weight: 800; border: 0; border-radius: 999px; padding: 12px 22px; min-height: 52px; cursor: pointer; flex: 1; }
.card button:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.card button:disabled { opacity: .6; cursor: default; }
.primary { background: var(--grass); color: #fff; }
.secondary { background: #E8EEF3; color: var(--ink); }
#restore-error { color: #B3261E; font-weight: 700; min-height: 1.4em; margin: 10px 0 0; }
#safari-toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40; background: var(--ink); color: #fff; font-size: 20px; font-weight: 700; padding: 14px 22px; border-radius: 999px; max-width: 90vw; text-align: center; }
