* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.container { max-width: 820px; width: 100%; }
.card { background: #fff; border-radius: 12px; padding: 2rem; box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.footer-note { text-align: center; color: rgba(255,255,255,0.75); font-size: 12px; margin-top: 12px; }
.hidden { display: none !important; }
.header { text-align: center; margin-bottom: 1.5rem; }
.header h1 { font-size: 26px; margin-bottom: 0.4rem; color: #333; }
.header p { color: #666; font-size: 14px; }

.form-group { margin-bottom: 1.25rem; }
label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: #333; font-size: 14px; }
input[type="text"], select, textarea {
    width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px;
    font-size: 14px; font-family: inherit; transition: border-color .2s;
}
input:focus, textarea:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,.12); }
textarea { min-height: 110px; resize: vertical; font-family: monospace; font-size: 12px; }

.button-group { display: flex; gap: 10px; margin-top: 1rem; flex-wrap: wrap; }
button {
    flex: 1; min-width: 120px; padding: 12px; border: none; border-radius: 8px;
    font-size: 14px; font-weight: 500; cursor: pointer; transition: all .2s;
}
.btn-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(102,126,234,.4); }
.btn-secondary { background: #f0f0f0; color: #333; }
.btn-secondary:hover { background: #e2e2e2; }
.btn-danger { background: #fee; color: #c33; }
.btn-danger:hover { background: #fdd; }

.message { padding: 12px; border-radius: 8px; margin-bottom: 1rem; font-size: 14px; display: none; }
.message.error { background: #fee; color: #c33; border: 1px solid #fcc; display: block; }
.message.success { background: #efe; color: #3c3; border: 1px solid #cfc; display: block; }
.message.info { background: #eef; color: #33c; border: 1px solid #ccf; display: block; }

.pin-input { display: flex; gap: 8px; justify-content: center; }
.pin-input input {
    width: 46px; height: 54px; text-align: center; font-size: 24px; font-weight: 700;
    border: 1px solid #ddd; border-radius: 8px;
}
.pin-input input:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,.12); }

.hint { font-size: 13px; color: #999; margin-top: .5rem; }

.topics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 1.25rem; }
.topic-btn {
    text-align: left; background: #f9f9f9; border: 1px solid #eee; border-radius: 10px;
    padding: 14px; cursor: pointer; transition: all .2s;
}
.topic-btn:hover { border-color: #667eea; background: #f5f5ff; transform: translateY(-1px); }
.topic-code { font-size: 11px; color: #999; }
.topic-title { font-size: 14px; font-weight: 500; color: #333; margin: 2px 0; }
.topic-count { font-size: 12px; color: #888; }

.letters-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 1rem; }
.letter-btn {
    background: #f0f0f0; border: 1px solid #ddd; border-radius: 6px; padding: 8px;
    font-size: 13px; font-weight: 500; cursor: pointer; transition: all .2s; color: #333;
}
.letter-btn:hover { border-color: #667eea; background: #f5f5ff; }
.letter-btn.active { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; border-color: #667eea; }
.letter-btn.all-btn { grid-column: span 2; }

.question-card { background: #f9f9f9; border-left: 4px solid #667eea; padding: 1.5rem; border-radius: 8px; margin-bottom: 1rem; }
.question-text { font-size: 17px; margin-bottom: 1.5rem; color: #333; }
.blank { background: #ffffcc; padding: 2px 8px; border-bottom: 2px solid #667eea; font-weight: 700; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option { padding: 12px; border: 2px solid #ddd; border-radius: 8px; cursor: pointer; transition: all .2s; text-align: center; font-size: 14px; }
.option:hover { border-color: #667eea; background: #f0f0ff; }
.option.selected { background: #667eea; color: #fff; border-color: #667eea; }
.option.correct { background: #efe; border-color: #3c3; }
.option.incorrect { background: #fee; border-color: #c33; }

.progress { width: 100%; height: 6px; background: #eee; border-radius: 3px; margin-bottom: 1rem; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #667eea 0%, #764ba2 100%); width: 0%; transition: width .3s; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 1rem 0; }
.stat-box { background: #f0f0f0; padding: 1rem; border-radius: 8px; text-align: center; }
.stat-number { font-size: 22px; font-weight: 700; color: #667eea; }
.stat-label { font-size: 12px; color: #666; margin-top: .3rem; }

.stats-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #eee; font-size: 14px; }
.stats-row:last-child { border-bottom: none; }

@media (max-width: 480px) {
    .letters-grid { grid-template-columns: repeat(5, 1fr); }
    .topics-grid { grid-template-columns: 1fr; }
    .options { grid-template-columns: 1fr; }
}
