/* Infinite Minesweeper: the field is one canvas filling the stage; the HUD, the minimap, the zoom buttons, the tool bar,
   the coach line, the result card and the panels are HTML over it (game.js) */
.im { display: flex; flex-direction: column; color: #e3ebff; --im-hud: 56px; --im-bar: 66px; --im-accent: #55d6ff; --im-gold: #ffd166; --im-coral: #ff5a6e; --im-mint: #7fe39a;
  --im-line: #1c2b4a; --im-glass: rgba(7,11,26,0.84); --im-muted: #8aa3c4; }
.im-stage { position: relative; width: 100%; height: min(86vh, 800px); min-height: 480px; background: #050a18; overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; touch-action: none; outline: none; }
@media (max-width: 600px) { .im-stage { height: auto; aspect-ratio: 3 / 4.4; max-height: 88vh; min-height: 0; } }
#im-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: pointer; }
#im-canvas:focus-visible { box-shadow: inset 0 0 0 2px rgba(85,214,255,.45); }
.im button { font-family: inherit; -webkit-tap-highlight-color: transparent; }

/* HUD */
.im-hud { position: absolute; left: 0; right: 0; top: 0; height: var(--im-hud); display: flex; align-items: center; gap: 12px; padding: 0 8px 0 10px; z-index: 3; pointer-events: none;
  background: linear-gradient(180deg, rgba(4,7,18,.78), rgba(4,7,18,.38) 70%, rgba(4,7,18,0)); }
.im-hud > * { pointer-events: auto; }
.im-pz { flex: 0 1 auto; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; position: relative; min-width: 96px; max-width: 42vw; height: 44px; padding: 2px 26px 2px 10px; border-radius: 12px;
  border: 1px solid var(--im-line); background: var(--im-glass); color: #fff; cursor: pointer; font: inherit; line-height: 1.05; touch-action: manipulation; text-align: left; transition: border-color .15s; }
.im-pz-lv { font-size: 10px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--lvc, #7cc8ff); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.im-pz-n { font-size: 16.5px; font-weight: 900; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.im-pz-dd { position: absolute; right: 6px; top: 50%; width: 16px; height: 16px; margin-top: -8px; fill: none; stroke: var(--im-muted); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .im-pz:hover { border-color: var(--im-accent); } }
.im-pz:focus-visible { outline: 2px solid var(--im-accent); outline-offset: 2px; }
.im-stat { display: flex; flex-direction: column; line-height: 1.05; flex: none; }
.im-k { font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--im-muted); }
.im-stat b { font-size: 21px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; }
.im-score b { display: inline-block; transform-origin: left center; text-shadow: 0 0 16px rgba(124,200,255,.35); }
.im-score b.pop { animation: im-pop .26s cubic-bezier(.3,1.6,.5,1); }
@keyframes im-pop { 40% { transform: scale(1.14); color: #d8f0ff; } }
.im-lives b { display: flex; gap: 2px; margin-top: 3px; }
.im-lives svg { width: 17px; height: 17px; }
.im-lives svg.on { fill: var(--im-coral); filter: drop-shadow(0 0 5px rgba(255,90,110,.7)); }
.im-lives svg.off { fill: rgba(255,255,255,.06); stroke: rgba(170,190,230,.6); stroke-width: 1.8; }
.im-lives svg.lost, .im-lives-mini svg.lost { animation: im-break .5s ease-out; }
@keyframes im-break { 0% { transform: scale(1.5); fill: var(--im-coral); } 100% { transform: scale(1); } }
.im-lives[hidden] { display: none; }
.im-lives-mini { display: none; font-style: normal; }
.im-narrow .im-lives { display: none; }
.im-narrow .im-lives-mini { display: inline-flex; gap: 1px; margin-left: 5px; vertical-align: -2px; }
.im-lives-mini svg { width: 11px; height: 11px; }
.im-lives-mini svg.on { fill: var(--im-coral); filter: drop-shadow(0 0 3px rgba(255,90,110,.7)); }
.im-lives-mini svg.off { fill: rgba(255,255,255,.06); stroke: rgba(170,190,230,.65); stroke-width: 2.2; }
.im-time b { font-size: 17px; margin-top: 3px; color: #e3ebff; }
.im-notimer .im-time { display: none; }
.im-sp { flex: 1 1 auto; }
.im-tool { position: relative; display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; border: 1px solid var(--im-line); background: var(--im-glass);
  color: #c9d6f5; cursor: pointer; touch-action: manipulation; padding: 0; transition: border-color .15s, color .15s; }
.im-tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.im-tool .spk { fill: currentColor; stroke: none; }
@media (hover: hover) { .im-tool:hover { border-color: var(--im-accent); color: #fff; } }
.im-tool:focus-visible { outline: 2px solid var(--im-accent); outline-offset: 2px; }
#im-sound .off { display: none; } #im-sound[aria-pressed="true"] { color: #6a7aa3; } #im-sound[aria-pressed="true"] .on { display: none; } #im-sound[aria-pressed="true"] .off { display: inline; }
.im-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: #ff7ab8; box-shadow: 0 0 8px #ff7ab8; }
.im-dot[hidden] { display: none; }

/* the minimap and the distance from the start */
.im-side { position: absolute; top: calc(var(--im-hud) + 2px); right: 8px; z-index: 3; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; pointer-events: none; }
.im-side > * { pointer-events: auto; }
.im-mini { display: block; padding: 0; border-radius: 12px; border: 1px solid var(--im-line); background: #060a18; overflow: hidden; cursor: pointer; touch-action: manipulation;
  box-shadow: 0 8px 24px rgba(0,0,0,.45); transition: border-color .15s; }
.im-mini canvas { display: block; }
@media (hover: hover) { .im-mini:hover { border-color: var(--im-accent); } }
.im-mini:focus-visible { outline: 2px solid var(--im-accent); outline-offset: 2px; }
.im-nomini .im-mini { display: none; }
.im-dist { pointer-events: none; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; column-gap: 3px; max-width: 150px; padding: 4px 9px 5px; border-radius: 10px; background: var(--im-glass); border: 1px solid var(--im-line);
  font-size: 11px; color: var(--im-muted); line-height: 1.2; text-align: right; }
.im-dist b { font-size: 14px; color: #fff; font-variant-numeric: tabular-nums; }
.im-dist small { flex-basis: 100%; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #9fd8ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* zoom */
.im-zoom { position: absolute; right: 8px; bottom: calc(var(--im-bar) + 6px); z-index: 3; display: flex; flex-direction: column; gap: 6px; }
.im-zb { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border-radius: 12px; border: 1px solid var(--im-line); background: var(--im-glass); color: #c9d6f5; cursor: pointer; touch-action: manipulation; transition: border-color .15s, color .15s; }
.im-zb svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
@media (hover: hover) { .im-zb:hover { border-color: var(--im-accent); color: #fff; } }
.im-zb:focus-visible { outline: 2px solid var(--im-accent); outline-offset: 2px; }
@media (hover: none) and (pointer: coarse) { .im-zoom { opacity: .82; } }

/* the coach line */
.im-coach[hidden] { display: none; }
.im-coach { position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--im-hud) + 4px); z-index: 4; width: min(calc(100% - 20px), 520px); padding: 8px 34px 8px 12px; border-radius: 12px;
  background: rgba(6,10,26,0.93); border: 1px solid rgba(85,214,255,0.45); box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 18px rgba(85,214,255,.12); font-size: 13.5px; line-height: 1.4; color: #e3ebff;
  animation: im-drop .22s ease-out; }
@keyframes im-drop { from { opacity: 0; transform: translate(-50%, -6px); } }
@keyframes im-rise { from { opacity: 0; transform: translate(-50%, 6px); } }
.im-coach b { color: #9fe0ff; font-weight: 800; margin-right: 6px; }
.im-coach.hint { border-color: rgba(255,209,102,0.6); box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 18px rgba(255,209,102,.14); }
.im-coach.hint b { color: var(--im-gold); }
.im-coach small { display: block; color: var(--im-muted); font-size: 12px; margin-top: 2px; }
.im-coach-close { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--im-muted); font-size: 19px; line-height: 1; cursor: pointer; }
@media (hover: hover) { .im-coach-close:hover { color: #fff; background: rgba(255,255,255,.08); } }
@media (min-width: 900px) { .im-coach { width: min(calc(100% - 340px), 520px); } }

/* the tool bar */
.im-bar { position: absolute; left: 50%; transform: translateX(-50%); bottom: 8px; height: calc(var(--im-bar) - 12px); z-index: 3; display: flex; gap: 6px; width: min(calc(100% - 12px), 560px); }
.im-btn, .im-md { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 14px; border: 1px solid var(--im-line);
  background: rgba(7,11,26,0.88); color: #d4def8; font: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; cursor: pointer; touch-action: manipulation; padding: 0 2px;
  transition: border-color .15s, color .15s, opacity .15s, background .15s, transform .08s; }
.im-btn svg, .im-md svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.im-btn span, .im-md span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (hover: hover) { .im-btn:hover:not(:disabled), .im-md:hover:not(:disabled) { border-color: var(--im-accent); color: #fff; } }
.im-btn:active:not(:disabled), .im-md:active:not(:disabled) { transform: translateY(1px); }
.im-btn:focus-visible, .im-md:focus-visible { outline: 2px solid var(--im-accent); outline-offset: 2px; }
.im-btn:disabled, .im-md:disabled { color: rgba(212,222,248,0.3); cursor: default; }
.im-md:disabled[aria-checked="true"], #im-md-flag:disabled[aria-checked="true"] { background: #101a32; box-shadow: none; color: rgba(212,222,248,0.42); }
#im-md-flag:disabled[aria-checked="true"] svg path:last-child { fill: none; stroke: currentColor; }
.im-hint:disabled .im-badge { background: #2a3352; color: #8f95ad; box-shadow: none; }
.im-modes { flex: 1.9 1 0; min-width: 0; display: flex; gap: 3px; padding: 3px; border-radius: 15px; border: 1px solid var(--im-line); background: rgba(7,11,26,0.88); }
.im-md { border: 0; background: transparent; border-radius: 11px; }
.im-md[aria-checked="true"] { background: #14223f; color: #fff; box-shadow: inset 0 0 0 1px rgba(85,214,255,.5), 0 0 14px rgba(85,214,255,.14); }
#im-md-flag[aria-checked="true"] { background: #3a1422; box-shadow: inset 0 0 0 1px rgba(255,90,110,.65), 0 0 14px rgba(255,90,110,.2); color: #ffd7dd; }
#im-md-flag svg { stroke: currentColor; }
#im-md-flag[aria-checked="true"] svg path:last-child { fill: var(--im-coral); stroke: var(--im-coral); }
.im-hint { color: #ffe3a3; }
@media (hover: hover) { .im-hint:hover:not(:disabled) { border-color: var(--im-gold); } }
.im-hint.empty { color: #8f95ad; }
.im-badge { position: absolute; top: 4px; left: calc(50% + 7px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--im-gold); color: #1a1200; font: 900 11px/17px system-ui, sans-serif; font-style: normal; text-align: center; box-shadow: 0 0 10px rgba(255,209,102,.5); }
.im-hint.empty .im-badge { background: #2a3352; color: #8f95ad; box-shadow: none; }
#im-home svg circle { stroke-width: 1.8; }
#im-arrow { transition: transform .25s ease-out; }
.im-needle { fill: var(--im-gold); stroke: var(--im-gold); }
#im-home.at-home .im-needle { fill: none; }
.im-end.done { background: linear-gradient(135deg, #ffd166, #ffb347); color: #1a1200; border-color: transparent; box-shadow: 0 6px 20px rgba(255,180,70,.3); }

/* the result card: a strip over the bottom of the field, so the field stays in view */
.im-card[hidden] { display: none; }
.im-card { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 4; width: min(calc(100% - 16px), 470px); padding: 14px 14px 12px; border-radius: 18px;
  background: rgba(6,10,26,0.94); border: 1px solid rgba(255,209,102,0.32); box-shadow: 0 18px 50px rgba(0,0,0,.6), 0 0 40px rgba(255,140,90,.1); animation: im-up .35s cubic-bezier(.2,.9,.25,1.1);
  max-height: calc(100% - var(--im-hud) - 20px); overflow: auto; overscroll-behavior: contain; }
@keyframes im-up { from { opacity: 0; transform: translate(-50%, 24px); } }
.im-card-top { display: flex; align-items: flex-start; gap: 10px; }
.im-card-top > div { flex: 1 1 auto; min-width: 0; }
.im-card h2 { margin: 0; font-size: 22px; font-weight: 900; color: #fff; letter-spacing: 0.01em; text-transform: none; line-height: 1.15; text-shadow: 0 0 22px rgba(255,140,90,.4); }
.im-card p { margin: 3px 0 0; font-size: 13px; color: var(--im-muted); line-height: 1.45; }
.im-card .im-stats { margin-top: 10px; }
.im-card .im-actions { margin-top: 12px; }
.im-card .im-lb { margin-top: 8px; }
.im-card-x { position: static; flex: none; }
.im-carded .im-bar, .im-carded .im-zoom { visibility: hidden; }

/* panels */
.im-overlay[hidden] { display: none; }
.im-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 6; overflow: auto;
  background: radial-gradient(ellipse at center, rgba(4,6,18,0.5), rgba(3,5,12,0.86)); animation: im-fade .18s ease-out; }
.im-panel { position: relative; width: min(100%, 440px); margin: auto; padding: 20px 18px 18px; border: 1px solid var(--im-line); border-radius: 18px; text-align: left; outline: none;
  background: rgba(7,11,26,0.96); box-shadow: 0 20px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(85,214,255,0.05) inset; animation: im-in .26s cubic-bezier(.2,.9,.25,1.1); }
.im-panel.wide { width: min(100%, 560px); }
@keyframes im-in { from { opacity: 0; transform: scale(.95) translateY(8px); } }
@keyframes im-fade { from { opacity: 0; } }
.im-panel h2 { margin: 0 36px 12px 0; font-size: 20px; font-weight: 900; color: #fff; letter-spacing: 0.01em; text-transform: none; line-height: 1.25; }
.im-panel h3 { margin: 16px 0 8px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--im-muted); }
.im-panel p, .im-panel li { font-size: 13.5px; line-height: 1.55; color: #bccbec; }
.im-panel p { margin: 0 0 9px; }
.im-panel p b { color: #fff; }
.im-panel kbd { display: inline-block; min-width: 1.4em; padding: 0 5px; border-radius: 5px; border: 1px solid #2a3c66; background: #0a1124; color: #fff; font: 700 12px/1.6 system-ui, sans-serif; text-align: center; }
.im-x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 0; background: rgba(255,255,255,.07); color: #d4def8; cursor: pointer; padding: 0; z-index: 2; }
.im-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
@media (hover: hover) { .im-x:hover { background: rgba(255,255,255,.14); color: #fff; } }
.im-x:focus-visible { outline: 2px solid var(--im-accent); outline-offset: 2px; }
.im-fine { font-size: 12px !important; color: #7385ab !important; margin: 8px 0 0 !important; }
.im-fine:empty { display: none; }

.im-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.im-row { display: flex; gap: 8px; } .im-row > * { flex: 1 1 0; min-width: 0; }
.im-b { font: inherit; font-weight: 700; font-size: 14.5px; padding: 10px 14px; min-height: 46px; border-radius: 12px; cursor: pointer; touch-action: manipulation; text-decoration: none;
  border: 1px solid var(--im-line); background: #0b1430; color: #e3ebff; transition: background .15s, border-color .15s, transform .1s, filter .15s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
@media (hover: hover) { .im-b:hover:not(:disabled) { border-color: var(--im-accent); } }
.im-b:active { transform: translateY(1px); }
.im-b:disabled { opacity: .45; cursor: default; }
.im-b:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.im-b svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.im-b span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.im-b-primary { background: linear-gradient(135deg, #ffd166, #ffb347); color: #1a1200; border-color: transparent; font-size: 16px; font-weight: 800; box-shadow: 0 6px 24px rgba(255,180,70,0.3); }
.im-b-primary svg { fill: currentColor; stroke: none; }
@media (hover: hover) { .im-b-primary:hover:not(:disabled) { border-color: transparent; filter: brightness(1.06); } }
.im-b-sm { min-height: 40px; padding: 6px 8px; font-size: 13px; gap: 6px; }

.im-tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; vertical-align: middle; margin-left: 8px;
  color: #1a1200; background: linear-gradient(90deg, #ffd166, #fff1b8, #ffd166); background-size: 200% 100%; animation: im-shine 1.6s linear infinite; box-shadow: 0 0 18px rgba(255,209,102,0.5); }
@keyframes im-shine { to { background-position: -200% 0; } }
.im-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 4px; }
.im-stats.three { grid-template-columns: repeat(3, 1fr); }
.im-stats div { padding: 8px 4px; border-radius: 10px; background: #060b1c; border: 1px solid #16223f; text-align: center; min-width: 0; }
.im-stats span { display: block; font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: #6f80a8; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.im-stats b { display: block; margin-top: 2px; font-size: 17px; color: #e3ebff; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.im-stats .gold b { color: var(--im-gold); } .im-stats .hot b { color: #ff9aa6; } .im-stats .ok b { color: var(--im-mint); }
.im-lb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.im-lb h3 { margin-top: 8px; }
.im-lb li { display: grid; grid-template-columns: 26px 1fr auto auto; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 8px; background: #060b1c; font-size: 13px; }
.im-lb li span { color: #6f80a8; font-weight: 800; font-variant-numeric: tabular-nums; }
.im-lb li b { color: #e3ebff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.im-lb li em { font-style: normal; color: var(--im-gold); font-weight: 800; font-variant-numeric: tabular-nums; }
.im-lb li i { font-style: normal; color: var(--im-muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.im-lb li.me { background: rgba(85,214,255,0.12); box-shadow: inset 0 0 0 1px rgba(85,214,255,0.4); }

/* the hub */
.im-hubc { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; min-height: 84px; padding: 12px 12px 10px; border-radius: 15px; border: 1px solid var(--im-line);
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--hc) 20%, transparent), transparent 60%), #060b1c; color: #e3ebff; font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; transition: border-color .15s, transform .1s; }
.im-hubc svg { width: 26px; height: 26px; fill: none; stroke: var(--hc); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 2px; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--hc) 60%, transparent)); }
.im-hubc b { font-size: 15.5px; color: #fff; }
.im-hubc small { font-size: 12.5px; color: var(--im-muted); line-height: 1.4; padding-right: 64px; }
.im-hubc em { position: absolute; top: 12px; right: 12px; font-style: normal; font-size: 12px; font-weight: 800; color: var(--hc); }
@media (hover: hover) { .im-hubc:hover { border-color: var(--hc); } }
.im-hubc:active { transform: translateY(1px); }
.im-hubc:focus-visible { outline: 2px solid var(--hc); outline-offset: 2px; }
.im-seg { display: flex; gap: 4px; padding: 4px; border-radius: 13px; background: #060b1c; border: 1px solid var(--im-line); margin: 0 0 8px; }
.im-seg button { flex: 1 1 0; min-width: 0; min-height: 42px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border: 0; border-radius: 9px; background: transparent; color: var(--im-muted); font: 700 13.5px system-ui, sans-serif; cursor: pointer; padding: 4px 2px; touch-action: manipulation; }
.im-seg button b { font-size: 13.5px; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.im-seg button small { font-size: 10.5px; font-weight: 600; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.im-seg button[aria-checked="true"] { background: #14223f; color: #fff; box-shadow: inset 0 0 0 1px rgba(85,214,255,.55), 0 0 14px rgba(85,214,255,.14); }
.im-seg button:focus-visible { outline: 2px solid var(--im-accent); outline-offset: 1px; }
.im-seed { margin-top: 4px; }
.im-seed label { display: flex; flex-direction: column; gap: 1px; margin-bottom: 6px; }
.im-seed label b { font-size: 14px; color: #fff; } .im-seed label small { font-size: 12px; color: var(--im-muted); }
.im-seed-row { display: flex; gap: 8px; }
.im-seed input { flex: 1 1 auto; min-width: 0; height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid #263a66; background: #050916; color: #fff; font: 800 17px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 0.18em; text-transform: uppercase; }
.im-seed input::placeholder { color: #4d5c80; letter-spacing: 0.06em; font-weight: 700; }
.im-seed input:focus { outline: 2px solid var(--im-accent); outline-offset: 1px; border-color: transparent; }
.im-dice { width: 48px; min-height: 44px; padding: 0; flex: none; }
.im-dice svg { width: 22px; height: 22px; }
.im-dice svg circle { fill: currentColor; stroke: none; }

/* calendar */
.im-cal-head { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; }
.im-cal-head b { flex: 1 1 auto; text-align: center; color: #fff; font-size: 15px; }
.im-step { width: 42px; height: 42px; flex: none; display: grid; place-items: center; padding: 0; border-radius: 10px; border: 1px solid #22345c; background: #0b1430; color: #e3ebff; cursor: pointer; }
.im-step svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.im-step:disabled { opacity: .35; cursor: default; }
.im-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.im-cal-w { text-align: center; font-size: 10.5px; font-weight: 800; color: #6f80a8; padding: 2px 0; }
.im-cal-d { position: relative; aspect-ratio: 1; display: grid; place-items: center; border-radius: 9px; border: 1px solid #16223f; background: #060b1c; color: #d4def8; font: 700 13px system-ui, sans-serif; cursor: pointer; padding: 0; }
.im-cal-d.off { opacity: .28; cursor: default; }
.im-cal-d.ok { background: rgba(127,227,154,0.12); border-color: rgba(127,227,154,0.55); color: var(--im-mint); }
.im-cal-d.today { box-shadow: 0 0 0 2px #ff7ab8, 0 0 14px rgba(255,122,184,.45); }
.im-cal-pad { aspect-ratio: 1; }
@media (hover: hover) { .im-cal-d:not(.off):hover { border-color: var(--im-accent); } }
.im-cal-d:focus-visible { outline: 2px solid var(--im-accent); outline-offset: 1px; }

/* settings, tabs, help, tables, the map */
.im-set { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid #16223f; cursor: pointer; }
.im-set span { display: flex; flex-direction: column; gap: 2px; min-width: 0; } .im-set b { font-size: 14px; color: #fff; } .im-set small { font-size: 12px; color: var(--im-muted); line-height: 1.35; }
.im-set input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.im-set-col { flex-direction: column; align-items: stretch; cursor: default; }
.im-set-col .im-seg { margin: 6px 0 0; }
.im-sw { position: relative; width: 46px; height: 27px; flex: none; border-radius: 14px; border: 1px solid #263a66; background: #0b1430; transition: background .15s, border-color .15s; }
.im-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #6a7aa3; transition: transform .15s, background .15s; }
.im-set input:checked + .im-sw { background: #123049; border-color: var(--im-accent); }
.im-set input:checked + .im-sw::after { transform: translateX(19px); background: var(--im-accent); box-shadow: 0 0 10px rgba(85,214,255,.7); }
.im-set input:focus-visible + .im-sw { outline: 2px solid var(--im-accent); outline-offset: 2px; }
.im-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 13px; background: #060b1c; border: 1px solid var(--im-line); margin: 0 0 14px; }
.im-tab { font: inherit; font-size: 13.5px; font-weight: 700; color: var(--im-muted); background: transparent; border: 0; border-radius: 9px; min-height: 38px; cursor: pointer; }
.im-tab[aria-selected="true"] { background: #14223f; color: #fff; box-shadow: inset 0 0 0 1px rgba(85,214,255,0.5), 0 0 16px rgba(85,214,255,0.14); }
.im-tab:focus-visible { outline: 2px solid var(--im-accent); outline-offset: 1px; }
.im-howto { display: grid; grid-template-columns: 64px 1fr; gap: 10px 12px; align-items: center; margin: 4px 0 10px; }
.im-howto svg { width: 64px; height: 56px; }
.im-howto p { margin: 0; }
.im-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.im-table th, .im-table td { padding: 7px 4px; text-align: right; border-bottom: 1px solid #16223f; font-variant-numeric: tabular-nums; }
.im-table th:first-child, .im-table td:first-child { text-align: left; }
.im-table thead th { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #6f80a8; }
.im-table tbody th { color: #fff; font-weight: 700; }
.im-table td { color: #d4def8; }
.im-mapwrap { display: flex; justify-content: center; }
.im-map { display: block; border-radius: 14px; border: 1px solid var(--im-line); cursor: crosshair; touch-action: manipulation; }

.im-toast[hidden] { display: none; }
.im-toast { position: absolute; left: 50%; bottom: calc(var(--im-bar) + 10px); transform: translateX(-50%); z-index: 5; width: max-content; max-width: calc(100% - 104px); padding: 8px 14px; border-radius: 18px; background: #e3ebff; color: #060a1a;
  font-size: 13px; font-weight: 800; line-height: 1.3; text-align: center; animation: im-rise .2s ease-out; pointer-events: none; box-shadow: 0 8px 26px rgba(0,0,0,.4); }
.im-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.im-help { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 14px; }
.im-help .hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .im-help .hint-kb { display: none; } .im-help .hint-touch { display: inline; } }
.stage .im-help { padding: 10px 14px 12px; }

/* narrow phones */
.im-narrow .im-hud { gap: 9px; padding-left: 8px; padding-right: 6px; }
.im-narrow .im-pz { padding-right: 22px; padding-left: 8px; min-width: 0; max-width: 40vw; }
.im-narrow .im-pz-n { font-size: 14.5px; }
.im-narrow .im-pz-lv { font-size: 9px; letter-spacing: 0.08em; }
.im-narrow.im-coaching .im-side { visibility: hidden; }
.im-narrow .im-stat b { font-size: 19px; }
.im-narrow .im-tool { width: 36px; height: 36px; border-radius: 11px; }
.im-narrow .im-btn, .im-narrow .im-md { font-size: 10.5px; border-radius: 12px; }
.im-narrow .im-md { border-radius: 10px; }
.im-narrow .im-dist { padding: 3px 7px 4px; }
/* on a phone the clock (when it's on) sits in a small chip at the top left of the field, across from the map */
.im-narrow .im-time { position: absolute; left: 8px; top: calc(var(--im-hud) + 2px); flex-direction: row; align-items: baseline; gap: 6px; padding: 4px 9px 5px; border-radius: 10px;
  background: var(--im-glass); border: 1px solid var(--im-line); pointer-events: none; }
.im-narrow .im-time .im-k { font-size: 9px; }
.im-narrow .im-time b { font-size: 14px; margin-top: 0; }
.im-narrow.im-coaching .im-time { visibility: hidden; }
@media (max-width: 460px) {
  .im-panel { padding: 18px 14px 14px; }
  .im-card .im-row svg { display: none; }
  .im-card .im-row .im-b { padding: 6px 4px; }
  .im-stats b { font-size: 15px; }
  .im-stats span { letter-spacing: 0.05em; font-size: 9px; }
  .im-tab { font-size: 12.5px; padding: 0 2px; }
  .im-seg button b { font-size: 12.5px; }
}
@media (max-width: 380px) { #im-sound { display: none; } .im-lives svg { width: 14px; height: 14px; } }

/* full screen: the field takes every pixel */
.stage.is-immersive .stage-body > .im { min-height: 0; flex: 1 1 auto; }
.stage.is-immersive .im-stage { flex: 1 1 auto; height: auto; aspect-ratio: auto; max-height: none; min-height: 0; }
.stage.is-immersive .im-help { display: none; }
@media (prefers-reduced-motion: reduce) { .im-panel, .im-toast, .im-coach, .im-overlay, .im-card { animation: none; } .im-tag { animation: none; } .im-score b.pop, .im-lives svg.lost, .im-lives-mini svg.lost { animation: none; } #im-arrow { transition: none; } }
.im-calm .im-panel, .im-calm .im-toast, .im-calm .im-coach, .im-calm .im-overlay, .im-calm .im-card { animation: none; } .im-calm .im-score b.pop, .im-calm .im-lives svg.lost, .im-calm .im-lives-mini svg.lost { animation: none; }
