/* =========================================================
   1. GLOBAL VARIABLES & BASE STYLES
   ========================================================= */
:root {
  --panel-pad: clamp(8px, 7%, 100px);
  --bg-dark: #0f141a;
  --bg-panel: #1a222c;
  --bg-card: #222d3a;
  --border-subtle: #334155;
  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --green-box: rgba(66, 192, 66, 0.445);
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --text-explainer: orange;
  --lcd-cyan: #00ffe6;
  --lcd-green: #86ff95;
}

/* Tvinger all padding og border til å trekkes innover (fjerner horisontal scroll) */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  max-width: 100vw;
  background: radial-gradient(circle at 50% 30%, #1a222c 0%, var(--bg-dark) 80%);
  font-family: system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Scene Handling & Utilities */
.hidden, .hidden-scene, .hidden-element { display: none !important; }
.active-scene { display: block; }
.flex-1 { flex: 1; }
.flex-column { display: flex; flex-direction: column; }
.full-height { height: 100%; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.margin-top-10 { margin-top: 10px; }

/* Text Utilities */
.text-cyan { color: #38bdf8; }
.text-yellow { color: #ffe98a; }
.text-muted { color: #aaa; }
.text-success { color: #4caf50; }
.text-danger { color: #f44336; }
.bold { font-weight: bold; }
.tracking-wide { letter-spacing: 1px; }
.m-0 { margin: 0; }

/* Position Utilities */
.left-0 { left: 0%; }
.left-15 { left: 15%; }
.left-50 { left: 50%; transform: translateX(-50%); }
.left-85 { left: 85%; }
.left-100 { left: 100%; transform: translateX(-100%); }

select { color-scheme: dark; background-color: #1e293b; color: #f8fafc; }
select option { background-color: #1e293b; color: #f8fafc; }

body:has(#exercise-modal-backdrop:not(.hidden)),
body:has(#scorecard-modal-backdrop:not(.hidden)),
body:has(#settings-modal:not(.hidden)) { overflow: hidden !important; }

/* =========================================================
   2. MAIN LAYOUT & HEADER
   ========================================================= */
#app-header {
  display: flex;
  flex-wrap: wrap; 
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 25px;
  flex-shrink: 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  z-index: 20;
  gap: 15px; 
}

.header-title { font-size: 1.25rem; font-weight: 700; color: var(--text-main); letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
.header-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
/* Demo-badge i headeren */
#demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-blue);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.header-btn {
  display: flex; align-items: center; gap: 8px; background-color: var(--bg-dark); color: var(--text-muted);
  border: 1px solid var(--border-subtle); padding: 8px 16px; border-radius: 6px; cursor: pointer;
  font-weight: 600; font-size: 0.9rem; transition: all 0.2s;
}
.header-btn:hover { background-color: var(--bg-card); color: var(--text-main); border-color: var(--accent-blue); box-shadow: 0 0 10px rgba(59, 130, 246, 0.2); }

.mission-clock {
  display: flex; align-items: baseline; gap: 6px; background-color: #020617; border: 1px solid var(--border-subtle);
  padding: 6px 16px; border-radius: 6px; font-family: 'Share Tech Mono', monospace; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}
#clock-time { font-size: 1.4rem; color: var(--lcd-cyan); font-weight: bold; letter-spacing: 0.05em; }
.clock-tz { font-size: 0.8rem; color: var(--text-muted); }

#simulator-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr);
  align-items: stretch;
  gap: 20px;
  max-width: 1400px;
  margin: 20px auto;
  width: 100%;
  padding: 0 20px;
  box-sizing: border-box;
  height: calc(100vh - 120px);
}

/* Kolonne 1: 3 kort stablet – scenario vokser og fyller ledig plass */
.dashboard-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

#scenario-card { flex: 1; min-height: 0; height: auto; }
#coast-radio-card { flex: 0 0 auto; height: auto !important; }
#vessel-card { flex: 0 0 auto; height: auto !important; }

/* Kolonne 2: radio øverst (fast høyde), meldingsvindu fyller resten */
.dashboard-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* =========================================================
   3. PANELS & CARDS (ACTOR / SCENARIO)
   ========================================================= */
/* #actor-panel fjernet – kort er nå direkte grid-barn av #simulator-dashboard */

.actor-card {
  position: relative;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 20px;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  flex: 1;
  height: 100%;
  transition: all 0.3s ease;
}

.compact-card { height: auto; min-height: 0; padding: 8px 20px; }
.mmsi-group { margin-top: 8px; }
.card-content-wrapper { display: flex; flex-direction: column; gap: 10px; height: 100%; transition: max-height 0.3s ease, opacity 0.2s ease, margin-top 0.3s ease; opacity: 1; max-height: 600px; overflow: hidden; }

/* 🚀 LØSNING: Pilene er strengt skjult på PC */
.card-toggle-btn, .modal-toggle-btn {
  display: none;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 8px;
}
.static-toggle { position: static; }

.vessel-info-wrapper { display: grid; grid-template-columns: 150px 1fr; gap: 12px 16px; flex: 1; width: 100%; align-items: start; }
.actor-photo { position: relative; flex-shrink: 0; }
.actor-photo img { width: 150px; aspect-ratio: 3 / 2; object-fit: contain; border-radius: 6px; border: 1px solid #555; background-color: #111; padding: 2px; z-index: 1; }

.actor-group {
  display: flex; align-items: center; gap: 8px; background: rgba(0, 0, 0, 0.25); padding: 6px 12px;
  border-radius: 4px; border-left: 3px solid var(--accent-blue); width: 100%;
}

.actor-label { font-weight: 600; font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; margin: 0; flex-shrink: 0; }
.actor-select { flex-grow: 1; width: 100%; min-width: 0; font-size: 0.95rem; padding: 4px 8px; border-radius: 4px; border: 1px solid #444; background: #111; color: var(--accent-blue); font-weight: bold; cursor: pointer; outline: none; text-overflow: ellipsis; transition: border-color 0.2s, box-shadow 0.2s; }
.actor-select:hover:not(:disabled) { border-color: var(--accent-blue); box-shadow: 0 0 8px rgba(59, 130, 246, 0.2); }
.actor-select:disabled { background-color: rgba(255, 255, 255, 0.05); color: var(--text-muted); border-color: var(--border-subtle); cursor: not-allowed; opacity: 0.8; }
.actor-select-locked { flex-grow: 1; width: 100%; font-size: 0.95rem; padding: 4px 8px; border-radius: 4px; border: 1px solid transparent; color: var(--text-main); font-weight: bold; display: flex; align-items: center; gap: 8px; }

.actor-info-group { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--text-main); font-family: 'Share Tech Mono', monospace; line-height: 1.2; }
.full-width-group { grid-column: 1 / 3; display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 8px 10px; background: rgba(0, 0, 0, 0.15); padding: 10px 12px; border-radius: 6px; border-left: 3px solid var(--accent-blue); }
.actor-info-group div, .full-width-group div { display: flex; align-items: flex-start; }
.actor-info-group strong { color: var(--text-muted); text-transform: uppercase; width: 75px; flex-shrink: 0; }
.full-width-group strong { min-width: 80px; color: var(--text-muted); text-transform: uppercase; flex-shrink: 0; }
.actor-info-group span { flex: 1; word-break: break-word; overflow-wrap: anywhere; }
.full-width-group span { flex: 1; min-width: 0; word-break: break-all; overflow-wrap: anywhere; }

/* Scenario Card */
.scenario-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--border-subtle); }
#active-scenario-name { font-size: 1.1rem; font-weight: 700; color: #f59e0b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-grow: 1; min-width: 0; }
#active-scenario-mode { font-size: 0.8rem; font-weight: bold; text-transform: uppercase; padding: 4px 10px; border-radius: 6px; color: #10b981; border: 1px solid rgba(16, 185, 129, 0.4); background: rgba(16, 185, 129, 0.1); flex-shrink: 0;}

#scenario-card.is-active #active-scenario-name { color: var(--text-main); }
#scenario-card.is-active #active-scenario-mode { color: var(--text-main); border-color: rgba(255, 75, 75, 0.4); background: rgba(7, 209, 51, 0.37); }
#scenario-card.is-idle #active-scenario-name { color: var(--text-muted); }
#scenario-card.is-idle #active-scenario-mode { color: var(--text-main); border-color: rgba(255, 255, 255, 0.4); background: var(--border-subtle); }

.scenario-body { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; }
.scenario-text-wrapper { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#scenario-helper-label { display: none; }
#scenario-helper-text { flex: 1; background: #0f172a; border: 1px solid #334155; border-left: 4px solid #3b82f6; border-radius: 6px; padding: 8px 12px; font-size: 0.85rem; color: #cbd5e1; overflow-y: auto; line-height: 1.35; white-space: normal; }
.scenario-btn-column { display: flex; flex-direction: row; gap: 10px; width: 100%; flex-shrink: 0; justify-content: space-between; }
.scenario-btn { flex: 1; color: white; border: none; padding: 8px 12px; border-radius: 6px; font-weight: bold; font-size: 0.85rem; cursor: pointer; text-align: center; transition: background 0.2s; }
.scenario-btn.btn-stop { background: #ef4444; } .scenario-btn.btn-stop:hover { background: #dc2626; }
.scenario-btn.btn-menu { background: #3b82f6; } .scenario-btn.btn-menu:hover { background: #2563eb; }
.scenario-btn.btn-restart { background: #f59e0b; color: #111; } .scenario-btn.btn-restart:hover { background: #d97706; }
.scenario-btn.btn-scorecard { background: #3b82f6; color: #fff; } .scenario-btn.btn-scorecard:hover { background: #2563eb; }

/* =========================================================
   4. CHAT & MESSAGING (PC DEFAULTS)
   ========================================================= */
#message-container { display: flex; flex-direction: column; flex: 1; min-height: 0; 
  overflow: hidden; border-top: 4px solid #000000; border-top-left-radius: 12px; border-top-right-radius: 12px;}

/* 🚀 LØSNING: Tvinger wrapperen til loggen til å strekke seg på PC */
.message-card { display: flex; flex-direction: column; flex: 1; height: 100%; min-height: 0; background: transparent; border: none; padding: 0 12px 8px 12px; }
.log-content-wrapper { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; height: 100%; }

#message-display { display: flex; flex-direction: column; gap: 12px; padding: 15px; overflow-y: auto; background-color: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 8px; margin-bottom: 12px; flex: 1; font-size: 0.95rem; box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4); min-height: 0; scrollbar-width: thin; scrollbar-color: var(--border-subtle) transparent; }

.message-header-mobile { display: none; }
.log-title-mobile { font-weight: bold; color: var(--text-muted); font-size: 0.9rem; text-transform: uppercase; margin-left: 8px;}

.line { padding: 12px 16px; border-radius: 12px; line-height: 1.5; max-width: min(85%, 580px); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); word-wrap: break-word; color: #f8fafc; }
.line strong { display: block; font-size: 0.75rem; text-transform: uppercase; margin-bottom: 6px; letter-spacing: 0.5px; }
.line.user { align-self: flex-end; background-color: #2563eb; border: none; border-bottom-right-radius: 2px; }
.line.user strong { color: #bfdbfe; }
.line.coast { align-self: flex-start; background-color: #334155; border-left: 4px solid #f59e0b; border-bottom-left-radius: 2px; }
.line.coast strong { color: #fcd34d; }
.vhf-system-warning {
  align-self: center;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 8px;
  color: #fca5a5;
  font-size: 0.85rem;
  padding: 10px 16px;
  text-align: center;
  max-width: 95%;
  margin: 4px auto;
}

.line.system { align-self: center; background-color: rgba(15, 23, 42, 0.6); color: #cbd5e1; font-style: normal; box-shadow: none; border: 1px solid #475569; font-size: 0.85rem; text-align: center; max-width: min(95%, 680px); }
.line.system strong { display: inline; color: #94a3b8; }

#input-wrapper { display: flex; gap: 8px; flex-shrink: 0; padding: 10px 12px 4px 12px; }
#text-input { flex: 1; padding: 10px 14px; border-radius: 6px; border: 1px solid var(--border-subtle); background-color: var(--bg-dark); color: var(--text-main); }
.send-btn { padding: 0 18px; background-color: var(--accent-blue); color: white; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; }
.send-btn:hover { background-color: var(--accent-blue-hover); }

.audio-playback-controls { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; margin-bottom: 8px; flex-shrink: 0; }
.btn-skip-tts { font-size: 0.8rem; padding: 4px 12px; border-radius: 4px; border: 1px solid #475569; background: #1e293b; color: #f8fafc; cursor: pointer; transition: all 0.2s ease;}
.btn-skip-tts:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-skip-tts:not(:disabled):hover { background: #334155; color: #fff; }

/* =========================================================
   5. VHF RADIO DEVICE
   ========================================================= */
#vhf-wrapper {
  width: 100%;
  aspect-ratio: 1920 / 680;
  position: relative;
  flex-shrink: 0;
  z-index: 0;
  margin-top: 0;
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.5));
  background-image: url("/assets/images/radio/vhf_low_res.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center top;
  container-type: inline-size;
}

#radio-display { position: absolute; top: 13.5%; left: 43.5%; width: 29.7%; height: 56%; font-size: 2.2cqw; text-align: center; pointer-events: none; z-index: 1; overflow: hidden; }

#vhf-sticker {
  position: absolute; top: 13.6%; left: 21.2%; width: 13cqw; background-color: #f4f4f0; border-radius: 1px 1cqw 4px 1px; padding: 0.5cqw 0.8cqw 1cqw 0.8cqw;
  font-family: 'Kalam', 'Comic Sans MS', cursive, sans-serif; font-size: 1.6cqw; font-weight: 700; color: #202020de; box-shadow: 2.5px 2.5px 1px 1px rgba(40, 40, 40, 0.6); transform: rotate(4.77deg); z-index: 10; pointer-events: none; white-space: nowrap;
}

/* Radio LCD Content */
#status-indicators { position: absolute; top: 5%; left: 5%; right: 5%; font-family: 'Share Tech Mono', monospace; font-size: 1.2cqw; color: var(--lcd-cyan); display: flex; gap: 8%; }
.status-indicator { opacity: 0.2; transition: opacity 0.3s; border-radius: 3px; padding: 0 0.2em; }
.status-indicator.visible { opacity: 1; color: #00ffe6; background: rgba(42, 233, 194, 0.2); }
#indicator-err.visible { color: #ff4b4b; background: rgba(255, 75, 75, 0.2); text-shadow: 0 0 5px rgba(255, 75, 75, 0.5); }

#vhf-status-text { position: absolute; top: 15%; left: 5%; right: 5%; text-align: center; z-index: 5; }
#status-text { font-family: 'Share Tech Mono', monospace; font-size: 1.1cqw; font-weight: lighter; color: #b3fff8; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8); }

#display-channel { position: absolute; top: 62%; left: 0; right: 0; font-family: 'Share Tech Mono', monospace; font-size: 3.5cqw; font-weight: 100; color: var(--lcd-green); letter-spacing: 0.13em; transform: translateY(-50%); }
#display-position { position: absolute; bottom: 12%; left: 0; right: 0; font-family: 'Share Tech Mono', monospace; font-size: 1.4cqw; font-weight: lighter; color: #ffe98a; letter-spacing: 0.09em; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }

/* DSC MENU DISPLAY */
#dsc-menu-display { position: absolute; top: 5%; bottom: 5%; left: 0; right: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: 'Share Tech Mono', monospace; background-color: rgba(0, 0, 0, 0.85); }
.lcd-menu-title { position: absolute; top: 10%; font-size: 1.4cqw; color: #b3fff8; margin: 0; }
.lcd-menu-item-container { display: flex; width: 90%; align-items: center; justify-content: center; margin-top: -5%; }
.lcd-menu-arrow { font-size: 2.2cqw; color: var(--lcd-green); flex: 0 0 1.5em; text-align: right; padding-right: 15px; }
.lcd-menu-item { font-size: 2.2cqw; color: var(--lcd-green); flex: 1; overflow: hidden; white-space: nowrap; text-align: left; }
.lcd-menu-hints { position: absolute; bottom: 10%; font-size: 1.1cqw; color: #a0aec0; margin: 0; }

/* Buttons & TX Indicator */
#tx-indicator { position: absolute; top: 25%; left: 10.1%; width: 0.8%; height: 2.2%; border-radius: 50%; background-color: rgb(20, 180, 0); box-shadow: 0 0 5px rgba(30, 255, 0, 0.5); opacity: 0; transition: opacity 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease; z-index: 2; }
#tx-indicator.active, #tx-indicator.transmitting, #tx-indicator[style*="opacity: 1"] { opacity: 1 !important; background-color: #4ade80; box-shadow: 0 0 15px 4px rgba(30, 255, 0, 0.8), inset 0 0 4px rgba(255, 255, 255, 1); }

.button-area { position: absolute; cursor: pointer; user-select: none; z-index: 3; }
#ptt-btn { top: 63.0%; left: 7.1%; width: 6.3%; height: 11%; border-radius: 8px; touch-action: none; }
#power-btn { top: 73.4%; left: 30.35%; width: 2.25%; height: 5.5%; border-radius: 50%; }
#power-btn.power-on { background-color: rgba(44, 219, 9, 0.8); box-shadow: inset 0 0 10px rgba(44, 219, 9, 1); }
#power-btn.power-off { background-color: rgba(181, 184, 3, 0.5); box-shadow: inset 0 0 10px rgba(251, 255, 0, 0.4); }

#distress-btn { top: 72%; left: 35.65%; width: 5.5%; height: 8%; background-color: rgba(200, 30, 30, 0.4); border: 1px solid rgba(255, 100, 100, 0.4); border-radius: 2px; box-shadow: inset 0 0 5px rgba(0,0,0,0.5); transition: all 0.2s ease; }
#distress-btn:active, #distress-btn.active, #distress-btn.pressed { background-color: rgba(255, 20, 20, 0.85); box-shadow: 0 0 20px 5px rgba(255, 0, 0, 0.7), inset 0 0 15px rgba(255, 255, 255, 0.5); border-color: rgba(255, 150, 150, 0.9); }

#channel16-btn { top: 74.4%; left: 44.8%; width: 5%; height: 7%; border-radius: 4px;}
#dsc-btn { top: 74.4%; left: 52.5%; width: 5%; height: 7%; border-radius: 4px;}
#dw-btn { top: 74.4%; left: 59.8%; width: 5%; height: 7%; border-radius: 4px;}
#menu-btn { top: 74.4%; left: 64.5%; width: 5%; height: 7%; border-radius: 4px;}
#btn-up { top: 27%; left: 83.4%; width: 5%; height: 5.5%; border-radius: 1px;}
#btn-left { top: 39%; left: 75.7%; width: 5%; height: 5.5%; border-radius: 1px;}
#btn-ent { top: 39%; left: 83.4%; width: 5%; height: 5.5%; border-radius: 1px;}
#btn-right { top: 39%; left: 85.7%; width: 5%; height: 5.5%; border-radius: 1px;}
#btn-down { top: 52%; left: 83.4%; width: 5%; height: 5.5%; border-radius: 1px;}
#vol-btn { top: 71.4%; left: 76.5%; width: 4%; height: 11%; border-radius: 50%; }
#sq-btn { top: 71.4%; left: 84.4%; width: 4%; height: 11%; border-radius: 50%; }
#channel-btn { top: 71.4%; left: 92.1%; width: 4%; height: 11%; border-radius: 50%; }

/* =========================================================
   6. MODALS & POPUPS
   ========================================================= */
#exercise-modal-backdrop, #scorecard-modal-backdrop, .settings-modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.85); z-index: 9999;
  display: flex; justify-content: center; align-items: flex-start; padding: 4vh 15px; overflow-y: auto; backdrop-filter: blur(4px);
}

.settings-modal { background-color: rgba(0,0,0,0.75); z-index: 10005; }

#exercise-modal, #scorecard-modal {
  background: #1e293b; border: 1px solid #334155; border-radius: 12px; width: 100%; max-width: 860px;
  padding: 20px; color: #f8fafc; display: flex; flex-direction: column; height: auto; max-height: 92vh; margin: 0 auto;
}

.header-flex { display: flex; justify-content: space-between; align-items: flex-start; }
.exercise-settings-btn { padding: 8px 12px; font-size: 1.2rem; margin-left: 10px; }
.modal-header { flex-shrink: 0; }
.modal-header h2 { margin: 0 0 2px 0; font-size: 1.35rem; }
.modal-header p { color: #94a3b8; font-size: 0.85rem; margin: 0 0 8px 0; }

.mode-selector { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; flex-shrink: 0;}
.mode-option input { display: none; }
.mode-card { display: block; background: #0f172a; border: 2px solid #334155; border-radius: 8px; padding: 12px 15px; cursor: pointer; }
.mode-option input:checked+.mode-card { border-color: #38bdf8; background: rgba(56, 189, 248, 0.1); }

.briefing-box { background: #020617; border: 1px solid #475569; border-left: 4px solid #f59e0b; border-radius: 6px; padding: 12px 16px; margin-bottom: 15px; display: flex; flex-direction: column; flex-grow: 1; overflow-y: auto; min-height: 120px;}
.scorecard-briefing { flex-grow: 0; }
.instruction-text { font-size: 0.95rem; line-height: 1.45; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 0px solid #1e293b; }
.mission-label, .mission-short-desc { color: #f8fafc; font-weight: bold; margin-right: 6px; font-size: 0.95rem; }

.modal-vessel-photo-container { background: #1e293b; border: 1px solid #334155; border-left: 4px solid #38bdf8; padding: 10px 14px; border-radius: 6px; margin-bottom: 10px; display: flex; flex-direction: column; flex-shrink: 0; transition: all 0.3s ease;}
.modal-vessel-selector-container { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--border-subtle); }
.modal-vessel-selector-label { font-size: 1rem; color: #f8fafc; font-weight: bold; }
.modal-vessel-select { background: #1a222c; color: #38bdf8; border: 1px solid #475569; border-radius: 4px; padding: 2px 6px; font-weight: bold; font-size: 0.9rem; outline: none; margin-left: auto; cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s; }
.modal-vessel-select:hover { border-color: var(--accent-blue); box-shadow: 0 0 8px rgba(59, 130, 246, 0.2); }

.modal-vessel-details-wrapper { display: grid; grid-template-columns: 1fr 1.4fr; grid-template-rows: auto; gap: 10px; align-items: stretch; margin-bottom: 2px; }
.modal-vessel-data-col { background: rgba(30, 41, 59, 0.4); border: 1px solid rgba(71, 85, 105, 0.3); border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; font-family: 'Share Tech Mono', monospace; }
.primary-info-card { background: rgba(56, 189, 248, 0.05); }

.modal-vessel-data-col .data-row { display: flex; align-items: flex-start; margin-bottom: 4px; }
.modal-vessel-data-col .data-row:last-child { margin-bottom: 0; }
.modal-vessel-data-col .spacer { height: 8px; }

.data-label { width: 70px; flex-shrink: 0; color: #64748b; font-size: 0.75rem; letter-spacing: 0.5px; margin-top: 2px; min-width: 70px; }
.data-value { flex-grow: 1; color: #e2e8f0; font-size: 0.85rem; }
.highlight-val { color: #f8fafc; font-weight: 600; letter-spacing: 1px; }
.pos-text { color: #fbbf24; line-height: 1.3; white-space: nowrap; }

.secondary-inner { display: flex; flex-direction: row; gap: 10px; align-items: flex-start; }
.secondary-data { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.modal-actor-photo { display: flex; align-items: flex-start; justify-content: center; flex-shrink: 0; }
.modal-actor-photo img { max-width: 160px; height: auto; border-radius: 6px; border: 1px solid #475569; background: #111; object-fit: contain; }

.scorecard-lists-container { display: flex; gap: 20px; overflow-y: auto; padding-right: 5px; }
.scorecard-box { flex: 1; background-color: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 16px; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2); }
.scorecard-box h4 { margin-top: 0; margin-bottom: 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); padding-bottom: 10px; text-transform: uppercase; }
.scorecard-box.success h4 { color: #34d399; }
.scorecard-box.error h4 { color: #f87171; }
.scorecard-box ul { list-style: none; padding: 0; margin: 0; font-size: 0.9rem; }
.scorecard-box li { margin-bottom: 10px; padding: 8px; background-color: rgba(0, 0, 0, 0.15); border-radius: 4px; }

/* Settings Modal */
.settings-modal-content { background-color: #1e293b; border: 1px solid #334155; border-radius: 12px; width: 100%; max-width: 500px; display: flex; flex-direction: column; margin: auto; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); }
.settings-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 25px; border-bottom: 1px solid #334155; background-color: rgba(0,0,0,0.2); border-radius: 12px 12px 0 0; }
.settings-modal-header h2 { margin: 0; font-size: 1.4rem; color: #f8fafc; font-weight: 700; }
.settings-modal-body { padding: 25px; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; max-height: 75vh; }
.settings-modal-body::-webkit-scrollbar { width: 8px; }
.settings-modal-body::-webkit-scrollbar-track { background: #0f172a; border-radius: 4px; }
.settings-modal-body::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }
.settings-modal-body::-webkit-scrollbar-thumb:hover { background: #64748b; }

.lang-group { display: flex; flex-direction: column; gap: 10px; background: rgba(15, 23, 42, 0.6); padding: 18px; border-radius: 8px; border: 1px solid rgba(71, 85, 105, 0.3); border-left: 4px solid #38bdf8; }
.lang-label { font-weight: 600; color: #f8fafc; font-size: 1rem; }
.settings-hint-text { font-size: 0.85rem; color: #94a3b8; margin: 0; line-height: 1.4; }

/* Modal Selectors & Buttons */
.modal-scenario-wrapper { background: #1e293b; border: 1px solid #334155; border-left: 4px solid #38bdf8; border-radius: 6px; padding: 10px 14px; margin-bottom: 10px; display: flex; flex-direction: column; flex-shrink: 0; transition: all 0.3s ease;}
.modal-scenario-label { font-size: 0.95rem; color: #f8fafc; font-weight: bold; margin-bottom: 6px; margin-top: 0; }
.modal-scenario-controls { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.modal-scenario-select { flex: 1; padding: 8px 12px; border-radius: 6px; background: #1a222c; color: white; border: 1px solid #475569; font-size: 0.95rem; font-weight: bold; cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s; }

.modal-radio-lang-container { background: #1e293b; border: 1px solid #334155; border-left: 4px solid #38bdf8; border-radius: 6px; padding: 10px 14px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; transition: all 0.3s ease;}
.modal-radio-lang-label { font-weight: 600; color: #f8fafc; font-size: 0.95rem; }
.modal-radio-lang-select { background: #0f172a; color: #38bdf8; border: 1px solid #475569; border-radius: 6px; padding: 6px 10px; font-size: 0.9rem; font-weight: bold; outline: none; cursor: pointer; width: 100%; margin-top: 2px; transition: border-color 0.2s, box-shadow 0.2s; }
.modal-radio-lang-select:hover, .modal-scenario-select:hover { border-color: var(--accent-blue); box-shadow: 0 0 8px rgba(59, 130, 246, 0.2); }
.modal-radio-lang-hint { font-size: 0.8rem; color: #94a3b8; line-height: 1.3; margin-top: 2px; }

/* Accordion for modal (Desktop defaults to open, Mobile defaults via JS) */
.modal-collapsible { transition: max-height 0.3s ease, opacity 0.2s ease, margin-top 0.3s ease; max-height: 600px; opacity: 1; overflow: hidden; }

.modal-footer-flex { display: flex; margin-top: 2px; justify-content: flex-end; flex-shrink: 0; gap: 10px;}
.scorecard-footer { gap: 15px; margin-top: auto; padding-top: 15px; }

.btn-primary { background: #2563eb; color: white; border: none; border-radius: 6px; padding: 10px 24px; font-weight: bold; cursor: pointer; transition: all 0.2s; }
.btn-primary:hover { background: #1d4ed8; box-shadow: 0 0 12px rgba(37, 99, 235, 0.5); }
.btn-secondary { background: transparent; color: #94a3b8; border: 1px solid #475569; border-radius: 6px; padding: 8px 16px; cursor: pointer; transition: all 0.2s; }
.btn-secondary:hover { background-color: var(--bg-card); color: var(--text-main); border-color: var(--accent-blue); box-shadow: 0 0 10px rgba(59, 130, 246, 0.2); }
.btn-auto { width: auto; }

.top-btn { width: 100%; padding: 10px 14px; background-color: #0f172a; color: #38bdf8; border: 1px solid #475569; border-radius: 6px; cursor: pointer; font-size: 0.95rem; font-weight: bold; outline: none; transition: border-color 0.2s; }
.top-btn:focus, .top-btn:hover { border-color: #38bdf8; }
.test-voice-btn { margin-top: 4px; background: #1e293b; color: #e2e8f0; border: 1px solid #475569; }
.test-voice-btn:hover { background: #334155; color: #fff; }
.close-modal-btn { background: none; border: none; color: #94a3b8; font-size: 2rem; line-height: 1; cursor: pointer; transition: color 0.2s ease; padding: 0; }
.close-modal-btn:hover { color: #f87171; }

/* MMSI Specific */
.mmsi-modal-content { max-width: 400px; border-left: 4px solid var(--accent-blue); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6); }
.mmsi-header { padding: 15px 25px; background-color: var(--bg-panel); border-bottom: 1px solid var(--border-subtle); justify-content: center; }
.mmsi-header h2 { font-size: 1.3rem; color: #f8fafc; text-align: center; width: 100%; }
.mmsi-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 0; margin-bottom: 15px; text-align: center; line-height: 1.4; }
.mmsi-input-field { width: 100%; padding: 15px; background-color: var(--bg-dark); border: 2px solid var(--border-subtle); border-radius: 8px; color: var(--lcd-cyan); font-size: 1.5rem; font-weight: bold; text-align: center; letter-spacing: 2px; outline: none; box-sizing: border-box; transition: border-color 0.2s; font-family: 'Share Tech Mono', monospace; }
.mmsi-input-field:focus { border-color: var(--accent-blue); box-shadow: 0 0 10px rgba(59, 130, 246, 0.2); }
.mmsi-input-field::placeholder { color: #334155; }
.modal-btn-group { display: flex; gap: 15px; margin-top: 25px; width: 100%; }
.modal-btn-group .btn-secondary { flex: 1; padding: 12px; font-size: 1rem; }
.modal-btn-group .btn-primary { flex: 2; padding: 12px; font-size: 1rem; }

/* Scorecard Specific Interactions */
#btn-sc-review, #btn-sc-retry, #btn-sc-menu { transition: all 0.2s ease-in-out; cursor: pointer; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); }
#btn-sc-review:hover { background-color: #334155; color: #fff; border-color: #64748b; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); transform: translateY(-1px); }
#btn-sc-retry { border-color: #f59e0b; color: #f59e0b; }
#btn-sc-retry:hover { background-color: rgba(245, 158, 11, 0.15); color: #fbbf24; border-color: #fbbf24; box-shadow: 0 4px 8px rgba(245, 158, 11, 0.2); transform: translateY(-1px); }
#btn-sc-menu { background: #3b82f6; }
#btn-sc-menu:hover { background-color: #2563eb !important; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4); transform: translateY(-1px); }
#btn-sc-review:active, #btn-sc-retry:active, #btn-sc-menu:active { transform: translateY(1px); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }

/* =========================================================
   7. CALIBRATION SCENE 
   ========================================================= */
#calibration-scene { max-width: 800px; margin: 40px auto; padding: 30px; background: var(--bg-panel); border: 1px solid var(--border-subtle); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); color: var(--text-main); display: flex; flex-direction: column; gap: 25px; width: 90%; }
.calib-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-subtle); padding-bottom: 15px; }
.calib-header h2 { margin: 0; font-size: 1.6rem; color: #f8fafc; }
.calib-instructions { font-size: 1rem; color: var(--text-explainer); }
.calib-controls { display: flex; gap: 15px; align-items: center; }
.calib-btn-primary { background: var(--accent-blue); color: white; border: none; padding: 12px 24px; border-radius: 6px; font-weight: bold; font-size: 1rem; cursor: pointer; transition: background 0.2s; }
.calib-btn-primary:hover { background: var(--accent-blue-hover); }
.calib-btn-secondary { background: var(--bg-card); color: var(--text-main); border: 1px solid var(--border-subtle); padding: 10px 18px; border-radius: 6px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.calib-btn-secondary:hover { background: #334155; color: white; }

.calib-vu-wrapper { background: rgba(15, 23, 42, 0.6); padding: 20px; border-radius: 8px; border: 1px solid rgba(71, 85, 105, 0.3); }
.calib-vu-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; font-weight: 600; }
.calib-gain-control { display: flex; align-items: center; gap: 10px; }
.gain-badge { background: #1e293b; padding: 4px 8px; border-radius: 4px; font-family: monospace; font-size: 0.9rem; border: 1px solid #475569; }

#calib-vu-meter { height: 24px; background: #020617; border-radius: 12px; position: relative; overflow: hidden; box-shadow: inset 0 2px 5px rgba(0,0,0,0.5); border: 1px solid #334155; }
#calib-vu-fill { height: 100%; width: 0%; background: #4caf50; transition: width 0.1s ease-out; border-radius: 10px; }
.vu-marker { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,0.3); z-index: 2; }
.vu-scale { position: relative; height: 20px; margin-top: 5px; font-size: 0.8rem; font-family: monospace; color: #64748b; }
.vu-scale span { position: absolute; transform: translateX(-50%); }

.calib-prompter-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 8px; }
#calib-step-indicator { font-weight: bold; color: #38bdf8; white-space: nowrap; margin-right: 15px; }
.calib-teleprompter { background: #020617; padding: 30px; border-left: 4px solid var(--accent-blue); border-radius: 8px; font-size: 1.4rem; font-family: monospace; color: #e2e8f0; line-height: 1.5; box-shadow: inset 0 2px 10px rgba(0,0,0,0.5); }
#calib-results { display: flex; gap: 20px; }
.result-box { background: var(--bg-card); padding: 20px; border-radius: 8px; flex: 1; border: 1px solid var(--border-subtle); }
.result-box h4 { margin-top: 0; color: #94a3b8; border-bottom: 1px solid var(--border-subtle); padding-bottom: 10px; }
.result-box p { margin: 0; font-family: monospace; font-size: 1.1rem; color: #38bdf8; word-wrap: break-word; }
.calib-actions { display: flex; justify-content: center; align-items: center; gap: 20px; margin-top: 10px; padding-top: 20px; border-top: 1px solid var(--border-subtle); }

/* =========================================================
   8. ANIMATIONS & EFFECTS
   ========================================================= */
.blink-text { animation: lcd-blink 1.2s infinite ease-in-out; color: #86ff95; }
@keyframes lcd-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

/* VU Meter på LCD */
#display-vu-meter { position: absolute; bottom: 2%; left: 10%; right: 10%; height: 6%; border: 1px solid rgba(134, 255, 149, 0.2); background: rgba(0, 0, 0, 0.6); display: flex; gap: 2px; padding: 2px; opacity: 0; transition: opacity 0.2s ease-in-out; z-index: 2; }
#display-vu-meter.active { opacity: 1; }
.vu-segment { flex: 1; background-color: var(--lcd-green); opacity: 0.15; transition: opacity 0.05s ease-out; }
.vu-segment.active { opacity: 1; box-shadow: 0 0 4px var(--lcd-green); }
.vu-segment.peak-color { background-color: #ff4b4b; }
.vu-segment.peak-color.active { box-shadow: 0 0 4px #ff4b4b; }

/* Dynamisk PTT Glød */
#ptt-btn:active, #ptt-btn.active, #ptt-btn.pressed, #ptt-btn.transmitting { box-shadow: inset 0 0px 10px 4px var(--mic-glow, rgba(81, 255, 0, 0.3)); border-radius: 12px; }

/* Boot Skjerm */
#boot-screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: #f8fafc; display: flex; justify-content: center; align-items: center; z-index: 50; }
#boot-screen.hidden { display: none; }
/* NorVitra boot-logo (ekte vektorlogo, juli 2026).
   Fase 1: skrog+bølger fader opp. Fase 2: gullring popper inn.
   Fase 3: to gull signal-glimt-ringer pulserer utover fra noden. */
.logo-hull, .logo-node, .logo-node-hole { opacity: 0; }
.logo-hull { animation: fadeUp 0.8s ease forwards; }
.logo-node, .logo-node-hole {
  transform-box: fill-box; transform-origin: center;
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.4s forwards;
}
.sig-ring { transform-box: fill-box; transform-origin: center; opacity: 0; }
.sig-1 { animation: signalPulse 0.9s ease-out 0.7s forwards; }
.sig-2 { animation: signalPulse 0.9s ease-out 0.95s forwards; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }
@keyframes signalPulse { 0% { opacity: 0.9; transform: scale(0.7); } 70% { opacity: 0.35; } 100% { opacity: 0; transform: scale(2.6); } }

/* =========================================================
   9. RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================================= */

/* LØSNING: Sikrer at PC-visningen beholder oppsettet sitt selv etter vi ryddet opp i mobilkoden! */
/* ── Hover-states ────────────────────────────────────────────────────────── */
.card-toggle-btn:hover, .modal-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--accent-blue);
}
.mode-card:hover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.06);
}
#btn-sc-review:hover { background: #334155; color: white; border-color: #64748b; }
#btn-sc-retry:hover  { background: rgba(245, 158, 11, 0.15); }
#btn-sc-menu:hover   { background: #2563eb; }
.btn-ac-panel:hover  { background: rgba(30, 41, 59, 0.95); border-color: var(--accent-blue); box-shadow: 0 0 8px rgba(59, 130, 246, 0.2); }

@media (min-width: 1025px) {
  .message-card { background: transparent; border: none; border-radius: 0; padding: 0; flex: 1; display: flex; flex-direction: column;}
  .log-content-wrapper { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
  .static-toggle { display: none !important; }
}

@media (min-width: 1025px) and (max-width: 1380px) {
  .actor-photo { display: none !important; }
}

@media (max-width: 1024px) {
  html, body { height: auto !important; min-height: 100vh; overflow-x: hidden; overflow-y: auto !important; }
  
  #app-header { padding: 12px 15px; justify-content: space-between; row-gap: 12px; }
  .header-title { width: auto; font-size: 1.1rem;}
  .header-controls { justify-content: flex-end; }
  .mission-clock { margin: 0; }
  
  #simulator-dashboard { display: flex !important; flex-direction: column !important; height: auto !important; padding: 10px 15px; gap: 10px; }
  .dashboard-right { height: auto !important; max-height: none !important; width: 100% !important; overflow: visible !important;}
  
  
  #vhf-wrapper { order: -1; margin: 0 auto; width: 100% !important; max-width: 100%; }
  .message-card { margin-bottom: 0; }
  
  #exercise-modal, #scorecard-modal { height: auto; max-height: 95vh; overflow-y: auto; padding: 15px; }
  .briefing-box { flex-grow: 0; height: auto; min-height: 80px; }

  /* Accordions på mobil */
  .actor-card, .modal-panel { min-height: unset; height: auto !important; width: 100% !important; padding: 10px 15px;}
  .card-toggle-btn, .modal-toggle-btn { display: block; }
  
  /* For cards i bakgrunnen */
  .actor-card.collapsed .card-content-wrapper { opacity: 0; pointer-events: none; margin-top: -10px; max-height: 0;}
  .actor-card.collapsed { padding-bottom: 10px;}
  
  /* For modaler (Fartøy, Scenario, Språk) */
  .modal-panel.collapsed .modal-collapsible { max-height: 0; opacity: 0; margin-top: 0 !important; }
  .modal-panel.collapsed .modal-vessel-selector-container { border-bottom: none; margin-bottom: 0; padding-bottom: 0;}
  
  .actor-photo { display: none !important; } 
  .vessel-info-wrapper { display: flex; flex-direction: column; gap: 12px; }

  /* Kollapsbar Meldingslogg */
  .message-header-mobile { display: flex; align-items: center; margin-bottom: 10px; border-bottom: 1px solid var(--border-subtle); padding-bottom: 10px; }
  .message-card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 10px 15px; display: flex; flex-direction: column; flex: 1; transition: all 0.3s ease; }
  #message-display { border: none; padding: 0; background: transparent; box-shadow: none; margin-bottom: 0; }
  
  .log-content-wrapper { display: flex; flex-direction: column; flex: 1; transition: max-height 0.3s ease, opacity 0.2s ease; overflow: hidden; opacity: 1; max-height: 800px; }
  .message-card.collapsed .log-content-wrapper { max-height: 0; opacity: 0; flex: none; margin: 0; pointer-events: none; }
  .message-card.collapsed .message-header-mobile { border-bottom: none; margin-bottom: 0; padding-bottom: 0;}
  
  #message-container { height: auto !important; flex: none !important; }
}

@media (max-width: 768px), (max-height: 800px) {
  #exercise-modal, #scorecard-modal { min-height: auto; padding: 15px; }
  .settings-modal-body { max-height: none; }
}

@media (max-width: 700px) {
  .modal-vessel-details-wrapper { grid-template-columns: 1fr; gap: 12px; }
  .modal-actor-photo { display: none !important; }
}

@media (max-width: 500px) {
  .header-title { width: 100%; text-align: center; margin-bottom: 4px; font-size: 1.15rem;}
  .mission-clock { margin: 0; }
  .header-controls { width: auto; justify-content: flex-end; }
  
  .header-btn { padding: 6px 10px; font-size: 0.8rem; }
  #clock-time { font-size: 1.1rem; }
  .modal-radio-lang-container { padding: 10px 12px; }
  .modal-radio-lang-select { font-size: 0.85rem; }
}

@media (max-height: 600px) {
  html, body { height: auto !important; overflow-y: auto !important; }
  #simulator-dashboard { height: auto !important; overflow: visible !important; }
  .actor-photo { display: none !important; }
}/* ═══════════════════════════════════════════════════════════════════════════
   F1 / F3 OPPRYDDING
   1. KAPAS-truncation fix
   2. Sticky tekst-input på mobil + blokksortering
   3. Locked mode (LearnPress-embedding)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. KAPAS-truncation fix ────────────────────────────────────────────────
   Problem: "+12 pers" brytes over to linjer på smal skjerm
   ─────────────────────────────────────────────────────────────────────────── */
.full-width-group span,
.actor-info-group span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* POS-feltet viser to linjer (N / E) via innerHTML <br> – aldri truncate */
#vessel-port-pos {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
}

/* ── 2. Blokksortering og drag handles på mobil ─────────────────────────────
   display:contents på dashboard-left gjør blokker til direkte flex-barn.
   Sticky input håndteres av visualViewport API i blockOrder.js.
   ─────────────────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    #simulator-dashboard {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px;
    }

    #coast-radio-card { order: var(--block-order-coast,    1); }
    #vessel-card      { order: var(--block-order-vessel,   2); }
    #scenario-card    { order: var(--block-order-scenario, 3); }
    #vhf-wrapper      { order: var(--block-order-vhf,      4); }
    .dashboard-right  { order: var(--block-order-log,      5); }

    /* Drag handle – 6-dot gripper i hjørnet */
    .block-drag-handle {
        position: absolute;
        top: 6px;
        right: 8px;
        z-index: 20;
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: grab;
        border-radius: 4px;
        background: rgba(160, 178, 198, 0.08);
        border: 1px solid rgba(160, 178, 198, 0.18);
        touch-action: none;
        transition: background .15s;
    }

    .block-drag-handle:active { cursor: grabbing; background: rgba(160,178,198,.22); }

    /* 6-dots grid */
    .drag-dots {
        display: grid;
        grid-template-columns: repeat(2, 4px);
        grid-template-rows: repeat(3, 4px);
        gap: 3px;
    }

    .drag-dots::before,
    .drag-dots::after {
        /* Finner ikke ::before/after på grid-items – bruker box-shadow teknikk */
        content: none;
    }

    /* Lager 6 dots med en enkelt pseudo-element + box-shadow */
    .drag-dots {
        width: 4px;
        height: 4px;
        background: #A0B2C6;
        border-radius: 50%;
        box-shadow:
            7px 0    0 #A0B2C6,
            0   7px  0 #A0B2C6,
            7px 7px  0 #A0B2C6,
            0   14px 0 #A0B2C6,
            7px 14px 0 #A0B2C6;
        margin-bottom: 4px;
    }

    /* Visuell feedback under drag */
    .block-dragging {
        z-index: 100 !important;
        opacity: 0.88;
        box-shadow: 0 12px 32px rgba(0,0,0,.5) !important;
        transition: box-shadow .15s;
    }

    .block-drop-target {
        outline: 2px dashed #38bdf8;
        outline-offset: 3px;
    }

    body.dragging-active {
        user-select: none;
        -webkit-user-select: none;
    }
}

/* Skjul drag handle på desktop */
@media (min-width: 1025px) {
    .block-drag-handle { display: none !important; }
}

/* ── 3. Locked mode (LearnPress-embedding via ?locked=true) ─────────────────
   ─────────────────────────────────────────────────────────────────────────── */

html.locked-mode #btn-app-home,
html.locked-mode #settings-btn {
    display: none !important;
}

html.locked-mode #user-vessel-select,
html.locked-mode #coast-radio-select,
html.locked-mode label[for="user-vessel-select"],
html.locked-mode #lbl-active-coast-radio {
    display: none !important;
}

html.locked-mode #btn-open-menu,
html.locked-mode #btn-stop-exercise {
    display: none !important;
}

html.locked-mode #btn-sc-menu {
    display: none !important;
}

html.locked-mode #btn-sc-retry {
    flex: 1;
}

html.locked-mode #app-header {
    justify-content: center;
    gap: 0;
}

html.locked-mode .header-title {
    flex: 0 0 auto;
    margin-right: auto;
}

html.locked-mode .header-controls {
    display: none !important;
}

html.locked-mode #app-header::after {
    content: attr(data-course-label);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #A0B2C6;
    text-transform: uppercase;
    align-self: center;
    margin-left: 12px;
    opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DEMO MODE  (?demo=true)
   Skjuler chrome-elementer og viser oppgraderingsmelding
   ═══════════════════════════════════════════════════════════════════════════ */

/* Skjul navigasjon og innstillinger */
html.demo-mode #btn-app-home,
html.demo-mode #btn-settings,
html.demo-mode #settings-btn,
html.demo-mode .header-btn[title="Innstillinger"],
html.demo-mode .header-btn[title="Settings"],
html.demo-mode .header-btn[title="System Settings"],
html.demo-mode #logbook-btn,
html.demo-mode .logbook-toggle,
html.demo-mode #btn-velg-oppdrag,
html.demo-mode .exercise-control-btn { display: none !important; }

/* Oppgraderingsmelding under velger */
.demo-upgrade-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 4px 12px 6px;
  opacity: 0.85;
}
.demo-upgrade-hint a {
  color: var(--accent-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.demo-upgrade-hint a:hover { opacity: 0.8; }

/* Demo-banner: vises som badge i headeren via #demo-badge (JS-injisert) */

/* ═══════════════════════════════════════════════════════════════════════════
   DEMO MODE  (?demo=true)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Skjul navigasjon og trening-spesifikke knapper */
html.demo-mode #btn-app-home,
html.demo-mode #btn-settings,
html.demo-mode #settings-btn,
html.demo-mode .header-btn[title="Innstillinger"],
html.demo-mode .header-btn[title="Settings"],
html.demo-mode .header-btn[title="System Settings"],
html.demo-mode #logbook-btn,
html.demo-mode .logbook-toggle,
html.demo-mode #btn-velg-oppdrag,
html.demo-mode #btn-stop-exercise,
html.demo-mode .exercise-control-btn { display: none !important; }

/* Oppgraderingsmelding under velger */
.demo-upgrade-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 4px 12px 6px;
  opacity: 0.85;
}
.demo-upgrade-hint a {
  color: var(--accent-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.demo-upgrade-hint a:hover { opacity: 0.8; }

/* Demo-banner: engelsk tekst via #demo-badge */


/* ═══════════════════════════════════════════════════════════════════════════
   MIC INDICATOR & FØRSTE-GANG-BANNER
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Mic-knapp ─────────────────────────────────────────────────────────── */
.mic-indicator-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle, #444);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-muted, #aaa);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
  margin-left: 8px;
  flex-shrink: 0;
}
.mic-indicator-btn:hover {
  border-color: var(--accent-blue, #4fc3f7);
  color: var(--accent-blue, #4fc3f7);
}
.mic-indicator-btn.calibrated {
  border-color: #4caf50;
  color: #4caf50;
  box-shadow: 0 0 6px rgba(76, 175, 80, 0.4);
}
.mic-indicator-btn.uncalibrated {
  border-color: #ff9800;
  color: #ff9800;
  animation: mic-pulse 2.5s ease-in-out infinite;
}
.mic-indicator-btn.no-mic {
  border-color: #ef4444;
  color: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
  /* Ingen puls — brukeren skal koble til mikrofon, ikke klikke */
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0); }
  50%       { box-shadow: 0 0 0 5px rgba(255, 152, 0, 0.25); }
}

/* ─── Første-gang-banner ────────────────────────────────────────────────── */
.mic-first-run-banner {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1a2a3a;
  border: 1px solid var(--accent-blue, #4fc3f7);
  border-radius: 8px;
  padding: 10px 16px;
  color: var(--text-main, #e0e0e0);
  font-size: 0.85rem;
  z-index: 8000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  max-width: 90vw;
  animation: banner-slide-up 0.3s ease;
}
@keyframes banner-slide-up {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}
.mic-banner-btn {
  background: var(--accent-blue, #4fc3f7);
  color: #000;
  border: none;
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.mic-banner-btn:hover { opacity: 0.85; }
.mic-banner-dismiss {
  background: transparent;
  border: none;
  color: var(--text-muted, #aaa);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 4px;
  flex-shrink: 0;
}
.mic-banner-dismiss:hover { color: var(--text-main, #e0e0e0); }

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT-STABILISERING – aktor-kort
   Hindrer at kortet "hopper" når stedsnavn/posisjon endres
   ═══════════════════════════════════════════════════════════════════════════ */

/* Stedsnavn: maks 2 linjer, ingen overflow inn i POB-kolonne */
#vessel-port-name {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 1.2em;
  /* IKKE white-space: nowrap – .full-width-group span har allerede word-break: break-all */
}

/* Posisjon: alltid plass til 2 linjer (N... / E...) */
#vessel-port-pos {
  line-height: 1.2;
}

/* full-width-group: stabilt grid-radhøyde ved innholdsendring */
.full-width-group {
  grid-template-rows: auto auto;
}
.full-width-group > div {
  min-width: 0;
  overflow: hidden;
}

/* Kystradio-MMSI: stabil bredde */
#coast-radio-mmsi-display {
  font-variant-numeric: tabular-nums;
  min-width: 8ch;
  display: inline-block;
}
/* Demo: skjul språkvelgere og UI-språk-kontroller */
html.demo-mode #ui-language-select,
html.demo-mode .ui-language-selector,
html.demo-mode #radio-lang-container,
html.demo-mode .modal-radio-lang-label,
html.demo-mode #exercise-radio-lang,
html.demo-mode #exercise-radio-lang-hint { display: none !important; }

/* Mic-indikator: z-index og isolert klikk-område */
.mic-indicator-btn {
  position: relative;
  z-index: 500;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FULLSKJERM-KNAPP (locked mode / LearnPress-embedding)
   ═══════════════════════════════════════════════════════════════════════════ */
#btn-fs-sim {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 9998;
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
  transition: background 0.2s, opacity 0.2s;
  opacity: 0.75;
}
#btn-fs-sim:hover {
  background: rgba(30, 64, 175, 0.9);
  opacity: 1;
}
#btn-fs-sim svg {
  flex-shrink: 0;
}
/* Skjul i fullskjerm-modus (nettleseren håndterer Esc) */
:fullscreen #btn-fs-sim,
:-webkit-full-screen #btn-fs-sim {
  bottom: 20px;
  right: 20px;
  opacity: 0.5;
}
:fullscreen #btn-fs-sim:hover,
:-webkit-full-screen #btn-fs-sim:hover {
  opacity: 1;
}
/* ═══════════════════════════════════════════════════════════════════════════
   ACTION CARD PANEL (locked mode)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Knapp – nederst til venstre */
.btn-ac-panel {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 9997;
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
  transition: background 0.2s, opacity 0.2s;
  opacity: 0.75;
}
.btn-ac-panel:hover,
.btn-ac-panel.ac-panel-btn--active {
  background: rgba(30, 64, 175, 0.9);
  opacity: 1;
}
.btn-ac-panel svg { flex-shrink: 0; }

/* Panel */
.ac-panel {
  position: fixed;
  top: 70px;
  right: 20px;
  width: 460px;
  height: 580px;
  z-index: 9996;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.12);
  /* Native browser resize */
  resize: both;
  min-width: 280px;
  min-height: 120px;
  max-width: 95vw;
  max-height: 92vh;
}
.ac-panel--hidden { display: none; }

/* Minimert: bare headeren vises */
.ac-panel--minimized {
  height: 42px !important;
  min-height: 42px;
  resize: none;
  overflow: hidden;
}
.ac-panel--minimized .ac-panel__body,
.ac-panel--minimized .ac-panel__resize-hint { display: none; }

/* Header / drag handle */
.ac-panel__header {
  background: #003366;
  color: #ffffff;
  padding: 0 10px 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
  height: 42px;
  min-height: 42px;
}
.ac-panel__header:active { cursor: grabbing; }
.ac-panel__title {
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-panel__header-btns {
  display: flex;
  gap: 2px;
  align-items: center;
  flex-shrink: 0;
  margin-left: 8px;
}
.ac-panel__hdr-btn {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  font-size: 1rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  border-radius: 4px;
  transition: opacity 0.15s, background 0.15s;
}
.ac-panel__hdr-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

/* Body + iframe */
.ac-panel__body {
  flex: 1;
  overflow: hidden;
  background: #f4f6f8;
  min-height: 0;
}
.ac-panel__iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Resize hint */
.ac-panel__resize-hint {
  text-align: center;
  font-size: 0.68rem;
  color: #9ca3af;
  padding: 2px 0;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
  user-select: none;
  pointer-events: none;
}

/* Fullskjerm-modus: juster knapper */
:fullscreen .btn-ac-panel,
:-webkit-full-screen .btn-ac-panel {
  bottom: 20px;
}
/* ═══════════════════════════════════════════════════════════════════════════
   IFRAME SCROLLBAR FIX (locked mode / LearnPress-embedding)
   Problem: html/body har overflow-y:auto i tillegg til at #message-display
   har sin egen interne scroll → dobbel scrollbar i den innebygde iframen.
   Løsning: lås ytre scroll i locked-mode; intern logg-scroll fungerer som før.
   ═══════════════════════════════════════════════════════════════════════════ */
/* ─── System-statusbar (over input-feltet) ──────────────────────────────── */
/* Vises kun ved aktiv status (TTS-quota, STT-fallback, osv.)
   Erstatter .vhf-system-warning i #message-display for ikke-konversasjonelle
   systemmeldinger. */
.system-status-bar {
  margin: 0 12px 6px 12px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  flex-shrink: 0;
  display: none;
  align-items: center;
  gap: 8px;
}
.system-status-bar--warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fcd34d;
}
.system-status-bar--error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}
.system-status-bar--info {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
}
.ssb-text {
  flex: 1;
  min-width: 0;
}
.ssb-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.ssb-counter {
  font-size: 0.75rem;
  opacity: 0.8;
  min-width: 28px;
  text-align: center;
}
.ssb-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 0.75rem;
  opacity: 0.7;
  line-height: 1;
  flex-shrink: 0;
}
.ssb-btn:hover { opacity: 1; background: rgba(255,255,255,0.1); }
.ssb-close { margin-left: 2px; font-size: 0.8rem; }

html.locked-mode,
html.locked-mode body {
  overflow: hidden !important;
}
/* ═══════════════════════════════════════════════════════════════════════════
   LOCKED MODE – DASHBOARD HEIGHT FIX
   I iframe-embedding er 100vh === nettleservinduet, ikke iframe-høyden.
   100% refererer derimot til iframe-høyden — dette er det vi vil ha.
   html/body må ha height:100% for at 100% skal propagere ned til dashboard.
   På mobil (≤1024px) er alt stacket vertikalt — height: auto er korrekt.
   ═══════════════════════════════════════════════════════════════════════════ */
html.locked-mode,
html.locked-mode body {
  height: 100% !important;
}

/* I iframe (LearnPress): bruk 100% av iframe-høyden */
html.locked-mode.in-iframe #simulator-dashboard {
  height: calc(100% - 80px) !important;
}

/* Direkte i nettleser (testing/utvikling): bruk full viewport-høyde */
html.locked-mode:not(.in-iframe) #simulator-dashboard {
  height: calc(100vh - 120px) !important;
}

@media (max-width: 1024px) {
  html.locked-mode #simulator-dashboard {
    height: auto !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   GENERATING REPORT SPINNER
   ═══════════════════════════════════════════════════════════════════════════ */
@keyframes report-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.report-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(148, 163, 184, 0.3);
  border-top-color: #94a3b8;
  border-radius: 50%;
  animation: report-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

/* Animerte prikker etter spinner-teksten */
@keyframes report-dots {
  0%   { content: "."; }
  33%  { content: ".."; }
  66%  { content: "..."; }
  100% { content: "."; }
}

.report-dots::after {
  content: "...";
  animation: report-dots 1.2s steps(1) infinite;
  display: inline-block;
  width: 1.5ch;
  text-align: left;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DEMO INTRO ACTION CARD BUTTON
   Pulserende "Start here"-knapp med Norvitra-logo radiosignal-animasjon.
   Pulseringen stopper første gang brukeren klikker.
   ═══════════════════════════════════════════════════════════════════════════ */
.btn-demo-intro {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1a2d5a;
  color: #c9a227;
  border: 1.5px solid #c9a227;
  border-radius: 8px;
  padding: 9px 16px 9px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.2s, transform 0.1s;
}
.btn-demo-intro:hover {
  background: #243d75;
  transform: translateY(-1px);
}
.btn-demo-intro:active {
  transform: scale(0.97);
}
.btn-demo-intro.ac-panel-btn--active {
  background: #c9a227;
  color: #1a2d5a;
  border-color: #c9a227;
}
.btn-demo-intro__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Radiosignal-ringer */
.btn-demo-intro__icon .ring {
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
}

/* Pulsering: 2-3 ringer som ekspanderer fra senter */
@keyframes demo-pulse {
  0%   { opacity: 0; stroke-width: 2.5; }
  30%  { opacity: 1; }
  70%  { opacity: 0.6; }
  100% { opacity: 0; stroke-width: 1; }
}

.btn-demo-intro--pulse .ring1 {
  animation: demo-pulse 1.8s ease-out infinite;
  animation-delay: 0s;
}
.btn-demo-intro--pulse .ring2 {
  animation: demo-pulse 1.8s ease-out infinite;
  animation-delay: 0.25s;
}
.btn-demo-intro--pulse .ring3 {
  animation: demo-pulse 1.8s ease-out infinite;
  animation-delay: 0s;
}
.btn-demo-intro--pulse .ring4 {
  animation: demo-pulse 1.8s ease-out infinite;
  animation-delay: 0.25s;
}

/* Ekstra glow-puls på selve knappen */
@keyframes demo-btn-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 162, 39, 0); }
  50%       { box-shadow: 0 0 0 6px rgba(201, 162, 39, 0.25); }
}
.btn-demo-intro--pulse {
  animation: demo-btn-glow 1.8s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════════════════════
   GENERATING REPORT SPINNER (brukes av generatingReport i texts/xx/ui.js)
   ═══════════════════════════════════════════════════════════════════════════ */
@keyframes report-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.report-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(148, 163, 184, 0.3);
  border-top-color: #94a3b8;
  border-radius: 50%;
  animation: report-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

/* Animerte prikker etter spinner-teksten */
@keyframes report-dots {
  0%   { content: "."; }
  33%  { content: ".."; }
  66%  { content: "..."; }
  100% { content: "."; }
}

.report-dots::after {
  content: "...";
  animation: report-dots 1.2s steps(1) infinite;
  display: inline-block;
  width: 1.5ch;
  text-align: left;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CALIBRATION COUNTDOWN OVERLAY (src/ui/calibration.js → runCountdown)
   Timing styres i JS; kun utseende og transitions ligger her.
   ═══════════════════════════════════════════════════════════════════════════ */
#calib-countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: opacity 0.4s ease;
}

#calib-countdown-overlay.fade-out {
  opacity: 0;
}

.calib-countdown-inner {
  text-align: center;
}

.calib-countdown-label {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 24px;
}

#calib-count-num {
  font-size: 140px;
  font-weight: 900;
  line-height: 1;
  font-family: "Share Tech Mono", monospace;
  color: #f59e0b;
  text-shadow: 0 0 60px rgba(245, 158, 11, 0.6), 0 0 120px rgba(245, 158, 11, 0.3);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

#calib-count-num.pulse {
  transform: scale(1.15);
}

#calib-count-num.mic-ready {
  font-size: 80px;
  color: #4ade80;
  text-shadow: 0 0 60px rgba(74, 222, 128, 0.6);
}

#calib-count-bar {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin: 28px auto 0;
  overflow: hidden;
}

#calib-count-progress {
  height: 100%;
  width: 100%;
  background: #f59e0b;
  transition: width 1s linear;
}