:root {
    --bg-main: #fdf8f4;
    --bg-card: #ffffff;
    --border-color: #eaddd3;
    --text-main: #4a3f35;
    --text-muted: #8c7d70;
    --accent-red: #e06d53;
    --accent-orange: #f2a65a;
    --accent-green: #52b788;
    --accent-blue: #4ea8de;
    --shadow: 0 6px 18px rgba(74, 63, 53, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #fce8d8 0%, #f4d3b8 100%);
    border-bottom: 3px solid var(--accent-red);
    padding: 2rem 1rem;
    text-align: center;
}

.badge {
    display: inline-block;
    background-color: rgba(224, 109, 83, 0.15);
    color: #c44f37;
    border: 1px solid var(--accent-red);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.app-header h1 { font-size: 2rem; margin-bottom: 0.3rem; }
.app-header p { color: var(--text-muted); font-size: 0.95rem; }

/* Navigasi Tab */
.tab-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.25s ease;
}
.tab-btn:hover { color: var(--text-main); background-color: rgba(0,0,0,0.03); }
.tab-btn.active {
    color: #c44f37;
    border-bottom-color: var(--accent-red);
    background-color: rgba(224, 109, 83, 0.08);
}

/* Container & Card */
.container { max-width: 1100px; margin: 2rem auto; padding: 0 1rem; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.35s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(74,63,53,0.1); }

.card h2 {
    color: #4a3f35;
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
    border-left: 4px solid var(--accent-red);
    padding-left: 0.75rem;
}
.subtitle { color: var(--text-muted); margin-bottom: 1.2rem; font-size: 0.95rem; }

/* Grid & Lists */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.styled-list { padding-left: 1.2rem; }
.styled-list li { margin-bottom: 0.5rem; }
.sub-box { margin-bottom: 0.75rem; }
.sub-box h3 { font-size: 1rem; margin-bottom: 0.25rem; color: #c44f37; }
.sub-box ul { padding-left: 1.2rem; }

/* Table */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
th, td { border: 1px solid var(--border-color); padding: 0.75rem 0.9rem; text-align: left; vertical-align: top; }
th { background: #fff3ea; color: #6b4a3a; }
tbody tr { transition: background 0.2s; }
tbody tr:hover { background: #fffaf6; }
code { background: #f7efe8; padding: 0.1rem 0.35rem; border-radius: 4px; font-family: Consolas, monospace; color: #b04632; }

/* Buttons */
.btn {
    border: none;
    border-radius: 8px;
    padding: 0.65rem 1.1rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.btn.primary { background: var(--accent-red); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #cc5b43; transform: translateY(-1px); }
.btn.secondary { background: #efe6de; color: var(--text-main); }
.btn.secondary:hover:not(:disabled) { background: #e3d6cb; }
.btn.small { padding: 0.5rem 0.8rem; font-size: 0.85rem; }

/* Stepper */
.stepper-container { margin-top: 0.5rem; }
.step-indicator { font-weight: 700; color: #c44f37; margin-bottom: 0.5rem; }
.progress-bar { height: 10px; background: #f0e6de; border-radius: 999px; overflow: hidden; margin-bottom: 1rem; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-red), var(--accent-orange)); border-radius: 999px; transition: width 0.35s ease; }
.step-dots { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.step-dot {
    width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border-color);
    background: #fff; color: var(--text-muted); font-weight: 700; font-size: 0.8rem;
    cursor: pointer; transition: all 0.2s ease;
}
.step-dot:hover { border-color: var(--accent-orange); transform: scale(1.05); }
.step-dot.active { background: var(--accent-red); color: #fff; border-color: var(--accent-red); }
.step-dot.done { background: #fde7df; color: #c44f37; border-color: #f0b8aa; }
.step-card {
    background: linear-gradient(180deg, #fffaf7, #ffffff);
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--accent-red);
    border-radius: 10px;
    padding: 1.25rem;
    min-height: 170px;
    margin-bottom: 1rem;
}
.step-card h3 { margin-bottom: 0.5rem; color: #3f342c; }
.step-tag {
    display: inline-block; margin-top: 0.75rem; padding: 0.4rem 0.7rem;
    background: #2d241f; color: #f8e8d8; border-radius: 6px;
    font-family: Consolas, monospace; font-size: 0.85rem;
}
.step-controls { display: flex; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }

/* Simulation */
.sim-workspace { display: grid; grid-template-columns: 340px 1fr; gap: 1.25rem; align-items: start; }
.control-panel { display: flex; flex-direction: column; gap: 0.9rem; }
.control-group {
    border: 1px solid var(--border-color); border-radius: 10px; padding: 0.85rem;
    background: #fffaf7; transition: border-color 0.2s, box-shadow 0.2s;
}
.control-group.highlight { border-color: var(--accent-red); box-shadow: 0 0 0 3px rgba(224,109,83,0.12); }
.control-group label { display: block; margin-bottom: 0.4rem; }
.scale-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.scale-row input[type="number"] {
    width: 80px; padding: 0.35rem 0.45rem; border: 1px solid #d9c8ba; border-radius: 6px;
    font-weight: 600; color: var(--text-main);
}
.scale-row input[type="range"] { flex: 1; min-width: 120px; accent-color: var(--accent-red); cursor: pointer; }
.badge-mini { font-size: 0.75rem; color: #fff; background: var(--accent-orange); padding: 0.15rem 0.45rem; border-radius: 999px; }
.toggle-box { background: #fff; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-weight: 500; }
.checkbox-label input { width: 18px; height: 18px; accent-color: var(--accent-red); }
.btn-group { display: flex; flex-direction: column; gap: 0.5rem; }
.command-box {
    background: #1f1a17; color: #f3e6d8; border-radius: 8px; padding: 0.8rem;
    font-family: Consolas, monospace; font-size: 0.85rem; line-height: 1.5; min-height: 96px;
}
.command-box strong { color: #ffd29d; }
.acad-viewport { background: #0f1115; border-radius: 10px; overflow: hidden; border: 1px solid #2b2f36; }
.viewport-header {
    display: flex; justify-content: space-between; padding: 0.5rem 0.75rem;
    background: #1a1f27; color: #cfd8e3; font-size: 0.8rem; border-bottom: 1px solid #2b2f36;
}
#scale-canvas { display: block; width: 100%; height: auto; background: #0b0d10; }
.viewport-hint { padding: 0.5rem 0.75rem; font-size: 0.8rem; color: #9aa7b5; background: #141820; }

/* Quiz */
.quiz-item {
    border: 1px solid var(--border-color); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; background: #fff;
    transition: border-color 0.2s;
}
.quiz-item.correct { border-color: #52b788; background: #f3fbf7; }
.quiz-item.wrong { border-color: #e06d53; background: #fff6f4; }
.quiz-item p { font-weight: 600; margin-bottom: 0.6rem; }
.quiz-options { display: flex; flex-direction: column; gap: 0.45rem; }
.quiz-options label {
    display: flex; gap: 0.55rem; align-items: flex-start; padding: 0.55rem 0.65rem;
    border: 1px solid #eadfd6; border-radius: 8px; cursor: pointer; transition: all 0.2s;
}
.quiz-options label:hover { background: #fff8f2; border-color: #e3c8b6; }
.quiz-options label.selected { border-color: var(--accent-orange); background: #fff4e8; }
.quiz-options label.is-correct { border-color: #52b788; background: #eaf8f1; }
.quiz-options label.is-wrong { border-color: #e06d53; background: #fdeceb; }
.quiz-options input { margin-top: 0.2rem; accent-color: var(--accent-red); }
.quiz-feedback { margin-top: 0.5rem; font-size: 0.9rem; font-weight: 600; }
.quiz-feedback.ok { color: #2d8a5e; }
.quiz-feedback.no { color: #c44f37; }
.quiz-result {
    margin-top: 1rem; padding: 1.25rem; border-radius: 10px; text-align: center;
    background: linear-gradient(135deg, #fff3ea, #fffaf6); border: 1px solid #f0d7c6;
}
.quiz-result h3 { margin-bottom: 0.4rem; }
.hidden { display: none !important; }

footer {
    text-align: center; padding: 1.5rem 1rem 2rem; color: var(--text-muted);
    border-top: 1px solid var(--border-color); background: #fff; font-size: 0.95rem;
}

@media (max-width: 900px) {
    .sim-workspace { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .app-header h1 { font-size: 1.5rem; }
    .tab-btn { padding: 0.75rem 0.8rem; font-size: 0.85rem; }
    .step-controls { flex-direction: column; }
    .step-controls .btn { width: 100%; }
}