*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f5f5f0;
    --card: #ffffff;
    --nav-bg: #1a2332;
    --nav-text: #e0e0e0;
    --text: #2c2c2c;
    --text-muted: #666;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --green: #16a34a;
    --green-bg: #f0fdf4;
    --green-border: #bbf7d0;
    --yellow: #ca8a04;
    --yellow-bg: #fefce8;
    --yellow-border: #fef08a;
    --border: #e5e5e5;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Nav */
nav {
    background: var(--nav-bg);
    color: var(--nav-text);
    padding: 0 1rem;
}
.nav-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.nav-brand {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}
.nav-links a {
    color: var(--nav-text);
    text-decoration: none;
    margin-left: 1.5rem;
    font-size: 0.95rem;
}
.nav-links a:hover { color: #fff; }

/* Main */
main {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
}

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 3rem;
}
.hero h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}
.subtitle {
    color: var(--text-muted);
    font-size: 1.15rem;
}

/* Formula overview */
.formula-overview {
    margin-bottom: 3rem;
}
.formula-overview h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}
.formula-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}
.formula-part {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1rem;
    text-align: center;
}
.formula-part .num {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    width: 28px;
    height: 28px;
    line-height: 28px;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.formula-part .example {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}
.formula-note {
    text-align: center;
    color: var(--text-muted);
    margin-top: 1rem;
    font-size: 0.95rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid var(--accent);
    color: var(--accent);
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
}
.btn:hover {
    background: var(--accent);
    color: #fff;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.cta-section {
    text-align: center;
    margin: 2rem 0;
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Tips */
.tips-section { margin-top: 3rem; }
.tips-section h2 { text-align: center; margin-bottom: 1.5rem; }
.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.tip-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.tip-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}
.tip-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Reference cards */
h1 { margin-bottom: 0.5rem; }
.page-intro {
    color: var(--text-muted);
    margin-bottom: 2rem;
}
.ref-section { margin-bottom: 3rem; }
.ref-section h2 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}
.ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 1rem;
}
.ref-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.ref-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}
.formula-template {
    background: #f0f4ff;
    border: 1px solid #c7d2fe;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: #3730a3;
}
.example-block {
    background: var(--green-bg);
    border: 1px solid var(--green-border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}
.context {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}
.mistakes {
    font-size: 0.85rem;
    color: var(--yellow);
    background: var(--yellow-bg);
    border: 1px solid var(--yellow-border);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
}

/* Scenario list */
.scenario-section { margin-bottom: 2.5rem; }
.scenario-section h2 { margin-bottom: 0.25rem; }
.section-desc { color: var(--text-muted); margin-bottom: 1rem; font-size: 0.95rem; }
.scenario-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}
.scenario-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.scenario-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(37,99,235,0.1);
}
.scenario-card h3 { font-size: 1rem; margin-bottom: 0.4rem; }
.scenario-card p { font-size: 0.85rem; color: var(--text-muted); }
.scenario-difficulty { margin-bottom: 0.5rem; }
.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    margin-right: 3px;
}
.dot.filled { background: var(--accent); }

/* Drill page */
.drill-page { max-width: 700px; margin: 0 auto; }
.drill-header { margin-bottom: 1.5rem; }
.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
}
.back-link:hover { color: var(--accent); }
.drill-header h1 { font-size: 1.5rem; margin-top: 0.25rem; }

.setup-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.setup-box h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.setup-box p { font-size: 0.95rem; }
.formula-hint {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--accent);
    background: #f0f4ff;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}

/* Conversation */
.conversation {
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.conv-prompt {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 0;
    font-style: italic;
}
.conv-msg {
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
}
.conv-pilot {
    background: #eff6ff;
    border-left: 3px solid var(--accent);
}
.conv-atc {
    background: #f0fdf4;
    border-left: 3px solid var(--green);
}
.msg-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
}
.conv-msg p { font-size: 0.95rem; }
.conv-feedback {
    margin-bottom: 0.75rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
}
.conv-feedback-good {
    background: var(--green-bg);
    border: 1px solid var(--green-border);
    color: var(--green);
}
.conv-feedback-needs_work {
    background: var(--yellow-bg);
    border: 1px solid var(--yellow-border);
    color: var(--yellow);
}
.conv-hint {
    margin-bottom: 0.75rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--accent);
    font-style: italic;
}
.conv-complete {
    text-align: center;
    padding: 1rem;
    font-weight: 600;
    color: var(--green);
}

/* Input area */
.input-area { margin-bottom: 1rem; }
#transmit-form {
    display: flex;
    gap: 0.5rem;
}
#user-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s;
}
#user-input:focus { border-color: var(--accent); }
#transmit-btn {
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
#transmit-btn:hover { background: var(--accent-hover); }
#transmit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.drill-actions {
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* Responsive */
@media (max-width: 600px) {
    .hero h1 { font-size: 1.6rem; }
    .formula-box { grid-template-columns: 1fr 1fr; }
    .ref-grid { grid-template-columns: 1fr; }
    .scenario-grid { grid-template-columns: 1fr; }
    main { padding: 1.5rem 0.75rem 3rem; }
}
