    :root {
      --ink: #f6fbff;
      --muted: #9fb5c6;
      --night: #06131b;
      --night-2: #0a2028;
      --panel: rgba(9, 29, 37, .88);
      --panel-strong: #0e2a34;
      --line: rgba(155, 220, 225, .16);
      --cyan: #69e5e0;
      --cyan-2: #24bfb7;
      --lime: #b5ef7a;
      --gold: #ffd166;
      --pink: #ff8fc7;
      --danger: #ff7d88;
      --shadow: 0 30px 80px rgba(0, 0, 0, .34);
      --radius: 24px;
    }

    * { box-sizing: border-box; }

    html { scroll-behavior: smooth; }

    body {
      margin: 0;
      min-width: 320px;
      color: var(--ink);
      background:
        radial-gradient(circle at 18% 12%, rgba(40, 191, 183, .15), transparent 32%),
        radial-gradient(circle at 82% 8%, rgba(181, 239, 122, .08), transparent 28%),
        linear-gradient(155deg, var(--night), #041017 58%, #071920);
      font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
      min-height: 100vh;
      overflow-x: hidden;
    }

    button, input {
      font: inherit;
    }

    button {
      color: inherit;
    }

    .app {
      width: min(1480px, calc(100% - 32px));
      margin: 0 auto;
      padding: 22px 0 44px;
      position: relative;
    }

    .app::before {
      content: "";
      position: fixed;
      inset: 0;
      pointer-events: none;
      opacity: .32;
      background-image:
        linear-gradient(rgba(105, 229, 224, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(105, 229, 224, .035) 1px, transparent 1px);
      background-size: 34px 34px;
      mask-image: linear-gradient(to bottom, black, transparent 84%);
    }

    .topbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      margin-bottom: 18px;
      position: relative;
      z-index: 25;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .brand-mark {
      width: 48px;
      height: 48px;
      border: 1px solid rgba(105, 229, 224, .35);
      border-radius: 16px;
      display: grid;
      place-items: center;
      background: linear-gradient(145deg, rgba(105, 229, 224, .19), rgba(105, 229, 224, .04));
      box-shadow: inset 0 0 22px rgba(105, 229, 224, .1), 0 0 26px rgba(105, 229, 224, .09);
    }

    .brand-mark svg { width: 27px; height: 27px; }

    .eyebrow {
      color: var(--cyan);
      font-size: 12px;
      letter-spacing: .16em;
      text-transform: uppercase;
      margin-bottom: 4px;
    }

    .brand h1 {
      font-size: clamp(20px, 3vw, 28px);
      line-height: 1.1;
      margin: 0;
      font-weight: 700;
      letter-spacing: -.03em;
    }

    .top-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .more-menu { position: relative; }

    .more-menu > summary {
      list-style: none;
      user-select: none;
    }

    .more-menu > summary::-webkit-details-marker { display: none; }

    .more-menu-panel {
      position: absolute;
      right: 0;
      top: calc(100% + 8px);
      width: 180px;
      display: grid;
      gap: 6px;
      padding: 8px;
      z-index: 20;
      border: 1px solid var(--line);
      border-radius: 14px;
      background: rgba(6, 19, 27, .98);
      box-shadow: var(--shadow);
    }

    .more-menu-panel .btn { width: 100%; text-align: left; }

    .btn {
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 10px 14px;
      background: rgba(255, 255, 255, .035);
      color: var(--ink);
      cursor: pointer;
      transition: transform .16s ease, border-color .16s ease, background .16s ease;
    }

    .btn:hover {
      transform: translateY(-1px);
      border-color: rgba(105, 229, 224, .4);
      background: rgba(105, 229, 224, .08);
    }

    .btn-link {
      display: inline-flex;
      align-items: center;
      text-decoration: none;
    }

    .btn:focus-visible,
    .option:focus-visible,
    .level-node:focus-visible,
    input:focus-visible {
      outline: 3px solid rgba(105, 229, 224, .35);
      outline-offset: 3px;
    }

    .btn-primary {
      border-color: transparent;
      color: #03201f;
      font-weight: 700;
      background: linear-gradient(135deg, var(--cyan), var(--lime));
      box-shadow: 0 10px 26px rgba(36, 191, 183, .18);
    }

    .btn-primary:hover {
      background: linear-gradient(135deg, #7af2ed, #c5f58f);
    }

    .btn-danger {
      color: #ffd9de;
      border-color: rgba(255, 125, 136, .25);
    }

    .hud {
      display: grid;
      grid-template-columns: minmax(240px, 1.5fr) repeat(3, minmax(110px, .5fr));
      gap: 12px;
      margin-bottom: 16px;
      position: relative;
      z-index: 2;
    }

    .hud-card {
      min-height: 82px;
      border: 1px solid var(--line);
      border-radius: 18px;
      background: rgba(8, 27, 34, .72);
      padding: 14px 16px;
      backdrop-filter: blur(16px);
    }

    .player-card {
      display: flex;
      align-items: center;
      gap: 13px;
    }

    .companion {
      width: 50px;
      height: 50px;
      border-radius: 50%;
      display: grid;
      place-items: center;
      font-size: 25px;
      flex: none;
      background: radial-gradient(circle at 35% 28%, #eafffd, var(--cyan) 28%, var(--cyan-2) 70%);
      box-shadow: 0 0 24px rgba(105, 229, 224, .32);
    }

    .hud-label {
      font-size: 12px;
      color: var(--muted);
      margin-bottom: 5px;
    }

    .hud-value {
      font-size: 22px;
      font-weight: 700;
      letter-spacing: -.02em;
    }

    .progress-track {
      height: 7px;
      background: rgba(255,255,255,.07);
      border-radius: 999px;
      margin-top: 9px;
      overflow: hidden;
    }

    .progress-fill {
      height: 100%;
      width: 0;
      border-radius: inherit;
      background: linear-gradient(90deg, var(--cyan), var(--lime));
      box-shadow: 0 0 14px rgba(105, 229, 224, .38);
      transition: width .45s ease;
    }

    .layout {
      display: grid;
      grid-template-columns: minmax(0, 1.3fr) minmax(380px, .7fr);
      gap: 16px;
      align-items: stretch;
      position: relative;
      z-index: 2;
    }

    .world,
    .mission {
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: var(--panel);
      box-shadow: var(--shadow);
      backdrop-filter: blur(18px);
      overflow: hidden;
    }

    .world {
      min-height: 720px;
      position: relative;
      isolation: isolate;
      background:
        radial-gradient(circle at 50% 92%, rgba(181,239,122,.17), transparent 34%),
        radial-gradient(circle at 82% 12%, rgba(255,209,102,.08), transparent 24%),
        linear-gradient(180deg, rgba(10,39,47,.92), rgba(5,24,29,.97));
    }

    .world::before {
      content: "";
      position: absolute;
      inset: 0;
      z-index: -2;
      opacity: .8;
      background:
        radial-gradient(circle at 15% 26%, rgba(105,229,224,.16) 0 2px, transparent 3px),
        radial-gradient(circle at 73% 15%, rgba(255,209,102,.18) 0 2px, transparent 3px),
        radial-gradient(circle at 84% 66%, rgba(181,239,122,.15) 0 2px, transparent 3px),
        radial-gradient(circle at 31% 67%, rgba(255,143,199,.12) 0 2px, transparent 3px);
      background-size: 180px 170px, 230px 210px, 190px 240px, 250px 220px;
      animation: drift 15s linear infinite;
    }

    .world::after {
      content: "";
      position: absolute;
      left: -5%;
      right: -5%;
      bottom: -50px;
      height: 270px;
      z-index: -1;
      opacity: .58;
      background:
        radial-gradient(ellipse at 12% 100%, #123f3c 0 23%, transparent 24%),
        radial-gradient(ellipse at 33% 100%, #0d332f 0 31%, transparent 32%),
        radial-gradient(ellipse at 58% 100%, #16443a 0 26%, transparent 27%),
        radial-gradient(ellipse at 82% 100%, #0d302e 0 33%, transparent 34%);
      filter: blur(1px);
    }

    .forest-scene {
      position: absolute;
      inset: 0;
      z-index: 0;
      pointer-events: none;
      overflow: hidden;
    }

    .moon {
      position: absolute;
      width: 96px;
      height: 96px;
      right: 7%;
      top: 13%;
      border-radius: 50%;
      opacity: .7;
      background: radial-gradient(circle at 36% 32%, #fffbd7 0 8%, #ffd166 35%, rgba(255,209,102,.06) 68%);
      box-shadow: 0 0 70px rgba(255,209,102,.18);
    }

    .forest-hill {
      position: absolute;
      width: 54%;
      height: 25%;
      bottom: -12%;
      border-radius: 50% 50% 0 0;
      background: linear-gradient(180deg, rgba(30,93,69,.58), rgba(8,47,42,.72));
      filter: blur(.2px);
    }

    .forest-hill.one { left: -9%; transform: rotate(4deg); }
    .forest-hill.two { right: -12%; bottom: -9%; transform: rotate(-5deg); opacity: .82; }

    .landmark {
      position: absolute;
      display: grid;
      place-items: center;
      width: 46px;
      height: 46px;
      font-size: 28px;
      opacity: .64;
      filter: saturate(.9) drop-shadow(0 8px 8px rgba(0,0,0,.35));
      animation: breathe 4.8s ease-in-out infinite;
    }

    .landmark.tree-a { left: 4%; top: 8%; font-size: 38px; }
    .landmark.tree-b { left: 86%; top: 31%; font-size: 42px; animation-delay: -1.8s; }
    .landmark.tree-c { left: 43%; top: 77%; font-size: 40px; animation-delay: -3s; }
    .landmark.mushroom { left: 13%; top: 55%; animation-delay: -2.2s; }
    .landmark.crystal { left: 77%; top: 74%; animation-delay: -.8s; }
    .landmark.ruin { left: 54%; top: 21%; animation-delay: -3.7s; }

    .firefly {
      position: absolute;
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background: #e6ff91;
      box-shadow: 0 0 10px #b5ef7a, 0 0 18px rgba(181,239,122,.7);
      animation: firefly 5s ease-in-out infinite;
    }

    .firefly.f1 { left: 18%; top: 18%; }
    .firefly.f2 { left: 62%; top: 34%; animation-delay: -1.4s; }
    .firefly.f3 { left: 78%; top: 62%; animation-delay: -3.2s; }
    .firefly.f4 { left: 36%; top: 57%; animation-delay: -4.1s; }
    .firefly.f5 { left: 55%; top: 85%; animation-delay: -2.3s; }

    @keyframes firefly {
      0%, 100% { transform: translate(0, 0) scale(.8); opacity: .28; }
      35% { transform: translate(18px, -12px) scale(1.2); opacity: 1; }
      70% { transform: translate(-10px, 15px) scale(.9); opacity: .5; }
    }

    @keyframes breathe {
      0%, 100% { transform: translateY(0) rotate(-1deg); }
      50% { transform: translateY(-5px) rotate(1deg); }
    }

    .journey-avatar {
      position: absolute;
      z-index: 5;
      width: 42px;
      height: 42px;
      display: grid;
      place-items: center;
      border: 2px solid #efffff;
      border-radius: 50% 50% 50% 12px;
      color: #09201f;
      font-size: 23px;
      background: linear-gradient(145deg, #f2fffe, var(--cyan));
      box-shadow: 0 0 0 6px rgba(105,229,224,.1), 0 9px 24px rgba(0,0,0,.34);
      transform: translate(-116%, -112%) rotate(-7deg);
      transition: left .65s cubic-bezier(.2,.8,.2,1), top .65s cubic-bezier(.2,.8,.2,1);
      pointer-events: none;
    }

    .journey-avatar span { transform: rotate(7deg); }

    .journey-avatar::after {
      content: "我在这里";
      position: absolute;
      left: 36px;
      top: -12px;
      width: max-content;
      padding: 4px 7px;
      border: 1px solid rgba(105,229,224,.25);
      border-radius: 8px 8px 8px 2px;
      color: var(--cyan);
      background: rgba(5,21,27,.92);
      font-size: 10px;
      transform: rotate(7deg);
    }

    @keyframes drift {
      from { background-position: 0 0, 0 0, 0 0, 0 0; }
      to { background-position: 180px 170px, -230px 210px, 190px -240px, -250px -220px; }
    }

    .world-header {
      position: absolute;
      top: 22px;
      left: 24px;
      right: 24px;
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 16px;
      z-index: 4;
      pointer-events: none;
    }

    .world-kicker {
      color: var(--lime);
      font-size: 12px;
      letter-spacing: .12em;
      margin-bottom: 5px;
    }

    .world-header h2 {
      margin: 0;
      font-size: 22px;
    }

    .world-tip {
      color: var(--muted);
      font-size: 12px;
      text-align: right;
      max-width: 240px;
    }

    .map {
      position: relative;
      height: 720px;
      width: 100%;
    }

    .route {
      position: absolute;
      inset: 86px 22px 28px;
      width: calc(100% - 44px);
      height: calc(100% - 114px);
      overflow: visible;
      opacity: .75;
    }

    .route-shadow {
      fill: none;
      stroke: rgba(0,0,0,.35);
      stroke-width: 16;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .route-line {
      fill: none;
      stroke: url(#routeGradient);
      stroke-width: 5;
      stroke-linecap: round;
      stroke-linejoin: round;
      stroke-dasharray: 3 13;
      filter: drop-shadow(0 0 8px rgba(105,229,224,.22));
    }

    .level-node {
      position: absolute;
      transform: translate(-50%, -50%);
      width: 66px;
      height: 66px;
      border-radius: 50%;
      border: 2px solid rgba(159,181,198,.24);
      background: #0b252e;
      color: var(--muted);
      display: grid;
      place-items: center;
      cursor: pointer;
      z-index: 3;
      box-shadow: 0 12px 24px rgba(0,0,0,.28);
      transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, background .2s ease;
    }

    .level-node:hover:not(:disabled) {
      transform: translate(-50%, -50%) scale(1.08);
    }

    .level-node:disabled {
      cursor: not-allowed;
      opacity: .55;
    }

    .level-node.unlocked {
      border-color: rgba(105,229,224,.62);
      color: var(--ink);
      background: radial-gradient(circle at 38% 30%, rgba(105,229,224,.22), #0b2730 66%);
      box-shadow: 0 0 0 7px rgba(105,229,224,.05), 0 14px 28px rgba(0,0,0,.3);
    }

    .level-node.current {
      border-color: var(--gold);
      box-shadow: 0 0 0 8px rgba(255,209,102,.08), 0 0 24px rgba(255,209,102,.25);
      animation: pulse 2s ease-in-out infinite;
    }

    .level-node.completed {
      color: #082016;
      border-color: var(--lime);
      background: linear-gradient(145deg, var(--lime), #76dca9);
      box-shadow: 0 0 0 6px rgba(181,239,122,.08), 0 0 20px rgba(181,239,122,.18);
    }

    .level-node.review::after {
      content: "复习";
      position: absolute;
      top: -10px;
      right: -13px;
      padding: 3px 6px;
      border-radius: 999px;
      font-size: 10px;
      color: #361020;
      background: var(--pink);
      border: 2px solid #0a2028;
    }

    .level-node.boss {
      width: 82px;
      height: 82px;
      border-radius: 24px;
    }

    .node-number {
      font-size: 18px;
      font-weight: 800;
    }

    .node-lock {
      width: 18px;
      height: 18px;
      opacity: .65;
    }

    .node-label {
      position: absolute;
      top: calc(100% + 8px);
      left: 50%;
      transform: translateX(-50%);
      width: 112px;
      color: var(--ink);
      font-size: 12px;
      line-height: 1.25;
      text-align: center;
      text-shadow: 0 2px 8px #031016;
      pointer-events: none;
    }

    .node-stars {
      position: absolute;
      bottom: calc(100% + 5px);
      left: 50%;
      transform: translateX(-50%);
      white-space: nowrap;
      color: var(--gold);
      font-size: 12px;
      letter-spacing: 1px;
    }

    @keyframes pulse {
      0%, 100% { box-shadow: 0 0 0 7px rgba(255,209,102,.07), 0 0 20px rgba(255,209,102,.22); }
      50% { box-shadow: 0 0 0 12px rgba(255,209,102,.025), 0 0 32px rgba(255,209,102,.36); }
    }

    .node-icon {
      font-size: 25px;
      line-height: 1;
      filter: drop-shadow(0 4px 5px rgba(0,0,0,.35));
    }

    .node-number {
      position: absolute;
      top: -5px;
      left: -5px;
      min-width: 23px;
      height: 23px;
      padding: 0 5px;
      display: grid;
      place-items: center;
      border: 2px solid #09212a;
      border-radius: 999px;
      color: #06201f;
      background: var(--cyan);
      font-size: 11px;
      font-weight: 900;
      box-shadow: 0 4px 9px rgba(0,0,0,.28);
    }

    .level-node:disabled .node-icon {
      filter: grayscale(1) opacity(.35);
    }

    .level-node.completed .node-number {
      color: #17320a;
      background: #f2ffdf;
    }

    .mission {
      min-height: 720px;
      display: flex;
      flex-direction: column;
    }

    .mission-top {
      padding: 22px 22px 18px;
      border-bottom: 1px solid var(--line);
      background: linear-gradient(180deg, rgba(105,229,224,.05), transparent);
    }

    .mission-meta {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      align-items: center;
      margin-bottom: 12px;
    }

    .tag {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      min-height: 26px;
      padding: 4px 9px;
      border: 1px solid rgba(105,229,224,.2);
      border-radius: 999px;
      color: var(--cyan);
      background: rgba(105,229,224,.06);
      font-size: 12px;
    }

    .difficulty {
      color: var(--gold);
      font-size: 12px;
      letter-spacing: 2px;
    }

    .mission h2 {
      font-size: 25px;
      line-height: 1.2;
      margin: 0 0 8px;
      letter-spacing: -.02em;
    }

    .story {
      color: var(--muted);
      line-height: 1.7;
      margin: 0;
      font-size: 14px;
    }

    .mission-body {
      padding: 20px 22px;
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 16px;
    }

    .mission-scene {
      position: relative;
      min-height: 94px;
      display: grid;
      grid-template-columns: 72px 1fr;
      align-items: center;
      gap: 14px;
      overflow: hidden;
      border: 1px solid rgba(105,229,224,.15);
      border-radius: 17px;
      padding: 13px 15px;
      background:
        radial-gradient(circle at 10% 50%, rgba(105,229,224,.16), transparent 29%),
        linear-gradient(110deg, rgba(105,229,224,.05), rgba(181,239,122,.035));
    }

    .mission-scene::after {
      content: "";
      position: absolute;
      width: 140px;
      height: 140px;
      right: -52px;
      top: -60px;
      border: 1px solid rgba(105,229,224,.08);
      border-radius: 50%;
      box-shadow: 0 0 0 24px rgba(105,229,224,.025), 0 0 0 48px rgba(105,229,224,.015);
    }

    .scene-icon {
      width: 64px;
      height: 64px;
      display: grid;
      place-items: center;
      border: 1px solid rgba(255,255,255,.12);
      border-radius: 20px;
      font-size: 34px;
      background: rgba(3,18,23,.52);
      box-shadow: inset 0 0 22px rgba(105,229,224,.08);
      animation: sceneFloat 3.6s ease-in-out infinite;
    }

    @keyframes sceneFloat {
      0%, 100% { transform: translateY(0) rotate(-2deg); }
      50% { transform: translateY(-5px) rotate(2deg); }
    }

    .scene-copy { position: relative; z-index: 1; }
    .scene-copy b { display: block; margin-bottom: 5px; color: var(--lime); font-size: 13px; }
    .scene-copy span { color: var(--muted); font-size: 12px; line-height: 1.55; }

    .quest-steps {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 7px;
    }

    .quest-step {
      position: relative;
      min-height: 34px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      border: 1px solid var(--line);
      border-radius: 10px;
      color: #7895a0;
      background: rgba(255,255,255,.018);
      font-size: 11px;
      transition: border-color .2s ease, color .2s ease, background .2s ease;
    }

    .quest-step::before {
      content: attr(data-step);
      width: 17px;
      height: 17px;
      display: grid;
      place-items: center;
      border-radius: 50%;
      color: #06201f;
      background: #55717b;
      font-size: 9px;
      font-weight: 900;
    }

    .quest-step.active,
    .quest-step.done {
      color: var(--ink);
      border-color: rgba(105,229,224,.28);
      background: rgba(105,229,224,.055);
    }

    .quest-step.active::before { background: var(--gold); }
    .quest-step.done::before { content: "✓"; background: var(--lime); }

    .welcome-grade-label {
      display: block;
      margin: 18px 0 8px;
      color: var(--ink);
      font-weight: 700;
    }

    .welcome-grade-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 8px;
    }

    .welcome-grade-choice {
      min-width: 0;
      padding: 11px 12px;
      border: 1px solid var(--line);
      border-radius: 13px;
      color: var(--ink);
      background: rgba(255,255,255,.025);
      text-align: left;
      cursor: pointer;
      transition: border-color .2s ease, background .2s ease, transform .2s ease;
    }

    .welcome-grade-choice:hover { transform: translateY(-1px); }

    .welcome-grade-choice.selected {
      border-color: var(--cyan);
      background: rgba(105,229,224,.1);
      box-shadow: inset 0 0 18px rgba(105,229,224,.05);
    }

    .welcome-grade-choice strong {
      display: block;
      margin-bottom: 3px;
      font-size: 14px;
    }

    .welcome-grade-choice small {
      display: block;
      color: var(--muted);
      font-size: 11px;
      line-height: 1.45;
    }

    .objective {
      color: var(--ink);
      line-height: 1.65;
      font-weight: 600;
    }

    .code-wrap {
      position: relative;
      border: 1px solid rgba(105,229,224,.16);
      border-radius: 16px;
      overflow: hidden;
      background: #041117;
    }

    .code-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 9px 12px;
      color: var(--muted);
      font-size: 11px;
      border-bottom: 1px solid rgba(105,229,224,.1);
      background: rgba(105,229,224,.035);
    }

    .window-dots { display: flex; gap: 5px; }
    .window-dots span {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: rgba(159,181,198,.28);
    }
    .window-dots span:nth-child(2) { background: rgba(255,209,102,.5); }
    .window-dots span:nth-child(3) { background: rgba(105,229,224,.5); }

    pre {
      margin: 0;
      padding: 14px 0;
      overflow-x: auto;
      font: 13px/1.7 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
      color: #d9f5f2;
    }

    .code-line {
      display: block;
      padding: 0 14px;
      white-space: pre;
      border-left: 3px solid transparent;
      transition: background .18s ease, border-color .18s ease;
    }

    .code-line.active {
      background: rgba(105,229,224,.1);
      border-left-color: var(--cyan);
    }

    .line-no {
      display: inline-block;
      width: 26px;
      margin-right: 10px;
      color: #486874;
      user-select: none;
      text-align: right;
    }

    .trace-box {
      display: none;
      border: 1px solid rgba(181,239,122,.15);
      border-radius: 14px;
      padding: 12px;
      background: rgba(181,239,122,.035);
    }

    .trace-box.show { display: block; }

    .trace-grid {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin: 10px 0;
    }

    .var-chip {
      padding: 7px 9px;
      border-radius: 9px;
      color: #dfffc1;
      background: rgba(181,239,122,.08);
      border: 1px solid rgba(181,239,122,.13);
      font: 12px "SFMono-Regular", Consolas, monospace;
    }

    .trace-output {
      color: var(--cyan);
      font: 12px "SFMono-Regular", Consolas, monospace;
      min-height: 18px;
    }

    .trace-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .answers {
      display: grid;
      gap: 9px;
    }

    .answer-kicker {
      color: var(--cyan);
      font-size: 11px;
      letter-spacing: .08em;
      text-transform: uppercase;
      margin-bottom: 2px;
    }

    .repair-console,
    .pattern-preview {
      border: 1px dashed rgba(255,209,102,.28);
      border-radius: 14px;
      padding: 12px;
      background: rgba(255,209,102,.035);
    }

    .repair-slot {
      min-height: 38px;
      display: flex;
      align-items: center;
      margin-top: 8px;
      padding: 8px 11px;
      border-radius: 9px;
      color: var(--gold);
      background: #06151b;
      font: 12px/1.5 "SFMono-Regular", Consolas, monospace;
    }

    .pattern-preview pre {
      min-height: 78px;
      padding: 9px 12px;
      border-radius: 9px;
      color: var(--lime);
      background: #06151b;
      text-align: center;
      font-size: 15px;
    }

    .option {
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 12px 14px;
      background: rgba(255,255,255,.025);
      color: var(--ink);
      text-align: left;
      cursor: pointer;
      line-height: 1.45;
      transition: transform .15s ease, border-color .15s ease, background .15s ease;
    }

    .option:hover:not(:disabled) {
      transform: translateX(3px);
      border-color: rgba(105,229,224,.4);
      background: rgba(105,229,224,.055);
    }

    .option.selected {
      border-color: var(--cyan);
      background: rgba(105,229,224,.1);
    }

    .option.correct {
      border-color: var(--lime);
      background: rgba(181,239,122,.11);
    }

    .option.wrong {
      border-color: var(--danger);
      background: rgba(255,125,136,.1);
    }

    .answer-input {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 13px 14px;
      background: rgba(255,255,255,.035);
      color: var(--ink);
    }

    .boss-phase {
      border-top: 1px solid var(--line);
      padding-top: 13px;
    }

    .boss-phase:first-child {
      border-top: 0;
      padding-top: 0;
    }

    .boss-phase-title {
      color: var(--gold);
      font-size: 12px;
      margin-bottom: 8px;
    }

    .feedback {
      display: none;
      border-radius: 14px;
      padding: 13px 14px;
      line-height: 1.65;
      font-size: 14px;
    }

    .feedback.show { display: block; }
    .feedback.success {
      color: #e5ffd0;
      border: 1px solid rgba(181,239,122,.22);
      background: rgba(181,239,122,.08);
    }
    .feedback.error {
      color: #ffdce0;
      border: 1px solid rgba(255,125,136,.22);
      background: rgba(255,125,136,.07);
    }
    .feedback.hint {
      color: #fff0c6;
      border: 1px solid rgba(255,209,102,.2);
      background: rgba(255,209,102,.07);
    }

    .reward-line {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin: 10px 0 2px;
    }

    .reward-chip {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 5px 8px;
      border-radius: 999px;
      color: #09201f;
      background: var(--lime);
      font-size: 11px;
      font-weight: 800;
      animation: rewardPop .35s cubic-bezier(.2,.9,.3,1.4) both;
    }

    .reward-chip:nth-child(2) { color: #302200; background: var(--gold); animation-delay: .08s; }

    @keyframes rewardPop {
      from { transform: scale(.65); opacity: 0; }
      to { transform: scale(1); opacity: 1; }
    }

    .option.correct-hint {
      border-color: var(--lime);
      background: rgba(181,239,122,.07);
      box-shadow: inset 0 0 0 1px rgba(181,239,122,.35);
    }

    .option-pattern {
      text-align: center;
      padding: 10px 12px;
    }

    .option-pattern pre {
      margin: 0;
      color: var(--lime);
      font: 14px/1.35 "SFMono-Regular", Consolas, monospace;
      white-space: pre;
    }

    .trace-scrub {
      margin: 6px 0 10px;
    }

    .trace-scrub input[type="range"] {
      width: 100%;
      accent-color: var(--cyan);
      cursor: pointer;
    }

    .code-line.repair-active {
      background: rgba(105,229,224,.1);
      border-left-color: var(--cyan);
      box-shadow: inset 0 0 14px rgba(105,229,224,.06);
    }

    .repair-slot.filled {
      border: 1px solid rgba(105,229,224,.45);
      color: var(--cyan);
      box-shadow: inset 0 0 14px rgba(105,229,224,.05);
    }

    .challenge-row {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 11px 0;
      border-bottom: 1px solid var(--line);
    }

    .challenge-row:last-child { border-bottom: 0; }

    .challenge-icon { font-size: 24px; }

    .challenge-meta { flex: 1; min-width: 0; }

    .challenge-meta b { display: block; font-size: 14px; }

    .challenge-meta span { color: var(--muted); font-size: 12px; }

    .challenge-status { font-size: 11px; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }

    .challenge-status.done { color: #09201f; background: var(--lime); font-weight: 800; }

    .challenge-status.todo { color: var(--cyan); border: 1px solid rgba(105,229,224,.35); }

    .world-tabs {
      position: absolute;
      left: 50%;
      top: 16px;
      transform: translateX(-50%);
      display: flex;
      gap: 6px;
      z-index: 4;
    }

    .world-tab {
      padding: 7px 14px;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: rgba(9, 29, 37, .9);
      color: var(--muted);
      font-size: 12px;
      cursor: pointer;
      transition: all .18s ease;
    }

    .world-tab.active {
      color: #06131b;
      border-color: var(--cyan);
      background: linear-gradient(145deg, var(--cyan), var(--lime));
      font-weight: 800;
    }

    .world-tab.locked {
      opacity: .55;
      cursor: not-allowed;
    }

    .world-tab .lock-icon { margin-right: 4px; }

    .grade-panel {
      max-width: 1240px;
      margin: 0 auto 18px;
      padding: 0 24px;
    }

    .grade-panel-inner {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 12px 14px;
      border: 1px solid var(--line);
      border-radius: 16px;
      background: rgba(9, 29, 37, .72);
    }

    .grade-panel-copy { min-width: 150px; }
    .grade-panel-copy strong { display: block; font-size: 13px; }
    .grade-panel-copy span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }

    .grade-tabs { display: flex; flex-wrap: wrap; gap: 7px; }

    .grade-tab {
      padding: 7px 12px;
      border: 1px solid var(--line);
      border-radius: 999px;
      background: rgba(9, 29, 37, .9);
      color: var(--muted);
      cursor: pointer;
      font-size: 12px;
      transition: all .18s ease;
    }

    .grade-tab:hover { border-color: rgba(105,229,224,.6); color: var(--ink); }
    .grade-tab.active { color: #06131b; border-color: var(--cyan); background: linear-gradient(145deg, var(--cyan), var(--lime)); font-weight: 800; }
    .grade-tab .grade-progress { opacity: .78; font-size: 10px; margin-left: 4px; }

    .grade-description { margin-left: auto; color: var(--muted); font-size: 11px; text-align: right; max-width: 360px; }

    .theory-box {
      display: none;
      border: 1px solid rgba(255,209,102,.22);
      border-radius: 14px;
      padding: 12px 14px;
      margin-top: 10px;
      background: rgba(255,209,102,.04);
      font-size: 13px;
      line-height: 1.7;
    }

    .theory-box.show { display: block; }

    .theory-box code {
      display: block;
      margin: 7px 0;
      padding: 9px 11px;
      border-radius: 9px;
      color: var(--lime);
      background: #06151b;
      font: 12px/1.6 "SFMono-Regular", Consolas, monospace;
      white-space: pre;
    }

    .terminal {
      display: none;
      margin-top: 10px;
      border: 1px solid rgba(105,229,224,.2);
      border-radius: 12px;
      overflow: hidden;
      background: #040d12;
    }

    .terminal.show { display: block; }

    .terminal-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 6px 11px;
      font-size: 11px;
      color: var(--muted);
      border-bottom: 1px solid var(--line);
    }

    .terminal-output {
      min-height: 52px;
      padding: 9px 12px;
      color: #d9f5f2;
      font: 12px/1.7 "SFMono-Regular", Consolas, monospace;
      white-space: pre-wrap;
    }

    .terminal-output.err { color: var(--danger); }

    .practice-badge {
      display: inline-block;
      margin-left: 8px;
      padding: 2px 8px;
      border-radius: 999px;
      font-size: 10px;
      color: #302200;
      background: var(--gold);
      font-weight: 800;
      vertical-align: middle;
    }

    .input-answer {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 13px 14px;
      background: rgba(255,255,255,.035);
      color: var(--ink);
      font: 15px "SFMono-Regular", Consolas, monospace;
    }

    .input-answer:focus {
      outline: none;
      border-color: var(--cyan);
      box-shadow: 0 0 0 3px rgba(105,229,224,.12);
    }

    .achievement-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 9px;
      margin-top: 10px;
    }

    .achievement {
      border: 1px solid var(--line);
      border-radius: 13px;
      padding: 10px;
      background: rgba(255,255,255,.025);
    }

    .achievement .ach-icon { font-size: 22px; }
    .achievement b { display: block; font-size: 12px; margin-top: 4px; }
    .achievement span { color: var(--muted); font-size: 10px; line-height: 1.4; display: block; }
    .achievement.locked { opacity: .42; filter: grayscale(1); }

    .partner-stage {
      display: inline-block;
      margin-left: 6px;
      padding: 2px 8px;
      border-radius: 999px;
      font-size: 10px;
      font-weight: 800;
      color: #06131b;
      background: linear-gradient(135deg, #9be8ff, var(--cyan));
      vertical-align: middle;
    }

    .partner-stage.st2 { background: linear-gradient(135deg, var(--lime), var(--cyan)); }
    .partner-stage.st3 { background: linear-gradient(135deg, var(--gold), var(--pink)); }
    .partner-stage.st4 {
      color: #2d2304;
      background: radial-gradient(circle at 30% 25%, #fff7cc, var(--gold) 55%, #ca9238);
    }

    .companion.glow1 { text-shadow: 0 0 10px rgba(105,229,224,.65); }
    .companion.glow2 { text-shadow: 0 0 12px rgba(255,209,102,.8); }
    .companion.glow3 {
      text-shadow: 0 0 14px rgba(255,209,102,1), 0 0 26px rgba(255,143,199,.7);
      animation: glowPulse 2.4s ease-in-out infinite;
    }

    @keyframes glowPulse {
      0%, 100% { filter: drop-shadow(0 0 4px rgba(255,209,102,.5)); }
      50% { filter: drop-shadow(0 0 12px rgba(255,209,102,.95)); }
    }

    .cal-strip {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 7px;
      margin: 12px 0;
    }

    .cal-day {
      text-align: center;
      border: 1px solid var(--line);
      border-radius: 11px;
      padding: 8px 2px;
      font-size: 10px;
      color: var(--muted);
    }

    .cal-day .dot {
      display: block;
      width: 10px;
      height: 10px;
      margin: 5px auto 0;
      border-radius: 50%;
      background: rgba(255,255,255,.08);
    }

    .cal-day.hit { border-color: rgba(181,239,122,.4); }
    .cal-day.hit .dot { background: var(--lime); box-shadow: 0 0 8px rgba(181,239,122,.5); }
    .cal-day.today { border-color: var(--cyan); }

    .radar-wrap {
      margin: 12px 0;
      display: grid;
      place-items: center;
    }

    .radar-wrap svg { width: 100%; max-width: 260px; height: auto; }

    .skill-label { font-size: 10px; fill: var(--muted); }

    .practice-tip {
      color: var(--gold);
      font-size: 11px;
      margin-top: 8px;
    }

    .mission-actions {
      display: flex;
      gap: 9px;
      flex-wrap: wrap;
      margin-top: auto;
      padding-top: 4px;
    }

    .mission-actions .btn-primary {
      flex: 1;
      min-width: 150px;
    }

    .empty-state {
      flex: 1;
      display: grid;
      place-items: center;
      text-align: center;
      padding: 34px;
    }

    .empty-orb {
      width: 88px;
      height: 88px;
      margin: 0 auto 20px;
      border-radius: 50%;
      display: grid;
      place-items: center;
      background: radial-gradient(circle at 34% 28%, #efffff, var(--cyan) 22%, #177c77 65%, #092b32 66%);
      box-shadow: 0 0 44px rgba(105,229,224,.26);
      font-size: 38px;
    }

    .empty-state h2 { margin: 0 0 10px; }
    .empty-state p {
      color: var(--muted);
      line-height: 1.7;
      max-width: 330px;
      margin: 0 auto 20px;
    }

    .modal {
      position: fixed;
      inset: 0;
      z-index: 30;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 20px;
      background: rgba(2,9,13,.78);
      backdrop-filter: blur(14px);
    }

    .modal.show { display: flex; }

    body.modal-open { overflow: hidden; }

    .modal-panel {
      width: min(560px, 100%);
      max-height: calc(100vh - 40px);
      overflow-y: auto;
      border: 1px solid rgba(105,229,224,.22);
      border-radius: 28px;
      padding: 28px;
      background:
        radial-gradient(circle at 12% 0%, rgba(105,229,224,.14), transparent 32%),
        #091e27;
      box-shadow: 0 40px 120px rgba(0,0,0,.5);
    }

    .modal-panel h2 {
      margin: 0 0 10px;
      font-size: 28px;
    }

    .modal-panel p {
      color: var(--muted);
      line-height: 1.7;
    }

    .name-input {
      width: 100%;
      margin: 14px 0;
      padding: 13px 14px;
      border: 1px solid var(--line);
      border-radius: 13px;
      background: rgba(255,255,255,.045);
      color: var(--ink);
    }

    .companions {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 10px;
      margin: 14px 0 22px;
    }

    .companion-choice {
      border: 1px solid var(--line);
      border-radius: 16px;
      padding: 15px 8px;
      background: rgba(255,255,255,.025);
      color: var(--ink);
      cursor: pointer;
      text-align: center;
    }

    .companion-choice.selected {
      border-color: var(--cyan);
      background: rgba(105,229,224,.09);
    }

    .companion-choice span {
      display: block;
      font-size: 30px;
      margin-bottom: 6px;
    }

    .summary-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 10px;
      margin: 18px 0;
    }

    .summary-stat {
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 13px;
      background: rgba(255,255,255,.025);
    }

    .summary-stat b {
      display: block;
      font-size: 24px;
      color: var(--cyan);
      margin-bottom: 3px;
    }

    .skill-row {
      display: grid;
      grid-template-columns: 90px 1fr 40px;
      gap: 10px;
      align-items: center;
      margin: 11px 0;
      font-size: 13px;
    }

    .skill-bar {
      height: 7px;
      border-radius: 999px;
      background: rgba(255,255,255,.06);
      overflow: hidden;
    }

    .skill-bar span {
      display: block;
      height: 100%;
      border-radius: inherit;
      background: linear-gradient(90deg, var(--cyan), var(--lime));
    }

    .victory {
      text-align: center;
    }

    .victory-seal {
      width: 116px;
      height: 116px;
      border-radius: 32px;
      margin: 0 auto 18px;
      display: grid;
      place-items: center;
      font-size: 48px;
      color: #2d2304;
      background: radial-gradient(circle at 35% 28%, #fff7cc, var(--gold) 38%, #ca9238 75%);
      box-shadow: 0 0 60px rgba(255,209,102,.28);
      transform: rotate(-4deg);
    }

    .confetti {
      position: fixed;
      width: 8px;
      height: 14px;
      top: -20px;
      z-index: 50;
      pointer-events: none;
      animation: fall 2.4s linear forwards;
    }

    @keyframes fall {
      to { transform: translate3d(var(--drift), 105vh, 0) rotate(720deg); opacity: .8; }
    }

    .footer-note {
      color: #6e8995;
      font-size: 11px;
      text-align: center;
      margin-top: 16px;
      line-height: 1.6;
      position: relative;
      z-index: 2;
    }

    @media (max-width: 1050px) {
      .layout {
        grid-template-columns: 1fr;
      }
      .mission { min-height: 600px; }
      .hud { grid-template-columns: 1.4fr repeat(3, .6fr); }
    }

    @media (max-width: 720px) {
      .app {
        width: min(100% - 20px, 1480px);
        padding-top: 14px;
      }
      .topbar {
        align-items: flex-start;
        flex-direction: column;
      }
      .top-actions { width: 100%; justify-content: flex-start; }
      .top-actions > .btn { flex: 1; justify-content: center; white-space: nowrap; }
      .more-menu { flex: 1; }
      .more-menu > summary { width: 100%; text-align: center; }
      .more-menu-panel { left: 0; right: auto; width: min(260px, calc(100vw - 20px)); }
      .hud {
        grid-template-columns: 1fr 1fr;
      }
      .player-card { grid-column: 1 / -1; }
      .world, .map { min-height: 480px; height: 480px; }
      .grade-panel { padding: 0 14px; }
      .grade-panel-inner { align-items: flex-start; flex-direction: column; }
      .grade-description { margin-left: 0; max-width: none; text-align: left; }
      .world-header { top: 17px; left: 17px; right: 17px; }
      .world-tip { display: none; }
      .route { inset: 78px 8px 18px; width: calc(100% - 16px); height: calc(100% - 96px); }
      .level-node { width: 52px; height: 52px; }
      .level-node.boss { width: 66px; height: 66px; border-radius: 20px; }
      .node-number { font-size: 15px; }
      .node-icon { font-size: 20px; }
      .node-number { min-width: 19px; height: 19px; font-size: 9px; }
      .node-label { width: 70px; font-size: 9px; line-height: 1.25; }
      .journey-avatar { width: 34px; height: 34px; font-size: 18px; }
      .journey-avatar::after { display: none; }
      .mission-top, .mission-body { padding-left: 17px; padding-right: 17px; }
      .mission-scene { grid-template-columns: 56px 1fr; }
      .scene-icon { width: 52px; height: 52px; font-size: 28px; border-radius: 16px; }
      .companions, .summary-grid, .welcome-grade-grid { grid-template-columns: 1fr; }
      .modal-panel { padding: 22px; border-radius: 22px; }
      .mission-actions {
        position: sticky;
        bottom: 8px;
        z-index: 8;
        padding: 8px;
        margin: 0 -8px -8px;
        border: 1px solid var(--line);
        border-radius: 14px;
        background: rgba(6, 19, 27, .96);
        box-shadow: 0 -10px 28px rgba(0, 0, 0, .28);
        backdrop-filter: blur(14px);
      }
      .mission-actions .btn { padding: 9px 10px; font-size: 12px; }
      .mission-actions .btn-primary { flex: 1 0 100%; order: -1; margin-left: 0; text-align: center; }
    }

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

/* P1: Companion dialogue bubble */
.companion-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border: 1px solid rgba(105, 229, 224, 0.3);
  border-radius: 18px 18px 4px 18px;
  background: rgba(9, 29, 37, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(105, 229, 224, 0.1);
  font-size: 14px;
  color: var(--ink);
  max-width: 320px;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.4s ease;
  pointer-events: none;
}

.companion-bubble.show {
  transform: translateY(0);
  opacity: 1;
}

.companion-bubble-icon {
  font-size: 28px;
  flex-shrink: 0;
  animation: bubbleBounce 0.5s ease-in-out;
}

.companion-bubble-text {
  line-height: 1.5;
}

@keyframes bubbleBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

@media (max-width: 640px) {
  .companion-bubble {
    bottom: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
  }
}
