/* Welcome */
  #welcome { text-align: center; color: white; }
  #welcome h1 { font-size: 3em; margin-bottom: 10px; text-shadow: 3px 3px 6px rgba(0,0,0,0.3); animation: bounce 2s infinite; }
  #welcome .subtitle { font-size: 1.3em; margin-bottom: 40px; opacity: 0.9; }
  @keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-15px)} }
  .start-btn {
    font-size: 1.5em; padding: 18px 60px; border: none; border-radius: 50px;
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white; cursor: pointer; box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    transition: all 0.3s; font-family: inherit;
  }
  .start-btn:hover { transform: scale(1.08); }
  .welcome-chars { font-size: 4em; margin: 30px 0; display: flex; justify-content: center; align-items: center; gap: 60px; }
  .face-right { display: inline-block; transform: scaleX(-1); }
  .home-link {
    margin-top: 16px; padding: 8px 20px; border: 1px solid rgba(255,255,255,0.5);
    border-radius: 999px; background: rgba(255,255,255,0.16); color: white;
    cursor: pointer; font-family: inherit; font-size: 0.95em;
  }
  .home-link:hover { background: rgba(255,255,255,0.25); }
  .core-card, .review-card {
    width: 100%; max-width: 620px; padding: 22px;
    background: rgba(255,255,255,0.92); color: #333;
    border-radius: 16px; box-shadow: 0 8px 28px rgba(0,0,0,0.24);
    text-align: left;
  }
  .core-card h2, .review-card h2 { text-align: center; color: #4b5fd5; margin-bottom: 14px; }
  .core-list { display: grid; gap: 10px; font-size: 1.25em; line-height: 1.6; font-weight: bold; }
  .core-line {
    padding: 12px 14px; border-radius: 12px;
    background: #f0f4ff; border-left: 4px solid #667eea;
    display: flex; align-items: center; gap: 12px; cursor: pointer;
    opacity: 0; transform: translateY(12px);
    transition: opacity 0.4s ease, transform 0.4s ease, background 0.3s, border-color 0.3s;
    pointer-events: none;
  }
  .core-line.visible {
    opacity: 1; transform: translateY(0); pointer-events: auto;
  }
  .core-line.checked {
    background: #e8f5e9; border-left-color: #43a047;
  }
  .core-line .core-text { flex: 1; }
  .core-check {
    width: 28px; height: 28px; min-width: 28px; border-radius: 8px;
    border: 2.5px solid #b0bec5; background: white; cursor: pointer;
    display: grid; place-items: center; transition: all 0.25s;
    font-size: 0; color: transparent;
  }
  .core-check:hover { border-color: #667eea; background: #f0f4ff; }
  .core-check.done {
    border-color: #43a047; background: #43a047; color: white;
    font-size: 16px; animation: checkPop 0.3s ease;
  }
  @keyframes checkPop {
    0% { transform: scale(0.6); } 50% { transform: scale(1.2); } 100% { transform: scale(1); }
  }
  .start-btn:disabled {
    opacity: 0.4; pointer-events: none; filter: grayscale(0.6);
  }
  .review-question { font-size: 1.25em; font-weight: bold; text-align: center; margin-bottom: 14px; }
  .review-feedback { margin-top: 12px; padding: 10px 14px; border-radius: 10px; font-weight: bold; display: none; text-align: center; }
  .review-feedback.correct { display: block; background: #e8f5e9; color: #2e7d32; }
  .review-feedback.wrong { display: block; background: #ffebee; color: #c62828; }
  .point-pill {
    display: inline-block; margin-left: 8px; padding: 3px 9px; border-radius: 999px;
    background: #fff3cd; color: #b26a00; font-size: 0.78em; font-weight: bold;
    vertical-align: middle;
  }

  /* Meet Game - New Design */
  .meet-subtitle { font-size: 1em; color: #555; text-align: center; margin-bottom: 8px; font-weight: bold; }
  .gap-indicator {
    display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    font-size: 0.8em; font-weight: bold; color: #c2185b; background: #fce4ec;
    padding: 2px 10px; border-radius: 10px; border: 1px solid #f48fb1; z-index: 4;
  }
  .time-counter { text-align: center; margin-top: 8px; font-size: 1.1em; font-weight: bold; color: #667eea; }
  .control-panel {
    width: 100%; max-width: 800px; flex: 1; min-height: 0;
    background: rgba(255,255,255,0.95); border-radius: 16px; padding: 16px 20px;
    box-shadow: 0 6px 30px rgba(0,0,0,0.2); overflow-y: auto;
  }
  .slider-group { margin: 10px 0; }
  .slider-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font-weight: bold; color: #444; }
  .slider-value { color: #667eea; font-size: 1.1em; }
  .speed-slider { width: 100%; height: 8px; border-radius: 4px; outline: none; -webkit-appearance: none; appearance: none; background: linear-gradient(90deg,#e0e5ff,#667eea); }
  .speed-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: #667eea; border: 3px solid white; box-shadow: 0 2px 8px rgba(0,0,0,0.2); cursor: pointer; }
  .speed-sum-display { text-align: center; margin: 8px 0; padding: 8px; background: #f0f4ff; border-radius: 10px; font-weight: bold; color: #667eea; font-size: 1.05em; border: 2px solid #d7defc; }
  .predict-choices { display: flex; gap: 12px; justify-content: center; margin: 12px 0; }
  .predict-btn { min-width: 90px; padding: 14px 20px; border: 2px solid #d7defc; border-radius: 14px; background: white; color: #4b5fd5; font-size: 1.3em; font-weight: bold; cursor: pointer; font-family: inherit; transition: all 0.2s; }
  .predict-btn:hover { border-color: #667eea; background: #f0f4ff; transform: translateY(-2px); }
  .predict-btn.ok { border-color: #4caf50; background: #e8f5e9; color: #2e7d32; }
  .predict-btn.err { border-color: #f44336; background: #ffebee; color: #c62828; }
  .compare-label { display: inline-block; padding: 3px 10px; border-radius: 8px; font-size: 0.85em; font-weight: bold; }
  .compare-label-a { background: #e3f2fd; color: #1565c0; }
  .compare-label-b { background: #fce4ec; color: #c2185b; }
  .console-row { display: flex; align-items: center; gap: 8px; justify-content: center; margin: 8px 0; flex-wrap: wrap; }
  .console-label { font-weight: bold; color: #555; min-width: 80px; text-align: right; }
  .console-input { width: 90px; padding: 8px; border: 2px solid #ddd; border-radius: 10px; text-align: center; font-size: 1.15em; font-family: inherit; }
  .console-input:focus { outline: none; border-color: #667eea; }
  .console-input.ok { border-color: #4caf50 !important; background: #e8f5e9; }
  .console-input.err { border-color: #f44336 !important; background: #ffebee; }
  .console-unit { color: #666; font-weight: bold; }
  .meet-feedback { text-align: center; margin-top: 10px; padding: 10px; border-radius: 10px; font-weight: bold; }
  .meet-feedback.success { background: #e8f5e9; color: #2e7d32; }
  .meet-feedback.miss { background: #fff3e0; color: #e65100; }
  .meet-feedback.overshoot { background: #fce4ec; color: #c2185b; }
  .round-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 8px; }
  .round-dot { width: 10px; height: 10px; border-radius: 50%; background: #ddd; }
  .round-dot.active { background: #667eea; transform: scale(1.2); }
  .round-dot.done { background: #4caf50; }
  .discovery { background: linear-gradient(135deg,#e8f5e9,#f1f8e9); border: 1px solid #81c784; border-radius: 10px; padding: 10px 14px; margin: 8px 0; font-size: 1em; color: #2e7d32; text-align: center; line-height: 1.6; }
  .challenge-text { font-size: 1.05em; color: #333; line-height: 1.7; padding: 10px 12px; background: #f0f4ff; border-radius: 10px; border-left: 4px solid #667eea; margin-bottom: 10px; }
  .road-b { margin-top: 5px; }

  /* Game */
  #game { justify-content: flex-start; padding: 10px 20px; overflow: hidden; }
  .top-bar {
    display: flex; justify-content: space-between; align-items: center;
    width: 100%; max-width: 800px; color: white; flex-shrink: 0; margin-bottom: 8px;
  }
  .level-badge { background: rgba(255,255,255,0.2); padding: 6px 16px; border-radius: 20px; font-size: 1em; font-weight: bold; backdrop-filter: blur(10px); }
  .stars-display { font-size: 1.2em; letter-spacing: 3px; }

  /* Road */
  .road-container {
    width: 100%; max-width: 800px; background: rgba(255,255,255,0.95);
    border-radius: 16px; padding: 14px 20px; box-shadow: 0 6px 30px rgba(0,0,0,0.2);
    flex-shrink: 0; margin-bottom: 10px;
  }
  .story-text { font-size: 1em; color: #333; line-height: 1.7; padding: 10px 12px; background: #f0f4ff; border-radius: 10px; border-left: 4px solid #667eea; margin-bottom: 10px; }
  .road { position: relative; height: 80px; margin: 5px 0; }
  .road-line { position: absolute; top: 50%; left: 30px; right: 30px; height: 4px; background: repeating-linear-gradient(90deg,#999 0,#999 15px,transparent 15px,transparent 25px); transform: translateY(-2px); }
  .road-label-left,.road-label-right { position: absolute; top: 65px; font-size: 0.8em; color: #666; font-weight: bold; }
  .road-label-left { left: 10px; } .road-label-right { right: 10px; }
  .road-distance { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); font-size: 0.9em; color: #667eea; font-weight: bold; background: white; padding: 2px 10px; border-radius: 10px; border: 2px solid #667eea; }
  .character { position: absolute; top: 50%; transform: translateY(-50%); font-size: 2.2em; transition: left 0.05s linear, right 0.05s linear; z-index: 2; }
  .char-left { left: 5px; } .char-right { right: 5px; }
  .char-emoji { display: inline-block; }
  .char-left .char-emoji { transform: scaleX(-1); }
  .char-name { position: absolute; font-size: 0.35em; white-space: nowrap; text-align: center; width: 80px; left: 50%; transform: translateX(-50%); bottom: -20px; color: #555; font-weight: bold; }
  .char-speed { position: absolute; font-size: 0.3em; white-space: nowrap; text-align: center; width: 120px; left: 50%; transform: translateX(-50%); top: -20px; color: #e74c3c; font-weight: bold; }
  .meet-effect { display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 2em; z-index: 3; animation: pop 0.5s ease-out; }
  @keyframes pop { 0%{transform:translate(-50%,-50%) scale(0);opacity:0} 50%{transform:translate(-50%,-50%) scale(1.3)} 100%{transform:translate(-50%,-50%) scale(1);opacity:1} }
  .info-cards { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }
  .info-card { background: #fff3e0; border: 2px solid #ffb74d; border-radius: 10px; padding: 5px 12px; font-size: 0.85em; font-weight: bold; color: #e65100; }
  .info-card.unknown { background: #fce4ec; border-color: #f48fb1; color: #c2185b; }

  /* Bottom Panel */
  .steps-container {
    width: 100%; max-width: 800px; flex: 1; min-height: 0;
    background: rgba(255,255,255,0.95); border-radius: 16px; padding: 16px 20px;
    box-shadow: 0 6px 30px rgba(0,0,0,0.2); display: flex; flex-direction: column; overflow: hidden;
  }
  .steps-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-shrink: 0; }
  .steps-title { font-size: 1.1em; color: #667eea; font-weight: bold; display: flex; align-items: center; gap: 6px; }
  .step-dots { display: flex; gap: 6px; align-items: center; }
  .step-dot { width: 12px; height: 12px; border-radius: 50%; background: #ddd; transition: all 0.3s; }
  .step-dot.active { background: #667eea; transform: scale(1.2); }
  .step-dot.done { background: #4caf50; }

  .step-card-area { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; overflow-y: auto; }

  /* Tip Card */
  .tip-card {
    padding: 20px; border-radius: 14px;
    background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
    border: 2px solid #66bb6a; text-align: center;
    animation: cardIn 0.4s ease-out;
  }
  .tip-title { font-size: 1.2em; font-weight: bold; color: #2e7d32; margin-bottom: 12px; }
  .tip-lines { text-align: left; margin: 0 auto; max-width: 400px; }
  .tip-lines p { font-size: 1.05em; color: #333; line-height: 1.8; margin: 4px 0; }
  .tip-btn {
    margin-top: 16px; padding: 10px 36px; border: none; border-radius: 25px;
    background: linear-gradient(135deg, #66bb6a, #43a047);
    color: white; font-size: 1.05em; cursor: pointer; font-family: inherit;
    box-shadow: 0 4px 15px rgba(76,175,80,0.4); transition: all 0.3s;
  }
  .tip-btn:hover { transform: scale(1.05); }

  /* Step Card */
  .step-card {
    padding: 18px; border-radius: 14px;
    background: #f8f9ff; border: 2px solid #667eea;
    animation: cardIn 0.35s ease-out;
  }
  @keyframes cardIn { from{opacity:0;transform:translateX(40px)} to{opacity:1;transform:translateX(0)} }
  .step-label { font-weight: bold; color: #444; margin-bottom: 14px; font-size: 1.05em; line-height: 1.5; }
  .step-label .step-num { display: inline-block; width: 28px; height: 28px; line-height: 28px; text-align: center; background: #667eea; color: white; border-radius: 50%; margin-right: 8px; font-size: 0.85em; }

  /* Input type */
  .step-input-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
  .step-card input[type="number"] {
    width: 100px; padding: 8px 10px; font-size: 1.15em;
    border: 2px solid #ddd; border-radius: 10px;
    text-align: center; font-family: inherit; transition: all 0.3s;
  }
  .step-card input[type="number"]:focus { outline: none; border-color: #667eea; }
  input.input-ok { border-color: #4caf50 !important; background: #e8f5e9; }
  input.input-err { border-color: #f44336 !important; background: #ffebee; }
  .step-card .unit { font-size: 1em; color: #666; }

  /* Formula type */
  .op-picker-row { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
  .op-picker-label { font-size: 0.95em; color: #555; font-weight: bold; }
  .op-btn {
    width: 40px; height: 40px; border: 2px solid #ddd; border-radius: 10px;
    background: white; font-size: 1.3em; cursor: pointer; font-weight: bold;
    color: #667eea; transition: all 0.2s; font-family: inherit;
  }
  .op-btn:hover { border-color: #667eea; background: #f0f2ff; }
  .op-btn.selected { border-color: #667eea; background: #e0e5ff; box-shadow: 0 2px 8px rgba(102,126,234,0.3); }
  .op-btn.op-ok { border-color: #4caf50 !important; background: #e8f5e9 !important; color: #2e7d32; }
  .op-btn.op-err { border-color: #f44336 !important; background: #ffebee !important; color: #c62828; }

  .formula-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; margin-bottom: 10px; }
  .formula-row input[type="number"] {
    width: 80px; padding: 8px 4px; font-size: 1.15em;
    border: 2px solid #ddd; border-radius: 10px;
    text-align: center; font-family: inherit; transition: all 0.3s;
  }
  .formula-row input:focus { outline: none; border-color: #667eea; }
  .formula-op { font-size: 1.4em; font-weight: bold; color: #667eea; min-width: 24px; text-align: center; }
  .formula-op-display { font-size: 1.4em; font-weight: bold; min-width: 30px; text-align: center; color: #aaa; border: 2px dashed #ddd; border-radius: 8px; padding: 2px 6px; transition: all 0.3s; }
  .formula-op-display.has-op { color: #667eea; border-color: #667eea; border-style: solid; }
  .formula-unit { font-size: 0.9em; color: #666; margin-left: 2px; }

  .check-btn {
    padding: 8px 24px; background: linear-gradient(135deg, #667eea, #764ba2);
    color: white; border: none; border-radius: 10px;
    font-size: 1em; cursor: pointer; font-family: inherit; transition: all 0.2s;
  }
  .check-btn:hover { transform: scale(1.05); }
  .check-btn:disabled { opacity: 0.5; cursor: default; transform: none; }

  .step-feedback { margin-top: 10px; padding: 10px 15px; border-radius: 8px; font-weight: bold; display: none; }
  .step-feedback.correct { display: block; background: #e8f5e9; color: #2e7d32; }
  .step-feedback.wrong { display: block; background: #ffebee; color: #c62828; }

  .hint-btn { margin-top: 12px; padding: 6px 16px; background: #fff3e0; border: 1px solid #ffb74d; border-radius: 8px; color: #e65100; font-size: 0.9em; cursor: pointer; font-family: inherit; }
  .hint-text { display: none; margin-top: 8px; padding: 10px; background: #fff8e1; border-radius: 8px; color: #f57f17; font-size: 0.95em; border: 1px dashed #ffb74d; }

  /* Robot Mission */
  .mission-panel {
    padding: 14px; border-radius: 14px; background: #f8f9ff;
    border: 2px solid #667eea; animation: cardIn 0.35s ease-out;
  }
  .mission-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px; margin-bottom: 10px;
  }
  .mission-title { font-size: 1.05em; font-weight: bold; color: #3949ab; }
  .mission-title .step-num { display: inline-block; width: 28px; height: 28px; line-height: 28px; text-align: center; background: #667eea; color: white; border-radius: 50%; margin-right: 8px; font-size: 0.85em; }
  .mission-action {
    min-width: 54px; height: 54px; display: grid; place-items: center;
    border-radius: 16px; background: #eef2ff; font-size: 2em;
    box-shadow: inset 0 0 0 2px #cbd5ff;
  }
  .mission-board {
    display: grid; grid-template-columns: 1fr 1.2fr; gap: 12px; align-items: center;
  }
  .mission-visual {
    min-height: 142px; border-radius: 14px; background: white;
    border: 2px dashed #cbd5ff; display: grid; place-items: center; padding: 12px;
  }
  .energy-meter {
    width: 100%; max-width: 230px; height: 18px; border: 2px solid #cbd5ff;
    border-radius: 999px; overflow: hidden; background: #eef2ff;
  }
  .energy-fill {
    width: 18%; height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, #66bb6a, #29b6f6);
    transition: width 0.35s ease;
  }
  .mission-visual.on .energy-fill { width: 100%; }
  .mission-visual.shake { animation: shake 0.4s; }
  .mission-big { font-size: 2.8em; line-height: 1; margin-bottom: 8px; }
  .mission-small { color: #555; font-weight: bold; text-align: center; line-height: 1.5; }
  .chip-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .mission-chip {
    min-height: 68px; border: 2px solid #d7defc; border-radius: 14px;
    background: white; color: #4b5fd5; font-size: 1.25em; font-weight: bold;
    cursor: pointer; font-family: inherit; transition: all 0.2s;
  }
  .mission-chip:hover { transform: translateY(-2px); border-color: #667eea; background: #f0f4ff; }
  .mission-chip small { font-size: 0.68em; color: #777; }
  .mission-chip.ok { border-color: #43a047; background: #e8f5e9; color: #2e7d32; }
  .mission-chip.err { border-color: #e53935; background: #ffebee; color: #c62828; }
  .robot-console {
    border-radius: 14px; background: white; border: 2px solid #d7defc;
    padding: 12px; text-align: center;
  }
  .mission-panel input[type="number"] {
    width: 100px; padding: 8px 10px; font-size: 1.15em;
    border: 2px solid #ddd; border-radius: 10px;
    text-align: center; font-family: inherit; transition: all 0.3s;
  }
  .mission-panel input[type="number"]:focus { outline: none; border-color: #667eea; }
  .mission-panel .unit { font-size: 1em; color: #666; }
  .launch-btn {
    margin-top: 6px; padding: 10px 28px; border: none; border-radius: 999px;
    background: linear-gradient(135deg, #ff7043, #f4511e); color: white;
    font-family: inherit; font-size: 1.05em; font-weight: bold; cursor: pointer;
    box-shadow: 0 5px 16px rgba(244,81,30,0.28);
  }
  .launch-btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; }

  /* Complete Card */
  .complete-card { text-align: center; animation: cardIn 0.5s ease-out; }
  .complete-card .congrats { font-size: 1.4em; color: #4caf50; font-weight: bold; margin-bottom: 5px; }
  .complete-card .earned-stars { font-size: 2em; margin: 6px 0; }
  .tip-reminder {
    background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
    border: 1px solid #81c784; border-radius: 10px;
    padding: 10px 14px; margin: 8px 0; font-size: 0.9em; color: #2e7d32;
    text-align: left; line-height: 1.6;
  }
  .tip-reminder b { color: #1b5e20; }
  .complete-card .solution-summary {
    background: #f0f4ff; border-radius: 12px; padding: 14px; margin: 8px 0;
    text-align: left; font-size: 0.95em; line-height: 1.8; color: #333;
    border-left: 4px solid #667eea;
  }
  .next-btn {
    padding: 14px 50px; background: linear-gradient(135deg, #4caf50, #45a049);
    color: white; border: none; border-radius: 30px; font-size: 1.2em;
    cursor: pointer; font-family: inherit;
    box-shadow: 0 5px 20px rgba(76,175,80,0.4); transition: all 0.3s;
  }
  .next-btn:hover { transform: scale(1.05); }

  /* Victory */
  #victory { text-align: center; color: white; overflow-y: auto; }
  #victory h1 { font-size: 2.8em; margin-bottom: 15px; animation: bounce 1.5s infinite; }
  #victory .trophy { font-size: 5em; margin: 20px 0; }
  #victory .final-stars { font-size: 2em; margin: 15px 0; }
  #victory .formula-card { background: rgba(255,255,255,0.9); border-radius: 15px; padding: 20px; max-width: 500px; margin: 20px auto; color: #333; text-align: left; }
  #victory .formula-card h3 { color: #667eea; margin-bottom: 10px; }
  #victory .formula-card p { margin: 8px 0; font-size: 1.1em; }
