/* ---------- screens (one <dialog>, see modal.js) ---------- */
/* No display on #screen: setting one would override the closed state. */
#screen { --pad: 20px; width: min(420px, calc(100% - 28px)); max-height: calc(100% - 28px); margin: auto; padding: var(--pad); color: var(--text);
  background: radial-gradient(rgba(255, 255, 255, .09) 1.5px, transparent 2px) 0 0 / 14px 14px, linear-gradient(#4a8cf5, var(--blue) 30%, var(--blue-lo));
  border: 3px solid #bfdcff; border-radius: 22px; box-shadow: 0 0 0 4px var(--navy), 0 12px 0 0 rgba(12, 22, 56, .45), inset 0 3px 0 rgba(255, 255, 255, .25);
  overflow-x: hidden; overflow-y: auto; touch-action: pan-y; scrollbar-width: thin; scrollbar-color: #bfdcff transparent; }
#screen:modal { overscroll-behavior: contain; }
#screen::backdrop { background: rgba(12, 28, 90, .55); overflow: hidden; overscroll-behavior: contain; }
#screen[open] { @media (prefers-reduced-motion: no-preference) { animation: pop-in .35s var(--bounce); } }
@keyframes pop-in { from { opacity: 0; scale: .8; } }
#screen.wide { width: min(640px, calc(100% - 28px)); }
#screen.narrow { width: min(330px, calc(100% - 28px)); }
/* the game-over card sits low and leaves the map lit: the camera is showing the killer */
#screen.low { margin-bottom: max(22px, env(safe-area-inset-bottom)); }
#screen.low::backdrop { background: linear-gradient(transparent 45%, rgba(12, 28, 90, .55)); }
#screen.bare { width: min(420px, calc(100% - 28px)); padding: 12px 0 20px; background: transparent; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
#screen.bare::backdrop { background: radial-gradient(ellipse at 50% 45%, rgba(40, 90, 210, .25), rgba(12, 22, 70, .8)); }
@media (max-width: 520px) { #screen { --pad: 16px; } }

.panel { display: grid; gap: 14px; }
.panel h1 { margin: 0; font-size: 24px; line-height: 1.2; font-weight: 900; color: var(--yellow); text-shadow: var(--ol3), 0 4px 0 var(--navy); text-wrap: balance; }
.panel p { margin: 0; }
.panel p, .panel li { text-wrap: pretty; }
:lang(ko) .panel :is(h1, h2, h3, p, dd), :lang(ko) .toast { word-break: keep-all; overflow-wrap: break-word; }
.head { position: sticky; top: calc(-1 * var(--pad)); z-index: 2; display: flex; align-items: center; gap: 14px; margin: calc(-1 * var(--pad)) calc(-1 * var(--pad)) 0; padding: 14px var(--pad) 12px;
  background: linear-gradient(#4a8cf5, #3f82f2); border-bottom: 3px solid rgba(20, 32, 80, .35); border-radius: 19px 19px 0 0; }
.head h1 { font-size: 22px; }
/* light cards on the blue panel carry the reading text */
.card, .info, .setting, .entry, .reel, .scores, .facts .fact { color: var(--card-text); background: linear-gradient(#fff, var(--cream-2)); border: 3px solid var(--navy); border-radius: 16px; box-shadow: 0 4px 0 rgba(12, 22, 56, .4); }
.card { padding: 12px 14px; }
.card h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 15px; font-weight: 900; color: var(--blue-lo); }
.card p { font-size: 13px; font-weight: 600; color: var(--card-soft); }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.num { display: grid; place-items: center; flex: none; width: 24px; height: 24px; font-size: 13px; color: var(--navy); background: var(--yellow); border: 2px solid var(--navy); border-radius: 50%; }
.record { padding: 1px 8px; font-size: 10px; font-weight: 900; letter-spacing: .04em; white-space: nowrap; color: #fff; background: var(--red); border: 2px solid var(--navy); border-radius: 999px; text-shadow: 0 1px 0 var(--navy);
  @media (prefers-reduced-motion: no-preference) { animation: wobble .6s var(--bounce) 3; } }

/* main menu: the logo floats over the map and the buttons stand on their own */
.panel.title { justify-items: center; gap: 10px; }
/* the title art is 50 x 53 pixels, shown at whole multiples */
.panel.title .icon { width: 84px; height: 88px; image-rendering: pixelated; filter: drop-shadow(0 6px 0 rgba(12, 22, 56, .45)); }
@media (min-width: 720px) and (min-height: 640px) { .panel.title .icon { width: 126px; height: 132px; } }
.panel.title .logo { margin-bottom: 14px; }
.menu { display: grid; gap: 12px; width: 100%; }
.menu .start { min-height: 64px; font-size: 21px; }
.menu .start .ico svg { width: 22px; height: 22px; }
@media (prefers-reduced-motion: no-preference) { .menu .start:not(:hover, :focus-visible) { animation: breathe 1.6s ease-in-out infinite; } }
@keyframes breathe { 50% { scale: 1.03; } }
/* a dark pill under the record, so the small text stays clean over a busy map instead of an outline smudging it */
.menu .best { display: flex; align-items: center; justify-content: center; gap: 6px; width: fit-content; margin: 0 auto; padding: 3px 12px 4px; border-radius: 999px;
  background: rgba(20, 32, 80, .82); font-size: 14px; font-weight: 800; line-height: 1.2; color: var(--yellow); }
.menu .best .ico svg { width: 13px; height: 13px; }
.menu .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.menu .tile { min-height: 54px; padding: 10px 14px 12px; font-size: 15px; }
.menu .tile .ico { color: var(--blue); }
.menu .lang-btn { min-height: 46px; font-size: 14px; }
.menu .lang-btn .value { margin-left: 4px; color: var(--blue-lo); }

/* language */
.panel.lang h1 { font-size: 22px; text-align: center; }
.panel.lang .buttons { gap: 12px; }
.panel.lang button { justify-content: flex-start; gap: 12px; min-height: 56px; padding-left: 44px; font-size: 17px; text-align: left; }
.panel.lang button.current { background: linear-gradient(var(--yellow-hi) 0 40%, var(--yellow) 55%, #ffbf1f); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .7), inset 0 -4px 0 var(--yellow-lo), 0 5px 0 var(--navy); }
.panel.lang .flag { display: flex; flex: none; border: 2px solid var(--navy); border-radius: 4px; overflow: hidden; }
.panel.lang .flag svg { display: block; }
.panel.lang .english { margin-left: auto; font-weight: 700; font-size: 13px; color: var(--card-soft); }
.panel.lang [aria-busy="true"] .english { display: none; }
