:root {
  --bg-0: #0e0907;
  --bg-1: #1a120e;
  --bg-2: #271810;
  --line: rgba(255, 197, 150, 0.24);
  --line-strong: rgba(255, 208, 170, 0.5);
  --text: #f6ead7;
  --muted: #d0b298;
  --ok: #b7ff8b;
  --warn: #ffcb6f;
  --bad: #ff8d8d;
  --primary-a: #f08e48;
  --primary-b: #9e572f;
  --panel: rgba(24, 16, 12, 0.86);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.46);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: "Share Tech Mono", "Consolas", monospace;
  background:
    radial-gradient(circle at 16% 20%, rgba(241, 151, 94, 0.16), transparent 28%),
    radial-gradient(circle at 82% 0%, rgba(203, 255, 120, 0.06), transparent 18%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 52%, var(--bg-2));
  overflow-x: hidden;
}

.screen-noise,
.scanlines,
.glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.screen-noise {
  background:
    radial-gradient(circle at 25% 35%, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px) 0 0/26px 26px,
    radial-gradient(circle at 78% 74%, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px) 0 0/30px 30px;
  opacity: 0.2;
}

.scanlines {
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.015) 0 2px,
    transparent 2px 4px
  );
  opacity: 0.5;
}

.glow-a {
  background: radial-gradient(circle at 10% 80%, rgba(255, 182, 123, 0.16), transparent 35%);
}

.glow-b {
  background: radial-gradient(circle at 87% 18%, rgba(137, 255, 176, 0.1), transparent 30%);
}

.app-shell {
  width: min(1120px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 20px 0 36px;
}

.morse-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(37, 24, 17, 0.92), rgba(20, 14, 11, 0.94)),
    linear-gradient(140deg, rgba(255, 255, 255, 0.04), transparent 46%);
  box-shadow: var(--shadow);
  padding: 20px;
}

.mission-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.hero-copy {
  flex: 1 1 100%;
  min-width: 0;
}

.hero-copy h1 {
  margin: 6px 0 8px;
  font-family: "Orbitron", "Share Tech Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.04;
  font-size: clamp(1.65rem, 3vw, 2.45rem);
}

.lead {
  margin: 0 0 6px;
  color: var(--muted);
  line-height: 1.5;
  max-width: none;
}

.hero-audio-wrap {
  margin-top: 10px;
  display: grid;
  gap: 6px;
  position: relative;
  padding: 8px 10px 10px;
  border: 1px solid rgba(255, 197, 150, 0.25);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(34, 23, 17, 0.78), rgba(20, 14, 11, 0.86)),
    radial-gradient(circle at 82% 8%, rgba(255, 196, 132, 0.12), transparent 34%);
  box-shadow: inset 0 0 0 1px rgba(255, 226, 198, 0.06);
}

.hero-audio-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 10px;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02) 0 1px,
    transparent 1px 3px
  );
  opacity: 0.22;
}

.hero-audio-label {
  margin: 0;
  color: #ffdcb8;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.68rem;
  font-family: "Orbitron", "Share Tech Mono", monospace;
}

.hero-audio-player {
  width: 100%;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 197, 150, 0.26);
  background: rgba(13, 9, 7, 0.92);
  box-shadow:
    inset 0 0 0 1px rgba(255, 223, 190, 0.06),
    0 0 0 1px rgba(18, 12, 9, 0.45);
}

.hero-audio-player:focus-visible {
  outline: 2px solid rgba(255, 188, 128, 0.42);
  outline-offset: 1px;
}

.hero-audio-player::-webkit-media-controls-enclosure {
  border-radius: 8px;
  background: rgba(13, 9, 7, 0.96);
}

.hero-audio-player::-webkit-media-controls-panel {
  background: linear-gradient(180deg, rgba(61, 39, 27, 0.96), rgba(30, 20, 14, 0.96));
}

.hero-audio-player::-webkit-media-controls-current-time-display,
.hero-audio-player::-webkit-media-controls-time-remaining-display {
  color: #f5dfc5;
}

.hero-audio-player::-webkit-media-controls-play-button,
.hero-audio-player::-webkit-media-controls-overflow-button {
  filter: brightness(1.42) contrast(1.1) saturate(1.1);
  opacity: 1;
}

.topbar-actions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-left: auto;
  order: -1;
}

.nav-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  transition: all 120ms ease;
}

.nav-pill:hover {
  border-color: var(--line-strong);
  color: var(--text);
  transform: translateY(-1px);
}

.mission-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 14px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  padding: 14px;
}

.mission-card {
  margin-bottom: 14px;
  background:
    linear-gradient(180deg, rgba(33, 22, 16, 0.94), rgba(18, 13, 10, 0.94)),
    radial-gradient(circle at 84% 18%, rgba(143, 255, 180, 0.06), transparent 34%);
}

.challenge-card,
.bot-card {
  border: none;
  border-radius: 14px;
  background: rgba(17, 12, 9, 0.84);
  padding: 12px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.card-head h2 {
  margin: 3px 0 0;
  font-family: "Orbitron", "Share Tech Mono", monospace;
  font-size: 1.1rem;
  line-height: 1.2;
}

.daily-focus-head {
  border: none;
  border-radius: 12px;
  padding: 0;
  background: transparent;
  margin-bottom: 6px;
  gap: 8px;
  align-items: center;
}

.daily-signal-style {
  border: 1px solid rgba(255, 197, 150, 0.22);
  border-radius: 12px;
  padding: 10px 10px 8px;
  background: linear-gradient(180deg, rgba(36, 24, 17, 0.64), rgba(27, 18, 13, 0.58));
  margin-bottom: 8px;
}

#challengeTitle,
.signal-style-title {
  color: #fff1df;
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  text-shadow: 0 0 12px rgba(240, 142, 72, 0.2);
}

.difficulty-chip {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.64rem;
}

.daily-focus-head .difficulty-chip {
  border-color: rgba(255, 215, 170, 0.45);
  background: linear-gradient(180deg, rgba(235, 149, 84, 0.35), rgba(155, 89, 46, 0.28));
  color: #ffe9ce;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 232, 205, 0.12);
}

.daily-hints {
  margin-bottom: 0;
}

.intro-line {
  margin: 0;
  color: #f2dcc4;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.signal-style-intro {
  font-family: "Orbitron", "Share Tech Mono", monospace;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  line-height: 1.3;
}

.transport-row {
  display: flex;
  gap: 10px;
  margin: 10px 0;
  flex-wrap: wrap;
}

.daily-actions {
  margin: 6px 0 8px;
  gap: 8px;
}

.daily-actions .primary-btn,
.daily-actions .ghost-btn {
  min-height: 36px;
  padding: 0 11px;
  font-size: 0.7rem;
  letter-spacing: 0.07em;
}

.playback-helper {
  margin: 8px 0 4px;
  display: grid;
  gap: 6px;
}

.playback-helper label {
  color: var(--muted);
  font-size: 0.8rem;
}

.playback-helper-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

#speedHelperRange {
  width: 100%;
  accent-color: #f08e48;
}

.speed-helper-value {
  color: var(--warn);
  font-size: 0.78rem;
  min-width: 110px;
  text-align: right;
}

button {
  font: inherit;
}

.primary-btn,
.ghost-btn {
  border-radius: 12px;
  min-height: 40px;
  padding: 0 13px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 120ms ease, filter 120ms ease, border-color 120ms ease;
}

.primary-btn {
  color: #fff5ea;
  border-color: rgba(255, 225, 200, 0.25);
  background: linear-gradient(180deg, var(--primary-a), var(--primary-b));
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
}

.ghost-btn {
  color: var(--muted);
  border-color: var(--line);
  background: rgba(23, 16, 12, 0.75);
}

.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  border-color: var(--line-strong);
}

.status-line,
.result-text,
.hint-text {
  margin: 8px 0 0;
  font-size: 0.92rem;
}

.guess-row {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.guess-row label {
  color: var(--muted);
}

.guess-row input {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(14, 10, 8, 0.88);
  color: var(--text);
  min-height: 42px;
  padding: 0 12px;
  font: inherit;
}

.guess-row input:focus {
  outline: 2px solid rgba(255, 188, 128, 0.35);
  outline-offset: 1px;
}

.hint-text {
  color: var(--warn);
}

.hint-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 5, 4, 0.72);
  backdrop-filter: blur(3px);
}

.hint-modal-card {
  width: min(560px, 100%);
  border: 1px solid rgba(255, 197, 150, 0.34);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(36, 24, 17, 0.98), rgba(21, 14, 11, 0.98)),
    radial-gradient(circle at 88% 10%, rgba(255, 200, 150, 0.1), transparent 34%);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.55);
  padding: 14px;
}

.hint-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.hint-modal-kicker {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.7rem;
}

.hint-modal-close {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
}

.hint-modal-title {
  margin: 0 0 10px;
  color: #fff0dc;
  font-family: "Orbitron", "Share Tech Mono", monospace;
  font-size: 1.02rem;
  line-height: 1.2;
}

.hint-modal-grid {
  margin: 0;
  display: grid;
  grid-template-columns: 122px 1fr;
  gap: 6px 10px;
  font-size: 0.84rem;
}

.hint-modal-grid dt {
  color: var(--muted);
}

.hint-modal-grid dd {
  margin: 0;
  color: var(--text);
}

.result-text.good {
  color: var(--ok);
}

.result-text.bad {
  color: var(--bad);
}

.is-hidden {
  display: none;
}

.matze-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px 6px 6px;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.matze-chip-image {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255, 208, 170, 0.28);
}

.history-card {
  background:
    linear-gradient(180deg, rgba(20, 14, 11, 0.92), rgba(17, 12, 9, 0.92)),
    radial-gradient(circle at 88% 10%, rgba(255, 200, 150, 0.08), transparent 30%);
}

.history-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 142, 72, 0.75) rgba(30, 20, 14, 0.9);
}

.history-list::-webkit-scrollbar {
  width: 10px;
}

.history-list::-webkit-scrollbar-track {
  background: rgba(30, 20, 14, 0.9);
  border-radius: 999px;
}

.history-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(240, 142, 72, 0.95), rgba(158, 87, 47, 0.95));
  border-radius: 999px;
  border: 2px solid rgba(30, 20, 14, 0.9);
}

.history-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(255, 174, 110, 0.98), rgba(183, 101, 54, 0.98));
}

.history-item-btn {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(20, 14, 11, 0.92);
  color: var(--text);
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
  font: inherit;
}

.history-item-btn:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.history-item-btn.is-active {
  border-color: rgba(183, 255, 139, 0.56);
  box-shadow: inset 0 0 0 1px rgba(183, 255, 139, 0.22);
}

.history-date {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.history-title {
  display: block;
  margin-top: 2px;
  font-size: 0.82rem;
}

.history-note {
  margin-top: 0;
}

.helper-card {
  margin-top: 0;
  border: none;
  background: transparent;
  padding: 0;
}

.tiny-info {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.alphabet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
}

.alphabet-cell {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(20, 14, 11, 0.92);
  min-height: 58px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}

.alphabet-cell:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.alphabet-cell.is-needed {
  border-color: rgba(183, 255, 139, 0.56);
  box-shadow: inset 0 0 0 1px rgba(183, 255, 139, 0.22);
}

.alphabet-cell.is-dimmed {
  opacity: 0.33;
  filter: saturate(0.55);
  border-color: rgba(255, 197, 150, 0.12);
}

.alphabet-cell:disabled,
.primary-btn:disabled,
.ghost-btn:disabled,
.guess-row input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.alphabet-char {
  font-family: "Orbitron", "Share Tech Mono", monospace;
  font-size: 0.88rem;
}

.alphabet-code {
  color: var(--muted);
  font-size: 0.72rem;
}

@media (max-width: 900px) {
  .mission-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 14px, 1120px);
    padding-top: 12px;
  }

  .morse-panel {
    border-radius: 18px;
    padding: 12px;
  }

  .mission-head {
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .transport-row {
    flex-direction: column;
  }

  .primary-btn,
  .ghost-btn {
    width: 100%;
  }

  .hint-modal-close {
    width: auto;
  }

  .hint-modal-grid {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .alphabet-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
