/* Website-only styles, loaded after the game's own (web/css/style.css). */
html, body { overscroll-behavior: none; touch-action: none; -webkit-touch-callout: none; -webkit-text-size-adjust: 100%; }
/* Lists and whole screens that are too long can still be scrolled, but nothing can be zoomed. */
.p-panel, .p-items, .v-list { touch-action: pan-y; overscroll-behavior: contain; }

/* ---------- iOS: safe margins ---------- */
/* The game fits inside this (see createLayout in ios.js), and its stage is in the middle of it. */
.safe-area { position: fixed; visibility: hidden; pointer-events: none; inset: env(safe-area-inset-top) env(safe-area-inset-right)
  env(safe-area-inset-bottom) env(safe-area-inset-left); }
.ios #stage { left: calc((100% + env(safe-area-inset-left) - env(safe-area-inset-right)) / 2);
  top: calc((100% + env(safe-area-inset-top) - env(safe-area-inset-bottom)) / 2); }

/* ---------- Grown-ups corner ---------- */
.p-status { font-weight: 800; color: #5a22a8; }
.p-status, .p-more { margin-bottom: 10px; }
.p-more { white-space: pre-line; }
/* These two screens are nearly full, so they only show the main status line, and the name keyboard is shorter. */
.name-panel .p-more, .p-more:has(+ .crop-host) { display: none; }
.name-panel .p-status { font-size: 24px; line-height: 1.25; }
.name-panel .name-preview { min-height: 110px; margin-bottom: 10px; }
.name-panel .kb { gap: 10px 14px; }
.name-panel .kb-key { height: 84px; font-size: 48px; }
.name-panel .kb-actions { margin-top: 14px; }
.crop-host { margin-top: 24px; }

/* ---------- iOS: the Grown-ups corner in portrait, and on phones in landscape ---------- */
/* The stage is bigger than the screen here (see ios.js). --tap is 44 pixels on the screen, and --text is 14. */
.big-corner #stage { overflow: visible; --tap: calc(44.1px / var(--stage-scale)); --text: calc(14.1px / var(--stage-scale)); }
.big-corner #overlay { inset: -2000px; }
.big-corner .p-panel { padding: 24px; overflow: hidden auto;
  width: calc((100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 16px) / var(--stage-scale));
  max-height: calc((100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px) / var(--stage-scale)); }
.big-corner .p-title { font-size: 44px; line-height: 1.1; }
.big-corner .p-close { height: auto; min-height: var(--tap); padding: 0 24px; font-size: 34px; }
.big-corner .p-item, .big-corner .p-btn, .big-corner .kb-key, .big-corner .v-row button, .big-corner .p-slider input[type=range] { min-height: var(--tap); }
.big-corner .p-item { padding: 12px 20px; font-size: 34px; }
.big-corner .p-items { padding: 0; }
.big-corner .p-sub, .big-corner .v-group { font-size: max(28px, var(--text)); }
.big-corner .v-row button { font-size: max(26px, var(--text)); }
.big-corner .p-keys, .big-corner .ps-hint, .big-corner .ps-ends, .big-corner .name-panel .p-status { font-size: max(24px, var(--text)); }
.big-corner .ps-top { gap: 12px; }
/* Each recording has its words and label, then its buttons. Its delete button is at the far end of that line. */
.big-corner .v-row { flex-wrap: wrap; }
.big-corner .v-stat { font-size: max(22px, var(--text)); }
.big-corner .v-row button { min-width: var(--tap); }
.big-corner .v-row .del { order: 1; margin-left: auto; }
.p-ask .ask-yes { margin-top: max(40px, calc(24.1px / var(--stage-scale))); }
.big-corner .kb { gap: 10px 6px; }
.big-corner .kb-key { border-width: 4px; border-radius: 20px; }
.big-corner .name-preview { font-size: 56px; }
.big-corner .name-caret { height: 64px; }

.portrait-corner .p-panel { max-width: 760px; }
.portrait-corner .studio { height: 100%; }
.portrait-corner .p-title { min-height: 100px; padding-right: 240px; }
.portrait-corner .p-close { right: 24px; top: 20px; }
.portrait-corner .p-items:has(.p-slider) { min-height: 320px; } /* room for the menu on very short screens */
.portrait-corner .v-text, .portrait-corner .v-stat { flex: 1 0 100%; }
.portrait-corner .crop-wrap { flex-direction: column; }

/* In landscape, the whole panel scrolls. Close stays in view in its own column, so it's never next to a delete button. */
.short-corner .p-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start; column-gap: calc(40px / var(--stage-scale)); }
.short-corner .p-panel > * { grid-column: 1; }
.short-corner .p-panel > .p-close { position: sticky; grid-area: 1 / 2 / span 20; align-self: start; right: auto; top: 0; }
.short-corner .studio { height: auto; }
.short-corner .p-items, .short-corner .v-list { overflow: visible; padding: 0; }
.short-corner .v-text { flex: 1 0 calc(100% - 420px); }
.short-corner .v-stat { flex: 0 0 380px; }
.short-corner .crop-wrap { flex-wrap: wrap; }
.short-corner .crop-side { flex: 1 1 300px; }

/* ---------- iOS: the rotate screen ---------- */
/* Like the code screen, this is outside the game's stage, so it's a normal size on every screen. */
.rotate { position: fixed; inset: 0; z-index: 90; display: flex; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  padding: calc(12px + env(safe-area-inset-top)) 20px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(160deg, #3a1d7a, #2a1a5e); color: #fff; text-align: center;
  font: 600 18px/1.4 "Baloo 2", "Fredoka", "Nunito", "Varela Round", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif; }
.rotate[hidden] { display: none; }
.rotate-panel { display: flex; flex-direction: column; align-items: center; max-width: 420px; margin: auto; }
.rotate-phone { font-size: 110px; animation: rotatePhone 3s ease-in-out infinite; }
@keyframes rotatePhone { 0%, 20% { transform: none; } 60%, 100% { transform: rotate(-90deg); } }
.rotate h1 { margin: 20px 0 8px; font-size: 34px; line-height: 1.2; font-weight: 900; color: #ffd60a; }
.rotate p { margin: 0 0 28px; }
.rotate-gear { width: 72px; height: 72px; padding: 0; border: 3px solid rgba(255,255,255,.7); border-radius: 50%; background: rgba(0,0,0,.3);
  font-size: 36px; line-height: 1; touch-action: none; -webkit-user-select: none; user-select: none; }
.rotate-gear:focus-visible { outline: 4px solid #ffb703; outline-offset: 2px; }
/* This matches the game's own ring (#hold). */
.rotate-hold { display: flex; align-items: center; gap: 12px; margin-top: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.rotate-hold.on { opacity: 1; }
.rotate-hold .ring { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: conic-gradient(#ffd60a calc(var(--p, 0) * 1%), rgba(255,255,255,.35) 0); }
.rotate-hold .ring::after { content: ''; width: 28px; height: 28px; border-radius: 50%; background: #2b2d42; }
.rotate-hold .txt { min-height: 1.4em; font-weight: 800; }

/* ---------- code screen, and other screens over the whole game ---------- */
/* These aren't inside the game's scaled stage, so they're a normal size on every screen. */
.gate { position: fixed; inset: 0; z-index: 100; overflow-y: auto; overscroll-behavior: contain; display: flex;
  padding: calc(12px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
  background: linear-gradient(160deg, #3a1d7a, #2a1a5e); color: #2b2d42; touch-action: pan-y; -webkit-text-size-adjust: 100%;
  font: 600 17px/1.4 "Baloo 2", "Fredoka", "Nunito", "Varela Round", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif; }
.gate-panel { position: relative; width: 100%; max-width: 560px; margin: auto; padding: 20px; border-radius: 24px;
  background: #fff; box-shadow: 0 12px 40px rgba(0,0,0,.4); outline: none; }
.gate h1 { margin: 0 0 8px; font-size: 26px; line-height: 1.2; font-weight: 900; color: #6a28c8; }
.gate-close ~ h1 { min-height: 44px; padding-right: 110px; }
.gate p, .gate ol { margin: 0 0 12px; }
.gate ol { padding-left: 24px; }
.gate li { margin-bottom: 6px; }
.gate [hidden] { display: none; }
.gate button { min-height: 44px; padding: 8px 18px; border: 3px solid #6a28c8; border-radius: 14px; background: #f3ecff;
  color: #4b1a94; font: inherit; font-weight: 800; cursor: pointer; touch-action: manipulation; }
.gate button:focus-visible, .gate-keys button:focus, .gate input:focus-visible { outline: 4px solid #ffb703; outline-offset: 1px; }
.gate button:disabled { opacity: .5; cursor: default; }
.gate .gate-close { position: absolute; right: 16px; top: 14px; border-color: #d9264a; background: #d9264a; color: #fff; }
.gate-warning { padding: 10px 14px; border-radius: 12px; background: #fff3cd; color: #5c4400; }
.gate-form { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; margin-bottom: 8px; }
.gate-form label { grid-column: 1 / -1; font-weight: 800; }
.gate input { min-width: 0; min-height: 48px; padding: 6px 12px; border: 3px solid #b9a5dd; border-radius: 14px; background: #fff;
  color: #2b2d42; font: 700 18px/1.3 ui-monospace, Consolas, Menlo, monospace; text-transform: uppercase;
  -webkit-user-select: text; user-select: text; }
.gate .gate-submit, .gate .gate-again, .gate .gate-use { background: #6a28c8; color: #fff; }
.gate .gate-message { min-height: 1.4em; margin-bottom: 4px; color: #b3123a; font-weight: 800; }
.gate-keys { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; margin-top: 8px; }
.gate .gate-key { min-width: 0; padding: 4px 0; border-width: 2px; border-radius: 10px; }
.gate .gate-wide { grid-column: span 4; }
@media (max-width: 420px) {
  .gate-form { grid-template-columns: 1fr; }
  .gate-panel { padding: 16px; }
}
