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

:root {
    --bg: #0a0a0f;
    --card: #14141f;
    --border: #2a2a40;
    --accent: #6c5ce7;
    --success: #00cec9;
    --danger: #ff6b6b;
    --text: #e8e8f0;
    --muted: #666680;
    --radius: 12px;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.app {
    max-width: 700px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 24px;
}
.header h1 { font-size: 1.4rem; }

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    border-radius: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}
.status-badge.active { border-color: var(--success); color: var(--success); }
.status-badge.analyzing { border-color: #feca57; color: #feca57; }

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--muted);
}
.status-badge.active .status-dot {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2s infinite;
}
.status-badge.analyzing .status-dot {
    background: #feca57;
    animation: pulse 0.6s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ============ ANSWER BOX ============ */
.answer-box {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 24px;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    transition: border-color 0.3s;
    text-align: center;
}
.answer-box.has-answer {
    border-color: var(--success);
    box-shadow: 0 0 30px rgba(0, 206, 201, 0.15);
}

.answer-placeholder {
    font-size: 1.1rem;
    color: var(--muted);
}

.answer-content { width: 100%; }

.answer-letter {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--success);
    margin-bottom: 8px;
    line-height: 1.2;
}

.answer-detail {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
    line-height: 1.5;
}

.answer-explanation {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.5;
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-top: 4px;
}

/* Controls */
.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 16px rgba(108,92,231,0.35);
}
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-secondary {
    background: var(--card);
    color: var(--muted);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--text); }

.hidden { display: none !important; }

/* Interval */
.interval-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    font-size: 0.85rem;
    color: var(--muted);
}
.interval-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 5px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
}
.interval-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

/* History */
.history-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.history-header h3 { font-size: 0.95rem; }

.btn-clear {
    background: none;
    border: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.78rem;
    cursor: pointer;
}
.btn-clear:hover { color: var(--text); }

#history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    background: var(--bg);
    animation: fadeIn 0.25s ease;
}
.history-item .hi-answer {
    font-weight: 700;
    color: var(--success);
    margin-bottom: 4px;
}
.history-item .hi-question {
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.4;
}
.history-item .hi-time {
    font-size: 0.7rem;
    color: #444;
    margin-top: 6px;
}

@keyframes fadeIn { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:translateY(0)} }

/* Responsive */
@media (max-width: 550px) {
    .controls { flex-direction: column; }
    .btn { width: 100%; justify-content: center; }
}
