:root {
  --panel-bg: rgba(17, 39, 54, 0.78);
  --panel-border: rgba(255, 255, 255, 0.3);
  --panel-shadow: rgba(11, 23, 37, 0.28);
  --text-main: #fdf9f1;
  --text-soft: rgba(253, 249, 241, 0.84);
  --accent-gold: #ffd76a;
  --title-font: "Georgia", "Palatino Linotype", serif;
  --body-font: "Trebuchet MS", "Gill Sans", sans-serif;
  --app-width: 100vw;
  --app-height: 100vh;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  font-family: var(--body-font);
  color: var(--text-main);
  background:
    radial-gradient(circle at 18% 15%, rgba(255, 238, 183, 0.42), transparent 22%),
    radial-gradient(circle at 82% 18%, rgba(141, 233, 203, 0.2), transparent 26%),
    linear-gradient(180deg, #7fc8ff 0%, #d8efff 33%, #d8f7d0 64%, #8ed29d 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 42vmax;
  height: 42vmax;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
  pointer-events: none;
}

body::before {
  top: -18vmax;
  left: -12vmax;
  background: rgba(255, 236, 173, 0.28);
}

body::after {
  right: -16vmax;
  bottom: -20vmax;
  background: rgba(88, 186, 136, 0.24);
}

.app-shell {
  position: relative;
  width: var(--app-width);
  height: var(--app-height);
  min-height: 100svh;
  overflow: hidden;
  z-index: 1;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.overlay {
  position: relative;
  z-index: 2;
  width: 100%;
  height: var(--app-height);
  padding: clamp(14px, 2.4vw, 28px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  pointer-events: none;
}

.top-row,
.dashboard {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.dashboard {
  align-items: flex-end;
}

.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 70%),
    var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: 0 18px 40px var(--panel-shadow);
  backdrop-filter: blur(12px);
}

.brand-card,
.mission-card,
.speed-card,
.controls-card,
.guide-bubble,
.story-card {
  border-radius: 24px;
}

.brand-card {
  max-width: min(460px, 54vw);
  padding: 18px 22px 20px;
}

.brand-card h1 {
  margin: 6px 0 8px;
  font-family: var(--title-font);
  font-size: clamp(1.7rem, 2.8vw, 2.5rem);
  line-height: 1.05;
}

.brand-card p,
.mission-card p,
.story-card p,
.guide-bubble p,
.panel-note {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.4;
}

.eyebrow,
.guide-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 243, 213, 0.88);
}

.eyebrow::before,
.guide-name::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-gold), #fff2bc);
  box-shadow: 0 0 18px rgba(255, 215, 106, 0.55);
}

.mission-card {
  min-width: min(440px, 50vw);
  max-width: min(500px, 54vw);
  padding: 18px 20px;
}

.mission-card h2 {
  margin: 12px 0 8px;
  font-family: var(--title-font);
  font-size: clamp(1.2rem, 2vw, 1.7rem);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 214, 106, 0.18);
  border: 1px solid rgba(255, 231, 173, 0.34);
  color: #fff3d1;
  font-size: 0.82rem;
  font-weight: 700;
}

.pill-soft {
  background: rgba(255, 255, 255, 0.08);
}

.guide-bubble {
  align-self: end;
  justify-self: start;
  max-width: min(360px, calc(100vw - 32px));
  margin-left: 8px;
  margin-bottom: 146px;
  padding: 16px 18px;
  z-index: 3;
}

.story-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(560px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
  padding: 26px 28px;
  pointer-events: auto;
}

.corner-actions {
  position: fixed;
  top: max(14px, calc(env(safe-area-inset-top) + 8px));
  right: max(14px, calc(env(safe-area-inset-right) + 8px));
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.corner-actions > * {
  pointer-events: auto;
}

.level-menu-button,
.language-toggle-button,
.icon-close-button {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.level-menu-button,
.language-toggle-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04)),
    rgba(17, 39, 54, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 18px 34px rgba(10, 22, 36, 0.28);
  color: #fff6df;
  backdrop-filter: blur(12px);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.level-menu-button:hover,
.language-toggle-button:hover,
.icon-close-button:hover,
.level-choice:hover {
  filter: brightness(1.04);
}

.level-menu-button:active,
.language-toggle-button:active,
.icon-close-button:active,
.level-choice:active {
  transform: translateY(1px) scale(0.99);
}

.level-menu-button {
  width: 54px;
  height: 54px;
  border-radius: 18px;
}

.level-menu-button svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.language-toggle-button {
  height: 46px;
  min-width: 52px;
  padding: 0 10px;
  border-radius: 16px;
  color: #fff6df;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.language-toggle-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  line-height: 1;
  pointer-events: none;
  transition: transform 140ms ease, opacity 140ms ease;
}

.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 6;
  background: rgba(8, 17, 28, 0.38);
  backdrop-filter: blur(6px);
}

.level-picker {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 7;
  width: min(760px, calc(100vw - 28px));
  max-height: calc(var(--app-height) - 30px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  transform: translate(-50%, -50%);
  padding: 22px 22px 20px;
  overflow: auto;
  pointer-events: auto;
}

.level-picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.level-picker-title-wrap h2 {
  margin: 8px 0 0;
  font-family: var(--title-font);
  font-size: clamp(1.35rem, 2.8vw, 2rem);
}

.level-picker-copy {
  margin: 12px 0 0;
  color: var(--text-soft);
  line-height: 1.45;
}

.icon-close-button {
  flex: 0 0 auto;
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff5d7;
  font-size: 0.92rem;
  font-weight: 800;
}

.level-picker-groups {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

.level-group {
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

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

.level-group-head h3 {
  margin: 0;
  font-size: 1rem;
  color: #fff5d7;
}

.level-group-head span {
  color: rgba(255, 248, 228, 0.68);
  font-size: 0.83rem;
}

.level-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.level-choice {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  width: 100%;
  text-align: left;
  border-radius: 18px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  box-shadow: 0 10px 22px rgba(10, 22, 36, 0.14);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease, border-color 140ms ease;
}

.level-choice small,
.level-choice span {
  display: block;
}

.level-choice small {
  color: rgba(255, 244, 214, 0.72);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.level-choice strong {
  display: block;
  margin-top: 7px;
  font-size: 0.98rem;
  line-height: 1.25;
}

.level-choice span {
  margin-top: 6px;
  color: rgba(255, 248, 228, 0.72);
  font-size: 0.84rem;
}

.level-choice.is-current {
  border-color: rgba(255, 214, 106, 0.58);
  background: linear-gradient(180deg, rgba(255, 214, 106, 0.2), rgba(255, 255, 255, 0.08));
  box-shadow: 0 14px 26px rgba(255, 214, 106, 0.18);
}

.level-choice.is-frontier {
  border-color: rgba(141, 233, 203, 0.42);
}

.story-card h2 {
  margin: 10px 0 12px;
  font-family: var(--title-font);
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.card-hint {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.dashboard section {
  pointer-events: auto;
}

.dashboard,
.speed-card,
.controls-card {
  touch-action: none;
}

.speed-card,
.controls-card {
  width: min(360px, calc(50vw - 24px));
  padding: 18px 18px 20px;
}

.speed-value {
  margin-top: 12px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.speed-value span {
  font-size: clamp(2.4rem, 4vw, 3.6rem);
  line-height: 1;
  font-weight: 800;
  color: #fff6de;
}

.speed-value small {
  font-size: 1rem;
  color: rgba(255, 249, 230, 0.78);
}

.speed-bar {
  margin: 14px 0 10px;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.speed-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8de9cb, #ffe275, #ff907f);
  box-shadow: 0 0 20px rgba(255, 214, 106, 0.34);
}

.switch-grid {
  margin: 14px 0 12px;
  display: grid;
  gap: 10px;
}

.switch-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
}

.switch-line span {
  color: rgba(255, 249, 237, 0.72);
  font-size: 0.92rem;
}

.switch-line strong {
  color: #fff4cb;
  font-size: 0.96rem;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.action-button,
.primary-button {
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: 18px;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

.action-button:hover,
.primary-button:hover {
  filter: brightness(1.04);
}

.action-button:active,
.primary-button:active,
.action-button.is-held {
  transform: translateY(2px) scale(0.99);
}

.action-button-primary {
  background: linear-gradient(180deg, #ffe88c, #ffbe55);
  color: #51350d;
  box-shadow: 0 8px 18px rgba(255, 188, 85, 0.34);
}

.action-button-secondary {
  background: linear-gradient(180deg, #fff0d6, #ffcdb0);
  color: #5a2d20;
  box-shadow: 0 8px 18px rgba(255, 180, 150, 0.28);
}

.action-button-gold,
.primary-button {
  background: linear-gradient(180deg, #fff3a8, #ffd56b);
  color: #4e360f;
  box-shadow: 0 8px 18px rgba(255, 214, 106, 0.34);
}

.action-button-mint {
  background: linear-gradient(180deg, #c8ffe8, #86e9c5);
  color: #18473d;
  box-shadow: 0 8px 18px rgba(141, 233, 203, 0.32);
}

.primary-button {
  margin-top: 18px;
  min-width: 220px;
}

.panel-note {
  min-height: 2.8em;
}

.app-shell.hud-tight .mission-card {
  max-width: min(500px, calc(100vw - 24px));
  padding: 10px 12px;
}

.app-shell.hud-tight .mission-card h2 {
  margin: 6px 0 2px;
  font-size: clamp(0.98rem, 2.2vw, 1.18rem);
}

.app-shell.hud-tight .mission-card p,
.app-shell.hud-tight .panel-note {
  display: none;
}

.app-shell.hud-tight .pill {
  padding: 6px 10px;
  font-size: 0.74rem;
}

.app-shell.hud-tight .dashboard {
  gap: 10px;
}

.app-shell.hud-tight .speed-card,
.app-shell.hud-tight .controls-card {
  padding: 10px 12px 12px;
}

.app-shell.hud-tight .speed-value {
  margin-top: 6px;
}

.app-shell.hud-tight .speed-value span {
  font-size: clamp(1.7rem, 4vw, 2.2rem);
}

.app-shell.hud-tight .speed-bar {
  margin: 8px 0 6px;
}

.app-shell.hud-tight .switch-grid {
  margin: 8px 0 6px;
  gap: 7px;
}

.app-shell.hud-tight .switch-line {
  padding: 7px 9px;
}

.app-shell.hud-tight .button-row {
  gap: 8px;
  margin-top: 8px;
}

.app-shell.hud-tight .action-button {
  min-height: 50px;
  padding: 10px 10px;
  font-size: 0.92rem;
}

.app-shell.hud-tight .guide-bubble {
  max-height: min(148px, calc(var(--app-height) - 260px));
  padding: 10px 12px;
}

.app-shell.hud-tiny .brand-card {
  display: none;
}

.app-shell.hud-tiny .overlay {
  padding: 10px;
}

.app-shell.hud-tiny .top-row {
  top: 10px;
  left: 10px;
  right: 10px;
  gap: 8px;
}

.app-shell.hud-tiny .dashboard {
  left: 10px;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  gap: 8px;
}

.app-shell.hud-tiny .speed-card,
.app-shell.hud-tiny .controls-card,
.app-shell.hud-tiny .mission-card,
.app-shell.hud-tiny .guide-bubble,
.app-shell.hud-tiny .story-card {
  border-radius: 20px;
}

.app-shell.hud-tiny .speed-card,
.app-shell.hud-tiny .controls-card {
  padding: 9px 10px 10px;
}

.app-shell.hud-tiny .speed-card .eyebrow,
.app-shell.hud-tiny .controls-card .eyebrow {
  display: none;
}

.app-shell.hud-tiny .speed-value {
  margin-top: 0;
}

.app-shell.hud-tiny .speed-value small {
  display: none;
}

.app-shell.hud-tiny .switch-line span,
.app-shell.hud-tiny .switch-line strong {
  font-size: 0.8rem;
}

.app-shell.hud-tiny .action-button {
  min-height: 46px;
  padding: 9px 9px;
  border-radius: 15px;
  font-size: 0.86rem;
}

.app-shell.hud-tiny .guide-bubble {
  max-height: min(126px, calc(var(--app-height) - 220px));
}

.app-shell.hud-micro .corner-actions {
  gap: 6px;
}

.app-shell.hud-micro .level-menu-button {
  width: 40px;
  height: 40px;
  border-radius: 14px;
}

.app-shell.hud-micro .level-menu-button svg {
  width: 21px;
  height: 21px;
}

.app-shell.hud-micro .language-toggle-button {
  height: 36px;
  min-width: 40px;
  padding: 0 7px;
  border-radius: 13px;
  font-size: 0.62rem;
}

.brand-card,
.mission-card,
.guide-bubble,
.story-card,
.speed-card,
.controls-card,
.switch-line,
.pill,
.speed-value,
.panel-note,
.card-hint {
  -webkit-user-select: none;
  user-select: none;
}

@media (max-width: 980px), (max-height: 820px) {
  .overlay {
    display: block;
    padding: 12px;
    gap: 10px;
  }

  .top-row {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    align-items: start;
  }

  .brand-card {
    display: none;
  }

  .mission-card {
    width: auto;
    min-width: 0;
    max-width: min(540px, calc(100vw - 24px));
    padding: 12px 14px;
  }

  .mission-card h2 {
    margin: 8px 0 4px;
    font-size: clamp(1rem, 2.3vw, 1.25rem);
  }

  .mission-card p {
    font-size: 0.9rem;
  }

  .dashboard {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
  }

  .speed-card,
  .controls-card {
    width: auto;
    min-width: 0;
    padding: 12px 14px 14px;
  }

  .speed-value {
    margin-top: 8px;
  }

  .speed-value span {
    font-size: clamp(1.9rem, 4vw, 2.5rem);
  }

  .speed-bar {
    margin: 10px 0 8px;
  }

  .switch-grid {
    margin: 10px 0 8px;
    gap: 8px;
  }

  .switch-line {
    padding: 8px 10px;
  }

  .button-row {
    gap: 8px;
    margin-top: 10px;
  }

  .action-button {
    min-height: 54px;
    padding: 12px;
  }

  .panel-note {
    min-height: 0;
    font-size: 0.86rem;
  }

  .guide-bubble {
    position: absolute;
    left: 12px;
    right: auto;
    top: 122px;
    bottom: auto;
    max-width: min(430px, calc(100vw - 24px));
    max-height: min(180px, calc(var(--app-height) - 320px));
    overflow: auto;
    margin: 0;
    padding: 12px 14px;
  }

  .corner-actions {
    gap: 8px;
  }

  .level-menu-button {
    width: 50px;
    height: 50px;
    border-radius: 16px;
  }

  .language-toggle-button {
    height: 44px;
    min-width: 48px;
    padding: 0 9px;
    border-radius: 15px;
    font-size: 0.7rem;
  }

  .level-picker {
    width: min(700px, calc(100vw - 22px));
    padding: 18px 18px 16px;
  }
}

@media (max-width: 640px), (max-height: 720px) {
  .overlay {
    padding: 10px;
  }

  .brand-card,
  .mission-card,
  .speed-card,
  .controls-card,
  .guide-bubble,
  .story-card {
    border-radius: 20px;
  }

  .mission-card {
    max-width: calc(100vw - 20px);
    padding: 10px 12px;
  }

  .mission-card p,
  .panel-note {
    display: none;
  }

  .pill {
    padding: 6px 10px;
    font-size: 0.74rem;
  }

  .dashboard {
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    gap: 8px;
  }

  .speed-card,
  .controls-card {
    padding: 10px 12px 12px;
  }

  .speed-value span {
    font-size: clamp(1.7rem, 7vw, 2.2rem);
  }

  .switch-line span,
  .switch-line strong {
    font-size: 0.84rem;
  }

  .action-button {
    border-radius: 16px;
    min-height: 50px;
    padding: 11px 10px;
    font-size: 0.95rem;
  }

  .guide-bubble {
    left: 10px;
    right: 10px;
    top: 92px;
    bottom: auto;
    max-width: none;
    max-height: min(132px, calc(var(--app-height) - 250px));
    padding: 10px 12px;
  }

  .story-card {
    width: min(520px, calc(100vw - 20px));
    padding: 22px 20px;
  }

  .corner-actions {
    top: max(10px, calc(env(safe-area-inset-top) + 4px));
    right: max(10px, calc(env(safe-area-inset-right) + 4px));
    gap: 8px;
  }

  .level-menu-button {
    width: 46px;
    height: 46px;
    border-radius: 15px;
  }

  .language-toggle-button {
    height: 40px;
    min-width: 44px;
    padding: 0 8px;
    border-radius: 14px;
    font-size: 0.68rem;
  }

  .level-menu-button svg {
    width: 24px;
    height: 24px;
  }

  .level-picker {
    width: min(620px, calc(100vw - 16px));
    padding: 16px 14px 14px;
  }

  .level-list {
    grid-template-columns: 1fr;
  }
}

.app-shell.compact-landscape .top-row,
.app-shell.compact-landscape .guide-bubble {
  display: none !important;
}

.app-shell.compact-landscape .overlay {
  display: block;
  padding: 0;
}

.app-shell.compact-landscape .story-card {
  width: min(560px, calc(100vw - 42px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  max-height: calc(var(--app-height) - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow: auto;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
}

.app-shell.compact-landscape .corner-actions {
  top: max(8px, calc(env(safe-area-inset-top) + 4px));
  right: max(8px, calc(env(safe-area-inset-right) + 4px));
  gap: 8px;
}

.app-shell.compact-landscape .level-menu-button {
  width: 44px;
  height: 44px;
  border-radius: 15px;
}

.app-shell.compact-landscape .language-toggle-button {
  height: 40px;
  min-width: 44px;
  padding: 0 8px;
  border-radius: 14px;
  font-size: 0.66rem;
}

.app-shell.phase-picker .level-menu-button {
  opacity: 0;
  pointer-events: none;
}

.app-shell.compact-landscape:not(.phase-playing) .dashboard {
  display: none;
}

.app-shell.compact-landscape.phase-playing .dashboard {
  position: fixed;
  left: max(12px, calc(env(safe-area-inset-left) + 8px));
  right: max(12px, calc(env(safe-area-inset-right) + 8px));
  bottom: max(10px, env(safe-area-inset-bottom));
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  justify-content: center;
  align-items: end;
  gap: 10px;
  pointer-events: none;
  z-index: 4;
}

.app-shell.compact-landscape.phase-playing .speed-card,
.app-shell.compact-landscape.phase-playing .controls-card {
  width: auto;
  min-width: 0;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
}

.app-shell.compact-landscape.phase-playing .speed-card .eyebrow,
.app-shell.compact-landscape.phase-playing .controls-card .eyebrow,
.app-shell.compact-landscape.phase-playing .speed-value,
.app-shell.compact-landscape.phase-playing .speed-bar,
.app-shell.compact-landscape.phase-playing .panel-note,
.app-shell.compact-landscape.phase-playing .switch-grid {
  display: none !important;
}

.app-shell.compact-landscape.phase-playing .speed-card .button-row,
.app-shell.compact-landscape.phase-playing .controls-card .button-row {
  width: min(13vw, 104px);
  margin-top: 0;
  gap: 8px;
  pointer-events: auto;
}

.app-shell.compact-landscape.phase-playing .speed-card .button-row {
  grid-template-columns: 1fr;
}

.app-shell.compact-landscape.phase-playing .controls-card .button-row {
  width: min(10vw, 78px);
  grid-template-columns: 1fr;
}

.app-shell.compact-landscape.phase-playing #switchButton {
  display: none;
}

.app-shell.compact-landscape.phase-playing .action-button {
  min-height: clamp(40px, 9.2vh, 52px);
  padding: 8px 8px;
  border-radius: 15px;
  font-size: clamp(0.78rem, 2.2vw, 0.92rem);
  box-shadow: 0 12px 24px rgba(12, 24, 38, 0.28);
}

.app-shell.compact-landscape.phase-playing.hud-tiny .dashboard,
.app-shell.compact-landscape.phase-playing.hud-micro .dashboard {
  left: max(8px, calc(env(safe-area-inset-left) + 4px));
  right: max(8px, calc(env(safe-area-inset-right) + 4px));
  bottom: max(6px, env(safe-area-inset-bottom));
  gap: 7px;
}

.app-shell.compact-landscape.phase-playing.hud-tiny .speed-card .button-row,
.app-shell.compact-landscape.phase-playing.hud-micro .speed-card .button-row {
  width: min(11vw, 82px);
  gap: 6px;
}

.app-shell.compact-landscape.phase-playing.hud-tiny .controls-card .button-row,
.app-shell.compact-landscape.phase-playing.hud-micro .controls-card .button-row {
  width: min(8vw, 62px);
}

.app-shell.compact-landscape.phase-playing.hud-tiny .action-button,
.app-shell.compact-landscape.phase-playing.hud-micro .action-button {
  min-height: 38px;
  padding: 7px 6px;
  border-radius: 14px;
  font-size: 0.72rem;
}

@media (orientation: landscape) and (max-height: 390px) {
  .app-shell.compact-landscape.phase-playing .dashboard {
    left: max(8px, calc(env(safe-area-inset-left) + 4px));
    right: max(8px, calc(env(safe-area-inset-right) + 4px));
    bottom: max(6px, env(safe-area-inset-bottom));
    gap: 6px;
  }

  .app-shell.compact-landscape.phase-playing .speed-card .button-row {
    width: min(10vw, 74px);
    gap: 6px;
  }

  .app-shell.compact-landscape.phase-playing .controls-card .button-row {
    width: min(7vw, 54px);
  }

  .app-shell.compact-landscape.phase-playing .action-button {
    min-height: 36px;
    padding: 6px 6px;
    border-radius: 14px;
    font-size: 0.7rem;
  }

  .level-picker {
    width: min(680px, calc(100vw - 14px));
    max-height: calc(var(--app-height) - 14px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 14px 12px 12px;
  }

  .level-picker-copy {
    font-size: 0.9rem;
  }

  .level-group {
    padding: 12px;
    border-radius: 18px;
  }
}

@media (orientation: landscape) and (min-width: 780px) and (max-height: 430px) {
  .app-shell.compact-landscape .story-card {
    width: min(620px, calc(100vw - 64px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    max-height: calc(var(--app-height) - 34px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  }

  .app-shell.compact-landscape.phase-playing .dashboard {
    left: max(18px, calc(env(safe-area-inset-left) + 12px));
    right: max(18px, calc(env(safe-area-inset-right) + 12px));
    bottom: max(14px, calc(env(safe-area-inset-bottom) + 4px));
    gap: 12px;
  }

  .app-shell.compact-landscape.phase-playing .speed-card .button-row {
    width: min(14vw, 112px);
  }

  .app-shell.compact-landscape.phase-playing .controls-card .button-row {
    width: min(11vw, 86px);
  }

  .app-shell.compact-landscape.phase-playing .action-button {
    min-height: 46px;
    border-radius: 16px;
    font-size: 0.86rem;
  }
}
