:root {
  --learn3-bg-top: #05070d;
  --learn3-bg-bottom: #0a1731;
  --learn3-panel: rgba(8, 14, 24, 0.9);
  --learn3-line: rgba(124, 255, 203, 0.16);
  --learn3-text: #eaf2ff;
  --learn3-muted: #a9b9d7;
  --learn3-star: #ffd15f;
  --learn3-cyan: #6fd5ff;
  --learn3-green: #7cffcb;
  --learn3-danger: #ff6c7e;
  --learn3-font:
    "Noto Sans TC", "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--learn3-text);
  font-family: var(--learn3-font);
  background:
    radial-gradient(
      120% 120% at 74% 0%,
      rgba(255, 209, 95, 0.13),
      transparent 38%
    ),
    radial-gradient(
      90% 110% at 12% 18%,
      rgba(111, 213, 255, 0.16),
      transparent 30%
    ),
    linear-gradient(160deg, var(--learn3-bg-top), var(--learn3-bg-bottom));
}

button {
  font-family: inherit;
}

.page-wrap {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding-inline: 24px;
}

.top-strip {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(8, 10, 23, 0.92);
  border-bottom: 1px solid rgba(126, 153, 255, 0.24);
  backdrop-filter: blur(8px);
}

.top-strip-inner {
  overflow-x: auto;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  min-height: 58px;
  width: max-content;
  min-width: 100%;
  padding: 0.5rem 0;
}

.top-bar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.78rem;
  flex-shrink: 0;
  margin-left: auto;
}

.icon-button {
  width: auto;
  height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  padding: 0;
  line-height: 0;
  flex-shrink: 0;
  transition:
    transform 0.2s ease,
    filter 0.2s ease;
}

.icon-button img {
  width: clamp(168px, 26vw, 280px);
  height: auto;
  display: block;
  pointer-events: none;
}

.icon-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.top-nav-links {
  display: inline-flex;
  align-items: center;
  gap: 0.58rem;
  flex-shrink: 0;
  min-width: max-content;
  white-space: nowrap;
}

.top-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.7rem 1.02rem;
  border-radius: 999px;
  border: 1px solid rgba(164, 191, 255, 0.2);
  background: rgba(14, 20, 38, 0.72);
  color: #e6eeff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.top-nav-link:hover {
  transform: translateY(-1px);
  background: rgba(31, 47, 84, 0.96);
  border-color: rgba(141, 176, 255, 0.5);
  box-shadow: 0 10px 24px rgba(5, 10, 24, 0.32);
}

.top-nav-link.is-active {
  background: linear-gradient(
    135deg,
    rgba(74, 117, 255, 0.92),
    rgba(42, 80, 186, 0.92)
  );
  border-color: rgba(198, 217, 255, 0.74);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(43, 77, 179, 0.28);
}

.top-lang-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.top-lang-switch::after {
  content: "▾";
  position: absolute;
  right: 0.9rem;
  color: #dbeafe;
  font-size: 0.9rem;
  pointer-events: none;
}

.top-lang-switch__select {
  min-height: 48px;
  padding: 0.7rem 2.25rem 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(164, 191, 255, 0.24);
  background: rgba(14, 20, 38, 0.72);
  color: #e6eeff;
  font: inherit;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  appearance: none;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.top-lang-switch__select:hover {
  transform: translateY(-1px);
  background: rgba(31, 47, 84, 0.96);
  border-color: rgba(141, 176, 255, 0.5);
  box-shadow: 0 10px 24px rgba(5, 10, 24, 0.32);
}

.top-lang-switch__select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(198, 217, 255, 0.9);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.game-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 1rem;
  padding: 1.2rem 0 2rem;
}

.game-stage,
.game-info {
  grid-column: 1;
}

.game-panel {
  background:
    linear-gradient(90deg, rgba(124, 255, 203, 0.05), transparent 34%),
    var(--learn3-panel);
  border: 1px solid var(--learn3-line);
  border-radius: 22px;
  color: #dde7f3;
  padding: 1rem 1.05rem;
  box-shadow: 0 18px 38px rgba(4, 10, 24, 0.34);
}

.game-stage {
  --game-frame-width: 1406px;
  --game-frame-height: 894px;
  --game-frame-gap: 14px;
  --game-frame-padding: 20px;
  --game-frame-surface-padding: 0px;
  padding: 8px;
  overflow: hidden;
}

.game-shell-learn3 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}

.game-shell-learn3 .game-shell__toolbar {
  position: relative;
  z-index: 12;
  grid-column: 1;
  align-items: center;
  min-height: 72px;
  height: 72px;
  padding: 10px 14px;
}

.game-shell-learn3 .game-shell__toolbar-group {
  gap: 10px;
}

.game-shell-learn3 .game-shell__button {
  min-height: 46px;
  padding: 0.72rem 1.18rem;
  font-size: 1.25rem;
}

.game-shell-learn3 .game-shell__play {
  position: relative;
  z-index: 1;
  grid-column: 1;
  grid-row: 2;
  align-items: stretch;
  justify-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    rgba(9, 15, 29, 0.88);
}

.learn3-audio-toggle {
  min-width: 74px;
  padding-inline: 0.92rem;
}

.learn3-audio-toggle.is-muted {
  background: rgba(21, 32, 58, 0.92);
  border-color: rgba(164, 191, 255, 0.24);
  opacity: 0.88;
}

.learn3-viewport {
  position: relative;
  width: 1366px;
  height: 768px;
  max-width: none;
  max-height: none;
  margin: 0;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(152, 192, 255, 0.44);
  background:
    radial-gradient(
      circle at 50% -15%,
      rgba(255, 209, 95, 0.15),
      transparent 42%
    ),
    linear-gradient(180deg, rgba(6, 12, 27, 0.96), rgba(9, 19, 42, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 28px 54px rgba(255, 255, 255, 0.03),
    0 18px 34px rgba(3, 10, 8, 0.28);
  user-select: none;
  touch-action: none;
}

.learn3-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #071329;
  pointer-events: none;
}

.learn3-hud {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  pointer-events: none;
}

.learn3-stat {
  min-width: 0;
  padding: 9px 12px;
  border-radius: 14px;
  border: 1px solid rgba(164, 191, 255, 0.22);
  background: rgba(7, 12, 26, 0.62);
  color: #eff6ff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 22px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
}

.learn3-stat__label {
  display: block;
  color: #9db3de;
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1.1;
}

.learn3-stat__value {
  display: block;
  margin-top: 4px;
  color: #ffffff;
  font-size: 1.3rem;
  line-height: 1;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.learn3-status {
  position: absolute;
  left: 50%;
  bottom: 118px;
  z-index: 6;
  transform: translateX(-50%);
  width: min(620px, calc(100% - 48px));
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 209, 95, 0.25);
  background: rgba(7, 12, 26, 0.58);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.38);
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.learn3-status:empty {
  display: none;
}

.learn3-touch-controls {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 7;
  display: none;
  grid-template-columns: repeat(3, 64px);
  gap: 12px;
  transform: translateX(-50%);
}

.learn3-touch-button {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 18px;
  background: rgba(8, 15, 32, 0.68);
  color: #ffffff;
  font-size: 2rem;
  font-weight: 950;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 14px 30px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
}

.learn3-touch-button.is-pressed {
  border-color: rgba(124, 255, 203, 0.72);
  background: rgba(28, 73, 86, 0.82);
}

.learn3-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 9, 21, 0.5);
  backdrop-filter: blur(4px);
}

.learn3-overlay.is-hidden {
  display: none;
}

.learn3-overlay__panel {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(460px, 100%);
  padding: 1.7rem;
  border-radius: 22px;
  border: 1px solid rgba(255, 209, 95, 0.34);
  background:
    radial-gradient(circle at top, rgba(255, 209, 95, 0.16), transparent 44%),
    linear-gradient(160deg, rgba(13, 24, 47, 0.98), rgba(7, 12, 26, 0.96));
  text-align: center;
  box-shadow: 0 28px 60px rgba(0, 5, 16, 0.42);
}

.learn3-overlay__kicker {
  margin: 0;
  color: var(--learn3-green);
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.learn3-overlay__panel h1 {
  margin: 0;
  color: #ffffff;
  font-size: 2.35rem;
  line-height: 1.08;
}

.learn3-overlay__panel p {
  margin: 0;
  color: #dce9fb;
  font-weight: 800;
  line-height: 1.55;
}

.learn3-overlay__panel button {
  min-height: 46px;
  min-width: 170px;
  border: 0;
  border-radius: 999px;
  padding: 0.78rem 1.25rem;
  background: linear-gradient(135deg, var(--learn3-star), #d78919);
  color: #241707;
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.game-info__panel {
  display: grid;
  gap: 0.12rem;
}

.game-kicker {
  margin: 0 0 0.35rem;
  color: var(--learn3-green);
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.game-info__lead {
  color: #c8d6e7;
  font-size: 1.05rem;
  font-weight: 700;
}

.game-info h2 {
  margin: 0 0 0.5rem;
  color: #ffffff;
}

.game-info p {
  margin: 0.35rem 0;
  line-height: 1.7;
}

.game-info h3 {
  margin: 1.2rem 0 0.5rem;
  color: #c4d0e8;
}

.site-footer {
  border-top: 1px solid rgba(177, 198, 233, 0.28);
  padding: 1rem 0 1.5rem;
  color: #d5e2ff;
}

.site-footer a {
  color: #eaf2ff;
}

@media (pointer: coarse), (max-width: 900px) {
  .learn3-touch-controls {
    display: grid;
  }

  .learn3-status {
    bottom: 94px;
  }
}

@media (max-width: 768px) {
  .page-wrap {
    padding-inline: 16px;
  }

  .top-bar {
    gap: 0.9rem;
    padding: 0.45rem 0;
  }

  .top-bar-actions,
  .top-nav-links {
    gap: 0.5rem;
  }

  .top-nav-link,
  .top-lang-switch__select {
    min-height: 40px;
    font-size: 0.95rem;
  }

  .top-nav-link {
    padding: 0.52rem 0.82rem;
  }

  .top-lang-switch__select {
    padding-inline: 0.9rem 2rem;
  }

  .game-shell-learn3 .game-shell__toolbar-group {
    flex-wrap: wrap;
  }

  .game-shell-learn3 .game-shell__button {
    min-height: 40px;
    padding: 0.56rem 0.82rem;
    font-size: 1rem;
  }
}

@media (max-width: 560px) {
  .icon-button img {
    width: 128px;
  }

  .game-shell-learn3 .game-shell__toolbar-group {
    gap: 8px;
  }

  .game-shell-learn3 .game-shell__button {
    min-height: 38px;
    padding: 0.48rem 0.7rem;
    font-size: 0.92rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
