/* Menu pages in the main menu's style (the mockup-A pages): the Field Guide (with its WEAPONS tab), Patch
   Notes and Save open full screen with a BACK pill, a chrome title and a one-line explanation, their
   entries on dark rounded cards. Over the title the overlay is almost clear, so the title's moving backdrop
   (js/title-menu.js) shows through; from pause and game over it keeps the dimmed world behind it.
   Same markup and ids as before (js/field-guide-ui.js, js/patch-notes.js, js/save-ui.js). */

:is(#guide-modal, #save-modal, #notes-modal, #feedback-modal) {
  padding: 0;
  background: radial-gradient(circle at 50% 30%, rgba(24, 4, 46, 0.86), rgba(6, 1, 14, 0.95));
}
/* Over the title: let the dusk sky, stars and asteroids through. */
body.menu-held :is(#guide-modal, #save-modal, #notes-modal, #feedback-modal) {
  background: linear-gradient(180deg, rgba(12, 0, 32, 0.38), rgba(7, 2, 15, 0.62));
}

:is(#guide-modal, #save-modal, #notes-modal, #feedback-modal) > .guide-card {
  max-width: none;
  width: 100%;
  height: 100%;
  max-height: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--tm-text);
  /* The content keeps a readable width on wide screens; the gutters clear the notch on phones. */
  padding: max(18px, env(safe-area-inset-top, 0px)) max(var(--tm-pad-r), calc((100% - 1320px) / 2)) max(10px, env(safe-area-inset-bottom, 0px)) max(var(--tm-pad-l), calc((100% - 1320px) / 2));
  gap: 14px;
}
.modal-overlay:not(.hidden):is(#guide-modal, #save-modal, #notes-modal, #feedback-modal) > .guide-card { animation: page-in 0.26s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Head: BACK, chrome title with its one-liner, and the page's stat on the right. */
.page-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  padding: 0 0 4px;
  border: 0;
}
.page-head-text { flex: 1; min-width: 240px; }
.page-title.guide-title {
  margin: 0;
  font-size: clamp(28px, 3vw, 42px);
  letter-spacing: 0.08em;
  text-shadow: none;
  line-height: 1.05;
}
.page-sub-line { margin: 4px 0 0; font: 600 14px/1.35 'Segoe UI', system-ui, sans-serif; color: var(--tm-dim); max-width: 70ch; }
.page-stat.guide-progress {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(0, 255, 136, 0.4);
  color: #7dffc0;
  font: 800 11.5px/1 'Segoe UI', system-ui, sans-serif;
  letter-spacing: 2px;
}
.page-stat:empty { display: none; }
.page-stat .version-tag { font-size: 11px; padding: 2px 8px; margin: 0; }
.page-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(238, 246, 255, 0.25);
  background: transparent;
  color: #dfe8fb;
  font: 800 12.5px/1 'Segoe UI', system-ui, sans-serif;
  letter-spacing: 2px;
  cursor: pointer;
  flex: none;
  transition: background 0.14s, border-color 0.14s, transform 0.1s;
}
.page-back:hover, .page-back:focus-visible, .page-back.gp-focus { border-color: #00f3ff; background: rgba(0, 243, 255, 0.1); outline: none; }
.page-back:active { transform: scale(0.96); }
.page-key { color: var(--tm-dim); font-weight: 700; letter-spacing: 0.5px; }

/* Field Guide tabs: pills. */
#guide-modal .guide-tabs { margin: 0; gap: 8px; flex-wrap: wrap; }
#guide-modal .guide-tab {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid rgba(238, 246, 255, 0.18);
  background: rgba(10, 4, 24, 0.6);
  color: #cfdaf0;
  font-size: 12px;
  letter-spacing: 2.5px;
  text-shadow: none;
}
#guide-modal .guide-tab:hover, #guide-modal .guide-tab.gp-focus { border-color: #00f3ff; background: rgba(0, 243, 255, 0.1); }
#guide-modal .guide-tab.active { border-color: #00f3ff; background: rgba(0, 243, 255, 0.16); color: #fff; }

/* Bodies and entries: dark rounded cards. */
:is(#guide-modal, #save-modal, #notes-modal, #feedback-modal) .guide-body { padding: 2px 6px 12px 0; scrollbar-width: thin; scrollbar-color: rgba(0, 243, 255, 0.4) transparent; }
:is(#guide-modal, #save-modal, #notes-modal, #feedback-modal) .guide-section-title { color: #ffe3f4; text-shadow: 0 0 10px rgba(255, 42, 138, 0.7); font-family: var(--tm-mono); letter-spacing: 3px; opacity: 1; }
#guide-modal .guide-grid { gap: 16px; }
#guide-modal .guide-entry,
#notes-modal .notes-entry,
#save-modal .save-sec {
  border-radius: 18px;
  border: 1px solid rgba(238, 246, 255, 0.14);
  background: rgba(8, 12, 28, 0.8);
}
#guide-modal .guide-entry { padding: 16px; }
#notes-modal .notes-entry.latest { border-color: rgba(0, 243, 255, 0.55); box-shadow: none; }
#notes-modal .notes-head { border-radius: 18px; padding: 14px 18px; min-height: 48px; }
#notes-modal .notes-card .guide-body,
#notes-modal .notes-body { max-width: 980px; }
#save-modal .save-body { max-width: 900px; gap: 16px; }
#save-modal .save-sec { padding: 18px 20px; gap: 10px; }
#save-modal .save-h { font-size: 13px; letter-spacing: 4px; color: #5aa8ff; }
#save-modal .save-btn { min-height: 44px; padding: 0 18px; border-radius: 999px; font-size: 12px; letter-spacing: 2px; }

/* Foot: the controls, left aligned like the main menu's hint row. */
:is(#guide-modal, #save-modal, #notes-modal, #feedback-modal) .guide-foot {
  justify-content: flex-start;
  border: 0;
  padding: 0;
  font: 600 12px/1.6 var(--tm-mono);
  letter-spacing: 1px;
  color: var(--tm-dim);
}
:is(#guide-modal, #save-modal, #notes-modal, #feedback-modal) .guide-foot b { color: var(--tm-text); }
body.touch-mode :is(#guide-modal, #save-modal, #notes-modal, #feedback-modal) .guide-foot { display: none; }

/* Short screens (phone landscape): tighter head, no one-liner. */
@media (max-height: 560px) {
  :is(#guide-modal, #save-modal, #notes-modal, #feedback-modal) > .guide-card { padding-top: max(8px, env(safe-area-inset-top, 0px)); gap: 8px; }
  .page-head { gap: 10px; }
  .page-sub-line { display: none; }
  .page-title.guide-title { font-size: 26px; }
  .page-stat.guide-progress { min-height: 34px; font-size: 10px; }
  #guide-modal .guide-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  #guide-modal .guide-tab { min-height: 40px; padding: 0 16px; flex: none; }
}
@media (max-width: 700px) {
  .page-head-text { min-width: 0; }
  .page-sub-line { display: none; }
  .page-title.guide-title { font-size: 26px; }
  #guide-modal .guide-tab { padding: 0 12px; letter-spacing: 1.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .modal-overlay:not(.hidden):is(#guide-modal, #save-modal, #notes-modal, #feedback-modal) > .guide-card { animation: none; }
}

/* ---------- 💬 FEEDBACK panel (js/feedback.js) ---------- */
#feedback-modal > .guide-card { max-width: none; }
.feedback-body { display: block; }
.fb-form { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 20px; align-items: start; max-width: 1180px; }
.fb-main, .fb-side { display: grid; gap: 16px; min-width: 0; }
.fb-sec { display: grid; gap: 10px; padding: 18px 20px; border-radius: 18px; border: 1px solid rgba(238, 246, 255, 0.14); background: rgba(8, 12, 28, 0.8); }
.fb-sec h3 { margin: 0; font: 900 13px/1.2 'Segoe UI', system-ui, sans-serif; letter-spacing: 3.5px; color: #00f3ff; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.fb-hint { font: 600 12px/1.2 'Segoe UI', system-ui, sans-serif; letter-spacing: 0.5px; color: var(--tm-dim); text-transform: none; }
.fb-rating { display: flex; gap: 10px; flex-wrap: wrap; }
.fb-rate {
  display: grid; place-items: center; gap: 2px; width: 64px; height: 64px;
  border-radius: 16px; border: 1px solid rgba(238, 246, 255, 0.2); background: rgba(10, 4, 24, 0.6);
  color: var(--tm-text); cursor: pointer; font: inherit;
  transition: transform 0.14s cubic-bezier(0.2, 0.9, 0.3, 1.5), border-color 0.14s, background 0.14s;
}
.fb-rate span { font-size: 28px; line-height: 1; filter: grayscale(0.7); transition: filter 0.14s; }
.fb-rate small { font: 700 10px/1 var(--tm-mono); color: var(--tm-dim); }
.fb-rate:hover, .fb-rate:focus-visible, .fb-rate.gp-focus { border-color: #ffcc00; outline: none; transform: translateY(-2px); }
.fb-rate:hover span, .fb-rate.on span { filter: none; }
.fb-rate.on { border-color: #ffcc00; background: rgba(255, 204, 0, 0.16); transform: scale(1.08); }
.fb-cats { display: flex; gap: 8px; flex-wrap: wrap; }
.fb-cat {
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(238, 246, 255, 0.18);
  background: rgba(10, 4, 24, 0.6); color: #cfdaf0; cursor: pointer;
  font: 800 12px/1 'Segoe UI', system-ui, sans-serif; letter-spacing: 1.5px;
  transition: border-color 0.14s, background 0.14s, transform 0.1s;
}
.fb-cat:hover, .fb-cat:focus-visible, .fb-cat.gp-focus { border-color: #00f3ff; outline: none; }
.fb-cat.on { border-color: #00f3ff; background: rgba(0, 243, 255, 0.18); color: #fff; }
.fb-cat:active, .fb-rate:active { transform: scale(0.95); }
#feedback-text, #feedback-contact {
  width: 100%; box-sizing: border-box; border-radius: 12px; border: 1px solid rgba(0, 243, 255, 0.3);
  background: rgba(3, 6, 16, 0.85); color: var(--tm-text); font: 500 15px/1.45 'Segoe UI', system-ui, sans-serif;
  padding: 12px 14px; resize: vertical; min-height: 44px;
}
#feedback-text { min-height: 110px; }
#feedback-text:focus, #feedback-contact:focus, #feedback-text.gp-focus, #feedback-contact.gp-focus { outline: none; border-color: #00f3ff; box-shadow: 0 0 0 2px rgba(0, 243, 255, 0.25); }
.fb-count { justify-self: end; font: 600 11px/1 var(--tm-mono); color: var(--tm-dim); }
.fb-context ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.fb-context li { font: 600 13px/1.35 var(--tm-mono); color: #cfe3ff; padding-left: 16px; position: relative; overflow-wrap: anywhere; }
.fb-context li::before { content: "›"; position: absolute; left: 0; color: #ff2a8a; }
.fb-note { margin: 0; font-size: 12.5px; line-height: 1.4; color: var(--tm-dim); }
.fb-actions { display: grid; gap: 10px; }
.fb-send {
  min-height: 56px; border-radius: 999px; border: 0; cursor: pointer;
  background: linear-gradient(90deg, #00f3ff, #ff2a8a); color: #07020f;
  font: 900 16px/1 'Segoe UI', system-ui, sans-serif; letter-spacing: 4px;
  transition: transform 0.14s cubic-bezier(0.2, 0.9, 0.3, 1.4), filter 0.14s, opacity 0.14s;
}
.fb-send:hover:not(:disabled), .fb-send:focus-visible, .fb-send.gp-focus { transform: translateY(-2px); filter: brightness(1.12); outline: none; }
.fb-send:active:not(:disabled) { transform: scale(0.97); }
.fb-send:disabled { opacity: 0.35; cursor: default; }
.fb-status { min-height: 18px; font: 600 13px/1.4 'Segoe UI', system-ui, sans-serif; color: var(--tm-dim); }
.fb-status[data-tone="warn"] { color: #ffb36b; }
/* Thank-you: a ring burst round a check, a chrome THANKS, and the way back. */
.fb-thanks { display: grid; justify-items: center; align-content: center; gap: 16px; min-height: 60vh; text-align: center; }
.fb-thanks:not(.hidden) { animation: fb-thanks-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
.fb-thanks p { margin: 0; color: #cfdaf0; font-size: 15px; max-width: 46ch; }
.fb-thanks-title { font-size: clamp(34px, 5vw, 64px); margin: 0; }
.fb-burst { position: relative; width: 110px; height: 110px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle, rgba(0, 255, 136, 0.25), transparent 70%); }
.fb-burst span { font: 900 56px/1 'Segoe UI', system-ui, sans-serif; color: #00ff88; text-shadow: 0 0 18px rgba(0, 255, 136, 0.8); }
.fb-burst::before, .fb-burst::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid #00ff88; opacity: 0; }
.fb-thanks:not(.hidden) .fb-burst::before { animation: fb-ring 0.9s ease-out 0.05s both; }
.fb-thanks:not(.hidden) .fb-burst::after { animation: fb-ring 0.9s ease-out 0.25s both; border-color: #ff2a8a; }
.fb-thanks:not(.hidden) .fb-burst span { animation: fb-pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.6) both; }
@keyframes fb-thanks-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes fb-ring { 0% { opacity: 0.9; transform: scale(0.6); } 100% { opacity: 0; transform: scale(2.1); } }
@keyframes fb-pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }
.fb-beta-stat { border-color: rgba(255, 42, 138, 0.5); color: #ffb3d6; }
@media (max-width: 900px), (max-height: 560px) {
  .fb-form { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .fb-sec { padding: 12px 14px; gap: 8px; }
  .fb-rate { width: 52px; height: 52px; }
  .fb-rate span { font-size: 22px; }
  #feedback-text { min-height: 80px; }
  .fb-beta-stat { display: none; }
  .fb-thanks { min-height: 0; padding: 12px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .fb-thanks:not(.hidden), .fb-thanks:not(.hidden) .fb-burst span, .fb-thanks:not(.hidden) .fb-burst::before, .fb-thanks:not(.hidden) .fb-burst::after { animation: none; }
}

/* 💬 FEEDBACK buttons: pause, victory and game over (the game-over one leads, "How was that run?"). */
.neon-btn.feedback-btn { border-color: rgba(255, 42, 138, 0.7); color: #ffd1e6; }
.neon-btn.feedback-btn:hover, .neon-btn.feedback-btn.gp-focus { background: rgba(255, 42, 138, 0.18); color: #fff; }
.go-feedback {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  margin: 14px auto 6px; padding: 10px 14px 10px 20px; width: fit-content; max-width: 100%;
  border-radius: 999px; border: 1px solid rgba(255, 42, 138, 0.45);
  background: linear-gradient(90deg, rgba(255, 42, 138, 0.12), rgba(0, 243, 255, 0.08));
}
.go-feedback-ask { font: 800 15px/1.2 'Segoe UI', system-ui, sans-serif; letter-spacing: 1px; color: #fff; }
.neon-btn.go-feedback-btn { margin: 0; padding: 10px 22px; font-size: 13px; }

/* BETA on the splash screen. */
.splash-beta {
  position: absolute; z-index: 2;
  top: max(16px, env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px));
  padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(255, 179, 107, 0.7);
  background: rgba(7, 2, 15, 0.7); color: #ffe3c2;
  font: 900 13px/1 Consolas, 'Courier New', monospace; letter-spacing: 4px;
  text-shadow: 0 0 8px rgba(255, 62, 165, 0.8); pointer-events: none;
}
