/* feat-finale: Level 42, Raumschiff «Die Zweifel» (finale_screen.dart). */

.finale {
  position: fixed;
  inset: 0;
  background: #060A18;
  color: #EFF2FF;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.finale *, .finale *::before, .finale *::after { box-sizing: border-box; }
.finale button { font: inherit; }

.finale-view { position: absolute; inset: 0; animation: finale-fade 520ms ease both; }
.finale--still .finale-view { animation: none; }
@keyframes finale-fade { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: none; } }

.finale-fill { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.finale-page { position: absolute; inset: 0; }
.finale-scroll { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.finale-list { position: relative; margin: 0 auto; }
.finale-list--hub { max-width: 1080px; padding: 10px 16px 24px; container-type: inline-size; }
.finale-list--station { max-width: 820px; padding: 12px 16px 28px; }
.finale-list--ending { max-width: 820px; padding: 16px 20px 28px; }
.finale-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow-y: auto; }
.finale-row { display: flex; align-items: center; }
.finale-muted { color: #A9B2D6; }

/* ---------------------------------------------------------- Knöpfe */
.finale-btn {
  width: 100%; height: var(--lern-button-height, 48px); padding: 0 20px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--lern-primary); color: var(--lern-secondary);
  border: 1px solid color-mix(in srgb, var(--lern-secondary) 60%, transparent);
  border-radius: var(--lern-button-radius, 4px); cursor: pointer;
  transition: transform 120ms ease-out; margin: 0 auto;
}
.finale-btn--outline { background: transparent; color: var(--lern-primary); border-color: var(--lern-secondary); }
.finale-btn:active:not(:disabled) { transform: scale(0.975); }
.finale-btn:disabled { opacity: 0.45; cursor: default; }
.finale-btn__text { font-size: 14px; font-weight: 800; letter-spacing: 1.6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.finale-textbtn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px;
  border: 0; border-radius: 20px; background: transparent; cursor: pointer;
  color: var(--lern-primary); font-size: 14px; font-weight: 500; letter-spacing: 0.1px;
}
.finale-textbtn:hover { background: rgba(255,255,255,0.06); }
.finale-textbtn--muted { color: #A9B2D6; font-weight: 800; }
.finale-textbtn--ink { color: #EFF2FF; font-weight: 800; }
.finale-textbtn--primary { color: var(--lern-primary); }
.finale-iconbtn { width: 48px; height: 48px; border: 0; border-radius: 24px; background: transparent; color: #EFF2FF;
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.finale-iconbtn:hover { background: rgba(255,255,255,0.08); }
.finale-outlined {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 24px 0 16px;
  border: 1px solid #A9B2D6; border-radius: 20px; background: transparent; color: #EFF2FF;
  font-size: 14px; font-weight: 500; cursor: pointer;
}
.finale-outlined--gold { color: #E2BE55; border-color: #E2BE55; }
.finale-outlined--block { width: 100%; padding: 0 24px; margin-bottom: 6px; min-height: 40px; height: auto; }

/* ------------------------------------------------------------ OKTAV */
.finale-oktav { display: flex; align-items: flex-start; gap: 10px; }
.finale-oktav__eye { width: 52px; height: 52px; flex: none; }
.finale-oktav__bubble { flex: 1; min-width: 0; padding: 10px 14px 12px; background: rgba(22,33,74,0.92);
  border: 1px solid rgba(95,224,207,0.45); border-radius: 0 14px 14px 14px; text-align: left; }
.finale-oktav__name { color: #5FE0CF; font-weight: 900; letter-spacing: 1.4px; font-size: 11px; }
.finale-oktav__text { margin-top: 3px; color: #EFF2FF; font-size: 14.5px; line-height: 1.4; }

/* ---------------------------------------------------------- Laden */
.finale-spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid #E2BE55; border-right-color: transparent;
  animation: finale-spin 1s linear infinite; }
@keyframes finale-spin { to { transform: rotate(360deg); } }
.finale-problem { padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 0; text-align: center; }
.finale-problem__title { margin-top: 12px; font-weight: 800; color: #EFF2FF; }
.finale-problem__text { margin: 6px 0 16px; color: #A9B2D6; }

/* ------------------------------------------------------ Vorspann */
.finale-intro { position: absolute; inset: 0; overflow: hidden; }
.finale-intro__ship { position: absolute; top: 14%; width: min(80%, 760px); aspect-ratio: 2.4; pointer-events: none; }
.finale-intro__content { position: absolute; inset: 0; padding: 20px; display: flex; flex-direction: column; align-items: stretch; overflow-y: auto; }
.finale-intro__skip { display: flex; justify-content: flex-end; }
.finale-intro__title { display: flex; flex-direction: column; align-items: center; }
.finale-intro__kicker { color: #E2BE55; font-size: 16px; font-weight: 900; }
.finale-intro__main { margin-top: 10px; }
.finale-intro__message { align-self: center; width: 100%; max-width: 640px; padding: 16px; background: rgba(0,0,0,0.45);
  border: 1px solid rgba(95,224,207,0.5); border-radius: 12px; }
.finale-intro__line { font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace; margin-bottom: 4px; white-space: pre-wrap; }
.finale-intro__greet { display: flex; flex-direction: column; align-items: center; width: 100%; }
.finale-intro__greet .finale-oktav { width: 100%; }

/* ----------------------------------------------------------- Schiff */
.finale-hub__titles { flex: 1; min-width: 0; }
.finale-hub__kicker { color: #E2BE55; font-size: 11.5px; letter-spacing: 1.6px; font-weight: 900; }
.finale-hub__title { color: #EFF2FF; font-size: 22px; font-weight: 900; }
.finale-gauge { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.finale-gauge__text { font-weight: 900; font-size: 12px; letter-spacing: 1px; }
.finale-gauge__track { margin-top: 4px; width: 120px; height: 8px; border-radius: 4px; overflow: hidden; background: rgba(255,255,255,0.12); }
.finale-gauge__bar { height: 100%; transition: width 520ms ease; }
.finale--still .finale-gauge__bar { transition: none; }

.finale-lost { padding: 12px 16px 14px; background: rgba(0,0,0,0.4); border: 1px solid rgba(226,190,85,0.45); border-radius: 14px; }
.finale-lost__title { color: #E2BE55; font-size: 11.5px; letter-spacing: 1.4px; font-weight: 900; }
.finale-lost__words { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.finale-word { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 10px; border: 1px solid rgba(226,190,85,0.8);
  color: #EFF2FF; font-size: 17px; font-weight: 900; }
.finale-word--hidden { justify-content: center; height: 34px; padding: 0; background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.18); color: rgba(255,255,255,0.35); font-size: 14px; }
.finale-lost__arrow { color: #A9B2D6; font-size: 18px; font-weight: 900; }

.finale-ship { padding: 26px 0 0 56px; }
.finale-ship__area { position: relative; aspect-ratio: 2.3; animation: finale-hover 4s ease-in-out infinite alternate; }
.finale--still .finale-ship__area { animation: none; }
@keyframes finale-hover { from { transform: translateY(-4px); } to { transform: translateY(4px); } }
.finale-dot { position: absolute; width: 44px; height: 44px; border-radius: 50%; border: 2px solid; padding: 0;
  background: rgba(6,10,24,0.8); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.finale-dot:hover { background: rgba(30,40,80,0.9); }
.finale-hotspot { position: absolute; width: 28px; height: 28px; border-radius: 50%; padding: 0; cursor: pointer;
  background: rgba(0,0,0,0.35); border: 1px solid rgba(169,178,214,0.6); color: #A9B2D6;
  display: flex; align-items: center; justify-content: center; }
.finale-hotspot--found { border-color: rgba(226,190,85,0.6); color: #E2BE55; }

.finale-cards { display: grid; grid-template-columns: 1fr; gap: 10px; }
@container (min-width: 381px) { .finale-cards { grid-template-columns: repeat(2, 1fr); } }
@container (min-width: 601px) { .finale-cards { grid-template-columns: repeat(3, 1fr); } }
@container (min-width: 901px) { .finale-cards { grid-template-columns: repeat(4, 1fr); } }
.finale-card { display: flex; align-items: center; gap: 10px; padding: 12px; text-align: left; cursor: pointer;
  background: rgba(17,26,56,0.9); border: 1px solid; border-radius: 12px; color: #EFF2FF; }
.finale-card:hover { background: rgba(30,42,84,0.95); }
.finale-card__icon { display: flex; flex: none; }
.finale-card__texts { display: flex; flex-direction: column; min-width: 0; }
.finale-card__name { font-weight: 800; font-size: 14px; }
.finale-card__state { font-size: 12px; font-weight: 700; }
.finale-hub__foot { color: #A9B2D6; font-weight: 700; font-size: 14px; flex-wrap: wrap; }
.finale-hub__done { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; }

/* Kammer 42-B und Dialoge */
.finale-barrier { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,0.54); display: flex; align-items: center; justify-content: center; padding: 24px; }
.finale-barrier--sheet { align-items: flex-end; padding: 0; }
.finale-sheet { width: 100%; max-width: 640px; margin: 12px; padding: 12px 0; background: #0F1734;
  border: 1px solid rgba(226,190,85,0.6); border-radius: 16px; animation: finale-up 250ms ease-out; }
.finale--still .finale-sheet { animation: none; }
@keyframes finale-up { from { transform: translateY(40%); opacity: 0; } to { transform: none; opacity: 1; } }
.finale-sheet__intro { padding: 4px 16px 8px; color: #A9B2D6; }
.finale-tile { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 56px; padding: 8px 24px 8px 16px;
  border: 0; background: transparent; text-align: left; cursor: pointer; color: #EFF2FF; }
.finale-tile:hover { background: rgba(255,255,255,0.05); }
.finale-tile__title { flex: 1; font-weight: 700; font-size: 16px; }
.finale-dialog { width: 100%; max-width: 560px; max-height: 100%; overflow-y: auto; padding: 24px; background: #16214A; border-radius: 28px; }
.finale-dialog__title { color: #E2BE55; font-size: 24px; margin-bottom: 16px; }
.finale-dialog__text { color: #EFF2FF; line-height: 1.45; white-space: pre-wrap; font-size: 14px; }
.finale-dialog__reply { margin-top: 12px; color: #5FE0CF; font-style: italic; }
.finale-dialog__actions { display: flex; justify-content: flex-end; margin-top: 24px; }

/* ---------------------------------------------------------- Station */
.finale-station__title { color: #E2BE55; font-weight: 900; letter-spacing: 1.6px; font-size: 13px; }
.finale-station__room { position: relative; height: 170px; border-radius: 16px; overflow: hidden; }
.finale-console { padding: 18px; background: var(--lern-bg); color: var(--lern-ink); border-radius: 16px;
  border: 1.5px solid rgba(226,190,85,0.7); box-shadow: 0 0 24px rgba(95,224,207,0.15); }
.finale-console__prompt { font-size: 19px; line-height: 1.3; font-weight: 800; color: var(--lern-ink); }
.finale-locked { pointer-events: none; }
.finale-warp { pointer-events: none; z-index: 5; }
.finale-hint { color: var(--lern-muted); font-size: 13px; margin: 0; }
.finale-hint--plain { font-size: 14px; }

.finale-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.finale-chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 8px; border-radius: 8px;
  background: var(--lern-surface); border: 1px solid var(--lern-border); color: var(--lern-ink); font-size: 12px; }
.finale-line { margin-bottom: 8px; padding: 13px; border-radius: 10px; background: var(--lern-surface);
  border: 1px solid var(--lern-border); color: var(--lern-ink); font-weight: 600; line-height: 1.35; }
.finale-line--faded { background: var(--lern-bg); color: var(--lern-muted); }
.finale-line--strong { background: rgba(226,190,85,0.14); border-color: #E2BE55; font-weight: 800; }
.finale-choice { margin: 0 0 8px 18px; padding: 10px; border-radius: 8px; color: var(--lern-ink); font-size: 13.5px; line-height: 1.35; white-space: pre-line; }
.finale-option { display: flex; align-items: center; width: 100%; margin-top: 8px; padding: 13px; text-align: left; cursor: pointer;
  background: var(--lern-surface); border: 1.5px solid rgba(226,190,85,0.8); border-radius: 10px; color: #E2BE55; }
.finale-option--locked { background: var(--lern-bg); border-color: var(--lern-border); color: var(--lern-muted); cursor: default; }
.finale-option__texts { flex: 1; display: flex; flex-direction: column; }
.finale-option__text { font-weight: 700; color: var(--lern-ink); font-size: 14px; }
.finale-option--locked .finale-option__text { color: var(--lern-muted); }
.finale-option__needs { margin-top: 4px; font-size: 12px; color: var(--lern-muted); }
.finale-undo { margin-top: 4px; }

.finale-fragment { display: flex; align-items: center; margin-bottom: 12px; padding: 14px; border-radius: 14px;
  background: linear-gradient(90deg, #1B1446, #0E2A3A); border: 1px solid rgba(226,190,85,0.8); }
.finale-fragment__ring { position: relative; width: 92px; height: 92px; flex: none; display: flex; align-items: center; justify-content: center; }
.finale-fragment__word { position: relative; }
.finale-fragment__texts { flex: 1; min-width: 0; }
.finale-fragment__title { color: #E2BE55; font-size: 11.5px; letter-spacing: 1.2px; font-weight: 900; }
.finale-fragment__insight { color: #EFF2FF; font-size: 15px; font-weight: 700; line-height: 1.3; }

/* ---------------------------------------------------------- Wendung */
.finale-twist { width: 100%; max-width: 720px; padding: 20px; display: flex; flex-direction: column; text-align: center; margin: auto; }
.finale-twist__title { color: #E2BE55; letter-spacing: 4px; font-weight: 900; font-size: 14px; }
.finale-twist__line { margin-bottom: 12px; line-height: 1.4; animation: finale-line 520ms ease both; }
.finale--still .finale-twist__line { animation: none; }
@keyframes finale-line { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.finale-twist__button { display: flex; justify-content: center; }
.finale-twist__skip { align-self: center; }

/* -------------------------------------------------------- Abschluss */
.finale-ending__skip { display: flex; justify-content: flex-end; }
.finale-ending__constellation { position: relative; height: 260px; }
.finale-check { display: flex; flex-direction: column; align-items: center; }
.finale-check__stage { position: relative; height: 120px; width: 100%; display: flex; align-items: center; justify-content: center; }
.finale-check__row { position: relative; display: flex; align-items: center; justify-content: center; }
.finale-check__text { font-family: "Bungee", "Fredoka", sans-serif; font-size: 44px; font-weight: 900; line-height: 1; color: #EFF2FF; white-space: pre; }
.finale-check__wrong { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.finale-check__right { position: absolute; right: -84px; }
.finale-check__caption { color: #5FE0CF; font-size: 15px; font-weight: 800; text-align: center; }
.finale-ending__line { margin-bottom: 6px; color: #EFF2FF; font-size: 15.5px; line-height: 1.4; text-align: center; }
.finale-ending__insight { color: #E2BE55; font-size: 21px; font-weight: 900; line-height: 1.3; text-align: center; }
.finale-ending__rest { display: flex; flex-direction: column; align-items: stretch; }
.finale-ending__badges { display: flex; align-items: center; justify-content: center; }
.finale-ending__badge { position: relative; width: 120px; height: 120px; flex: none; }
.finale-ending__badge-text { color: #EFF2FF; font-weight: 800; text-align: center; }
.finale-ending__result { display: flex; flex-direction: column; align-items: center; padding: 14px; background: rgba(0,0,0,0.35);
  border: 1px solid rgba(226,190,85,0.5); border-radius: 12px; }
.finale-ending__stars { display: flex; justify-content: center; color: #E2BE55; }
.finale-ending__xp { color: #EFF2FF; font-weight: 800; }
.finale-ending__status { color: #EFF2FF; text-align: center; }
.finale-unlock { color: var(--lern-ink); }

.finale-eval { padding: 14px; background: rgba(17,26,56,0.9); border: 1px solid rgba(95,224,207,0.4); border-radius: 12px; }
.finale-eval__title { color: #5FE0CF; font-weight: 900; letter-spacing: 1.4px; font-size: 12px; }
.finale-eval__row { display: flex; align-items: center; padding: 3px 0; }
.finale-eval__skill { flex: 1; color: #EFF2FF; font-weight: 700; font-size: 14px; }
.finale-eval__room { color: #A9B2D6; font-size: 12px; }
.finale-eval__eggs { color: #A9B2D6; font-size: 12.5px; }

/* ---------------------------------------------------------- Meldung */
.finale-toast { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 14px 16px; background: #322F35; color: #F5EFF7; font-size: 14px; line-height: 1.4;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.3); animation: finale-fade 250ms ease both; }
.finale--still .finale-toast { animation: none; }
