/* No More Space: the start screen, the title menu and the game's own dialogs. Loaded after every other stylesheet.
   The controls here reset the global "hardware button" look (retro.css) and draw their own, so none of the
   .primary / .ghost / .danger / .on rules leak in: they use go, quiet, bad and picked instead. */

/* ---------- shared control reset ---------- */
.nm-item, .nm-btn, .opt, .mission, .nm-callsign, .nm-link { all: unset; box-sizing: border-box; cursor: pointer; font-family: var(--font-body); -webkit-tap-highlight-color: transparent; }
.nm-item:focus-visible, .nm-btn:focus-visible, .opt:focus-visible, .mission:focus-visible, .nm-callsign:focus-visible, .nm-link:focus-visible { outline: 2px dashed var(--phosphor); outline-offset: 3px; }
.nm-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------- the logo ---------- */
.nm-logo { margin: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; font-family: var(--font-display); font-weight: 400; line-height: 1; letter-spacing: 0.02em; text-transform: none; animation: nm-flicker 6s infinite; }
.nm-logo .l1 { font-size: clamp(1.9rem, 4.4vw, 3.3rem); color: #eaf6ff; text-shadow: -2px 0 rgba(255, 46, 77, 0.7), 2px 0 rgba(60, 200, 255, 0.7), 0 0 28px rgba(108, 240, 255, 0.55); }
.nm-logo .l2 { font-family: var(--font-spooky); font-size: clamp(2.5rem, 6.2vw, 4.7rem); letter-spacing: 0.06em; color: var(--blood); text-shadow: 0 0 26px rgba(255, 46, 77, 0.7), 3px 0 rgba(60, 200, 255, 0.5); animation: nm-tear 9s infinite; }
@keyframes nm-flicker { 0%, 92%, 100% { opacity: 1; } 93% { opacity: 0.45; } 94% { opacity: 1; } 96% { opacity: 0.65; } }
@keyframes nm-tear { 0%, 95%, 100% { transform: none; clip-path: none; } 96% { transform: translateX(-5px) skewX(8deg); clip-path: inset(30% 0 40% 0); } 97% { transform: translateX(4px); clip-path: inset(60% 0 10% 0); } }

/* ---------- the start screen ---------- */
.nm-splash { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 50% 45%, rgba(3, 4, 12, 0.25) 0%, rgba(3, 4, 12, 0.82) 80%); transition: opacity 0.9s ease; }
.nm-splash.out { opacity: 0; pointer-events: none; }
.sp-center { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.nm-splash .nm-logo { align-items: center; gap: 10px; }
.nm-splash .nm-logo .l1 { font-size: clamp(2.2rem, 7vw, 4.6rem); }
.nm-splash .nm-logo .l2 { font-size: clamp(3rem, 10.5vw, 7rem); }
.sp-tag { margin: 0; max-width: 32em; font-size: clamp(1.05rem, 2vw, 1.3rem); line-height: 1.4; color: #c4cbe6; text-shadow: 0 1px 2px #000, 0 0 16px rgba(0, 0, 0, 0.95); }
.sp-load { width: min(380px, 72vw); height: 8px; margin-top: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); }
.sp-load i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--phosphor), #fff); box-shadow: 0 0 14px var(--phosphor); transition: width 0.3s ease; }
.sp-status { margin: 0; font-size: 1rem; color: var(--muted); }
.sp-press { margin: 6px 0 0; font-family: var(--font-title); font-size: clamp(1.1rem, 2.4vw, 1.6rem); letter-spacing: 0.22em; text-transform: uppercase; color: #fff; text-shadow: 0 0 16px var(--phosphor); animation: nm-pulse 1.5s ease-in-out infinite; }
.sp-tip { position: absolute; left: 50%; bottom: 26px; width: min(680px, 90vw); margin: 0; transform: translateX(-50%); text-align: center; font-size: 1rem; line-height: 1.35; color: #aab3d6; text-shadow: 0 1px 2px #000; }
.sp-tip b { color: var(--phosphor); font-family: var(--font-title); letter-spacing: 0.12em; margin-right: 6px; }
@keyframes nm-pulse { 50% { opacity: 0.35; } }

/* ---------- the title menu ---------- */
#screen-home { transition: opacity 0.8s ease; display: block; padding: 0; overflow: hidden; background: linear-gradient(90deg, rgba(3, 4, 12, 0.94) 0%, rgba(3, 4, 12, 0.8) 34%, rgba(3, 4, 12, 0) 64%); }
.nm-home { position: absolute; inset: 0; display: flex; }
.nm-col { width: min(560px, 100%); height: 100%; overflow-y: auto; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 44px clamp(20px, 4vw, 56px) 24px; scrollbar-width: none; }
.nm-col::-webkit-scrollbar { display: none; }
.nm-top { display: flex; flex-direction: column; gap: 12px; }
.nm-tag { margin: 0; max-width: 30em; font-size: 1.05rem; line-height: 1.4; color: #b7bfdf; text-shadow: 0 1px 2px #000, 0 0 14px rgba(0, 0, 0, 0.95); }

.nm-callsign { display: inline-flex; align-self: flex-start; align-items: center; gap: 10px; padding: 8px 16px 8px 12px; background: rgba(8, 12, 28, 0.72); border: 1px solid var(--line); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%); transition: border-color 0.2s, background 0.2s; }
.nm-callsign:hover { border-color: var(--phosphor); background: rgba(16, 48, 66, 0.8); }
.nm-callsign .cs-av { font-size: 1.4rem; }
.nm-callsign .cs-name { font: 700 1.15rem var(--font-body); color: #fff; }
.nm-callsign .cs-edit { font: 0.78rem var(--font-title); letter-spacing: 0.14em; text-transform: uppercase; color: var(--phosphor); }

.nm-menu { display: flex; flex-direction: column; gap: 6px; }
.nm-item { display: flex; align-items: center; gap: 16px; width: 100%; padding: 9px 20px 9px 16px; color: #cfe4ff; background: rgba(8, 11, 26, 0.6); border-left: 4px solid transparent; clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%); transition: transform 0.18s cubic-bezier(0.3, 1.5, 0.5, 1), background 0.18s, border-color 0.18s, color 0.18s; }
.nm-item:hover:not(:disabled), .nm-item.sel { transform: translateX(10px); color: #fff; border-left-color: var(--phosphor); background: linear-gradient(90deg, rgba(108, 240, 255, 0.3), rgba(8, 11, 26, 0.74) 85%); }
.nm-item:active:not(:disabled) { transform: translateX(10px) scale(0.985); background: linear-gradient(90deg, rgba(108, 240, 255, 0.5), rgba(8, 11, 26, 0.8) 85%); }
.nm-item .mi-emoji { flex: none; width: 44px; text-align: center; font-size: 1.9rem; line-height: 1; filter: drop-shadow(0 0 8px rgba(108, 240, 255, 0.35)); }
.nm-item .mi-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nm-item .mi-label { font: 800 clamp(1.05rem, 1.5vw, 1.35rem) / 1.15 var(--font-title); letter-spacing: 0.06em; text-transform: uppercase; }
.nm-item .mi-sub { font: 500 1rem / 1.25 var(--font-body); color: #9fb0d6; }
.nm-item.sel .mi-sub, .nm-item:hover .mi-sub { color: #d8e8ff; }
.nm-item .mi-go { flex: none; font-size: 2rem; line-height: 1; color: var(--phosphor); opacity: 0; transform: translateX(-8px); transition: opacity 0.18s, transform 0.18s; }
.nm-item.sel .mi-go, .nm-item:hover .mi-go { opacity: 1; transform: none; }

.nm-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-top: 4px; }
.nm-link { display: inline-block; font: 600 1rem var(--font-body); color: var(--phosphor); text-shadow: 0 1px 2px #000; }
.nm-link:hover { color: #fff; text-decoration: underline; }
.nm-link.off { color: var(--muted); }
.nm-link.wide { display: block; margin: 6px auto 0; text-align: center; }
.nm-count { margin-left: auto; font-size: 0.95rem; color: var(--muted); }
.nm-keyhints { display: flex; flex-wrap: wrap; gap: 6px 20px; color: var(--muted); font-size: 0.95rem; }
.nm-keyhints .kh { display: inline-flex; align-items: center; gap: 6px; }
.nm-keyhints kbd { display: inline-block; min-width: 26px; padding: 1px 7px; border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 4px; background: rgba(255, 255, 255, 0.06); color: #dfe9ff; font: 0.8rem var(--font-small); text-align: center; }

.nm-home.enter .nm-top, .nm-home.enter .nm-callsign, .nm-home.enter .nm-foot, .nm-home.enter .nm-keyhints { animation: nm-rise 0.8s cubic-bezier(0.2, 1, 0.4, 1) both; }
.nm-home.enter .nm-callsign { animation-delay: 0.12s; }
.nm-home.enter .nm-item { animation: nm-rise 0.7s cubic-bezier(0.2, 1, 0.4, 1) both; animation-delay: calc(0.18s + var(--i) * 0.06s); }
.nm-home.enter .nm-foot, .nm-home.enter .nm-keyhints { animation-delay: 0.7s; }
@keyframes nm-rise { from { opacity: 0; transform: translateY(16px); } }

/* while the start screen is up, the menu waits behind it */
body:has(#nm-splash:not(.out)) #screen-home { opacity: 0; pointer-events: none; }

/* ---------- the flash between screens ---------- */
.nm-warp { position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: 0; background: radial-gradient(circle at 50% 50%, #fff 0%, rgba(160, 240, 255, 0.9) 16%, rgba(108, 240, 255, 0) 68%); }
.nm-warp.go { animation: nm-warp 0.9s ease-out; }
@keyframes nm-warp { 0% { opacity: 0; transform: scale(0.4); } 18% { opacity: 0.95; } 100% { opacity: 0; transform: scale(2.4); } }

/* ---------- dialogs ---------- */
.nm-dialogs { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.nm-dialog-wrap { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(2, 3, 10, 0.68); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); pointer-events: auto; animation: nm-fade 0.2s ease both; }
.nm-dialog-wrap.closing { opacity: 0; transition: opacity 0.2s; }
@keyframes nm-fade { from { opacity: 0; } }
.nm-dialog { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px 24px 20px; background: var(--panel-solid); border: 1px solid var(--line); border-top: 3px solid var(--phosphor); box-shadow: var(--shadow), 0 0 40px rgba(108, 240, 255, 0.12); animation: nm-pop 0.3s cubic-bezier(0.2, 1.2, 0.4, 1) both; }
.nm-dialog.wide { width: min(1000px, 100%); }
.nm-dialog.bad { border-top-color: var(--blood); }
@keyframes nm-pop { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
.dlg-head h2 { margin: 0 0 12px; font-size: 1.4rem; }
.dlg-body p { margin: 0 0 12px; font-size: 1.1rem; line-height: 1.45; }
.dlg-body .muted { color: var(--muted); }
.dlg-body .hint { font-size: 1rem; }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.nm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; font: 800 0.95rem var(--font-title); letter-spacing: 0.08em; text-transform: uppercase; color: #dff6ff; background: rgba(108, 240, 255, 0.12); border: 1px solid rgba(108, 240, 255, 0.5); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px)); transition: background 0.15s, color 0.15s, transform 0.1s; }
.nm-btn:hover:not(:disabled) { background: rgba(108, 240, 255, 0.28); color: #fff; }
.nm-btn:active:not(:disabled) { transform: translateY(1px); }
.nm-btn.go { color: #02141d; background: linear-gradient(180deg, #9af7ff, #2bbfe2); border-color: #d6fdff; }
.nm-btn.go:hover:not(:disabled) { background: linear-gradient(180deg, #c8fbff, #4fd6f2); color: #001820; }
.nm-btn.bad { color: #ffd2da; background: rgba(110, 0, 22, 0.7); border-color: var(--blood); }
.nm-btn.bad:hover:not(:disabled) { background: rgba(160, 10, 40, 0.9); color: #fff; }
.nm-btn.quiet { background: none; border-color: transparent; color: var(--muted); }
.nm-btn.quiet:hover:not(:disabled) { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nm-btn.dice { padding: 8px 14px; font-size: 1.5rem; }

/* launch: who runs the game? */
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 14px; }
.opt { display: flex; flex-direction: column; gap: 6px; padding: 16px; background: rgba(255, 255, 255, 0.04); border: 2px solid rgba(255, 255, 255, 0.12); transition: border-color 0.15s, background 0.15s, transform 0.15s; }
.opt:hover { border-color: rgba(108, 240, 255, 0.5); transform: translateY(-2px); }
.opt.picked { border-color: var(--phosphor); background: rgba(108, 240, 255, 0.12); box-shadow: 0 0 22px rgba(108, 240, 255, 0.22); }
.opt .opt-ico { font-size: 2.4rem; line-height: 1; }
.opt b { font: 800 1.1rem var(--font-title); letter-spacing: 0.05em; text-transform: uppercase; color: #fff; }
.opt small { font-size: 1rem; line-height: 1.35; color: #a9b6d9; }

/* board: four letter boxes */
.code-row { display: flex; justify-content: center; gap: 12px; margin: 20px 0 10px; }
.code-box { all: unset; box-sizing: border-box; width: 64px; height: 80px; text-align: center; font: 900 2.6rem var(--font-digital); color: #fff; text-transform: uppercase; caret-color: var(--phosphor); background: rgba(255, 255, 255, 0.06); border: 2px solid rgba(255, 255, 255, 0.2); transition: border-color 0.15s, box-shadow 0.15s; }
.code-box:focus { border-color: var(--phosphor); box-shadow: 0 0 20px rgba(108, 240, 255, 0.4); }

/* your name */
.name-form { display: flex; gap: 10px; align-items: stretch; }
.name-input { flex: 1; min-width: 0; padding: 12px 14px; font: 600 1.4rem var(--font-body); }

/* practice: pick a script */
.mission-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 6px; }
.mission { --mc: var(--phosphor); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px 20px; background: linear-gradient(160deg, color-mix(in srgb, var(--mc) 16%, #0b0f22), #0b0f22 70%); border: 2px solid color-mix(in srgb, var(--mc) 45%, transparent); transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s; }
.mission:hover, .mission:focus-visible { border-color: var(--mc); transform: translateY(-3px); box-shadow: 0 0 26px color-mix(in srgb, var(--mc) 35%, transparent); }
.mission.m-carnival { --mc: #ff5fb0; }
.mission.m-outbreak { --mc: #6bff9b; }
.mission.m-traitors { --mc: #ffb547; }
.mission .ms-ico { font-size: 3.8rem; line-height: 1; filter: drop-shadow(0 0 12px color-mix(in srgb, var(--mc) 60%, transparent)); }
.mission .ms-name { font: 800 1.3rem var(--font-title); letter-spacing: 0.05em; text-transform: uppercase; color: #fff; }
.mission .ms-tag { font-size: 1.05rem; line-height: 1.4; color: #bcc7e6; }
.mission .ms-pill { margin-top: 4px; padding: 3px 10px; font: 0.8rem var(--font-title); letter-spacing: 0.1em; text-transform: uppercase; color: var(--mc); border: 1px solid color-mix(in srgb, var(--mc) 60%, transparent); }

/* ---------- the docking bay (lobby): bigger, easier to read and tap ---------- */
#screen-lobby .lobby-left, #screen-lobby .lobby-right { width: min(400px, calc(50vw - 24px)); padding: 20px 20px 24px; scrollbar-width: thin; }
#screen-lobby .eyebrow { font-size: 0.95rem; }
#screen-lobby .lobby-head h2 { font-size: 1.7rem; margin: 2px 0 4px; }
#screen-lobby .lobby-head .code { font-family: var(--font-digital); font-size: 1.15em; letter-spacing: 0.14em; color: var(--phosphor); text-shadow: 0 0 14px rgba(108, 240, 255, 0.5); }
#screen-lobby .lobby-ship { font-size: 1rem; }
#screen-lobby h3 { font-size: 1.1rem; margin: 18px 0 8px; }
#screen-lobby .hint, #screen-lobby label, #screen-lobby .muted { font-size: 1.05rem; line-height: 1.35; }
#screen-lobby .bio-field input { font-size: 1.15rem; padding: 12px 14px; }
#screen-lobby .swatches { gap: 8px; }
#screen-lobby .swatch { width: 36px; height: 36px; }
#screen-lobby .chips { display: flex; flex-wrap: wrap; gap: 8px; }
#screen-lobby .chip { font-size: 0.9rem; padding: 8px 12px; }
#screen-lobby .lobby-players { gap: 8px; }
#screen-lobby .lobby-players li { padding: 10px 12px; gap: 10px; }
#screen-lobby .lobby-players .name { font-size: 1.2rem; font-weight: 700; }
#screen-lobby .lobby-players .bio { font-size: 1rem; }
#screen-lobby .lobby-players .dot { width: 18px; height: 18px; }
#screen-lobby .lobby-players button { padding: 6px 10px; font-size: 0.9rem; }
#screen-lobby .script-cards { gap: 10px; }
#screen-lobby .script-card { grid-template-columns: 3rem 1fr; padding: 12px 14px; gap: 2px 14px; }
#screen-lobby .script-card .script-ico { font-size: 2.4rem; }
#screen-lobby .script-card b { font-size: 1.15rem; letter-spacing: 0.04em; }
#screen-lobby .script-card small { font-size: 1.02rem; line-height: 1.25; }
#screen-lobby .script-current b { font-size: 1.15rem; }
#screen-lobby .lobby-setup button, #screen-lobby .lobby-setup select { font-size: 1rem; }
#screen-lobby .lobby-setup .check { font-size: 1.02rem; line-height: 1.3; }
/* the settings block flows straight in the scrolling panel, so the Launch button can stay in view while you scroll */
#screen-lobby .lobby-setup { display: contents; }
#screen-lobby .lobby-setup > * { margin: 0 0 10px; }
#screen-lobby .lobby-setup > h3 { margin-top: 18px; }
/* the Launch button stays in view while you scroll the settings */
#screen-lobby .lobby-setup > button.primary.big { position: sticky; bottom: -2px; z-index: 2; padding: 18px 22px; font-size: 1.15rem; box-shadow: 0 -14px 20px -4px rgba(10, 13, 28, 0.95), 0 0 26px rgba(108, 240, 255, 0.45); }
#screen-lobby #lobby-wait { font-size: 1.05rem; }

/* ---------- the in-game menu ---------- */
body.has-menu #btn-settings, body.has-menu #btn-wiki, body.has-menu #btn-tts, body.has-menu #btn-help, body.has-menu #btn-pause { display: none !important; }
.menu-btn { font-size: 1.25rem; }
.pause-body .nm-menu { margin: 6px 0 12px; }
.nm-dialog .nm-item { background: rgba(255, 255, 255, 0.05); }
.nm-item.bad:hover:not(:disabled), .nm-item.bad.sel { border-left-color: var(--blood); background: linear-gradient(90deg, rgba(255, 46, 77, 0.3), rgba(8, 11, 26, 0.74) 85%); }
.nm-item.bad .mi-go { color: var(--blood); }

/* ---------- smaller screens ---------- */
@media (max-width: 820px) {
  #screen-home { background: linear-gradient(0deg, rgba(3, 4, 12, 0.96) 0%, rgba(3, 4, 12, 0.88) 58%, rgba(3, 4, 12, 0) 82%); }
  .nm-col { width: 100%; justify-content: flex-end; gap: 10px; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
  .nm-tag, .nm-keyhints { display: none; }
  .nm-top { flex-direction: row; align-items: baseline; gap: 12px; }
  .nm-logo { flex-direction: row; align-items: baseline; gap: 10px; }
  .nm-logo .l1 { font-size: 1.25rem; }
  .nm-logo .l2 { font-size: 1.7rem; }
  .nm-item { gap: 12px; padding: 8px 14px 8px 10px; }
  .nm-item .mi-emoji { width: 34px; font-size: 1.5rem; }
  .nm-item .mi-label { font-size: 1.05rem; }
  .nm-item .mi-sub { font-size: 0.9rem; }
  .nm-item:hover:not(:disabled), .nm-item.sel { transform: translateX(4px); }
  .opt-grid, .mission-grid { grid-template-columns: 1fr; }
  .code-box { width: 56px; height: 70px; font-size: 2.2rem; }
  .nm-dialog { padding: 18px 16px 16px; }
  .nm-splash .nm-logo { flex-direction: column; align-items: center; }
  .sp-tip { bottom: 14px; font-size: 0.9rem; }
}
@media (max-height: 700px) and (min-width: 821px) {
  .nm-col { gap: 10px; padding-top: 40px; }
  .nm-tag, .nm-item .mi-sub { display: none; }
  .nm-item { padding: 7px 20px 7px 16px; }
}
@media (hover: none) { .nm-keyhints { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .nm-logo, .nm-logo .l2, .sp-press, .nm-warp.go { animation: none !important; }
  .nm-home.enter .nm-item, .nm-home.enter .nm-top, .nm-home.enter .nm-callsign, .nm-home.enter .nm-foot, .nm-home.enter .nm-keyhints { animation: none; }
}

/* keyboard hints off: the keys still work, the screen stays clean */
.keyhints, .nm-keyhints, .home-hints { display: none !important; }
