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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    font-size: 13px;
}

.container {
    max-width: 760px;
    width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    padding: 8px;
    text-align: center;
    color: #333;
}

.header h1 {
    font-size: 1.4rem;
    margin-bottom: 3px;
    font-weight: 700;
}

.header p {
    font-size: 0.8rem;
    opacity: 0.8;
}

.exam-info {
    background: #f8f9ff;
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
}

.exam-info h3 {
    color: #333;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.domain-weights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 5px;
    font-size: 0.75rem;
}

.domain-weight {
    background: white;
    padding: 4px 6px;
    border-radius: 4px;
    border-left: 2px solid #667eea;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 8px 0;
    flex-wrap: wrap;
}

.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.btn-secondary {
    background: linear-gradient(45deg, #f093fb, #f5576c);
    color: white;
}

.btn-success {
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    color: white;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.ad-slot {
    margin: 8px 10px;
    background: #f8f9ff;
    border: 1px dashed #d0d4ff;
    border-radius: 6px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
    font-size: 0.75rem;
}

.ad-slot-top {
    min-height: 90px;
}

.ad-slot-bottom {
    min-height: 90px;
}

.card-container {
    perspective: 1000px;
    margin: 10px;
    height: 380px;
}

.flashcard {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    cursor: pointer;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 12px;
    text-align: left;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.card-back {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    transform: rotateY(180deg);
}

.card-content {
    font-size: 0.85rem;
    line-height: 1.4;
    max-height: calc(100% - 26px);
    overflow-y: auto;
    width: 100%;
}

.card-front .card-content {
    font-weight: 600;
    font-size: 1rem;
}

.card-back .card-content ul {
    list-style: none;
    padding: 0;
}

.card-back .card-content li {
    margin-bottom: 6px;
    padding-left: 12px;
    position: relative;
}

.card-back .card-content li:before {
    content: "•";
    color: white;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Preserve indentation and line breaks in the answer text */
.card-back .card-content {
    white-space: pre-wrap;
}

.progress {
    background: #f0f0f0;
    height: 4px;
    border-radius: 2px;
    margin: 8px 10px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(45deg, #667eea, #764ba2);
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.category-selector {
    margin: 8px 10px;
}

.category-selector label {
    font-weight: 600;
    margin-right: 6px;
    color: #333;
    font-size: 0.8rem;
}

.category-selector select {
    padding: 4px 8px;
    border-radius: 12px;
    border: 1px solid #ddd;
    background: white;
    font-size: 0.75rem;
    cursor: pointer;
}

.stats {
    display: flex;
    justify-content: space-around;
    margin: 8px 10px;
    text-align: center;
}

.stat {
    padding: 6px;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border-radius: 6px;
    min-width: 60px;
}

.stat-number {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
}

.stat-label {
    color: #666;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.domain-tag {
    display: inline-block;
    padding: 2px 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    font-size: 0.65rem;
    margin-bottom: 6px;
    font-weight: normal;
}

.card-domain {
    width: 100%;
    font-size: 0.7rem;
    opacity: 0.9;
    margin-bottom: 6px;
}

.card-front .card-domain {
    color: rgba(255,255,255,0.95);
}

.card-back .card-domain {
    color: rgba(255,255,255,0.95);
}

/* Align back-face domain title with list text (which is indented) */
.card-back .card-domain {
    margin-left: 12px;
}

/* Align front-face domain and question text to the same text column as back-face */
.card-front .card-domain,
.card-front .card-content,
.card-back .card-domain,
.card-back .card-content {
    padding-left: 8px;
}

.search-container {
    margin: 8px 10px;
    position: relative;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 0.8rem;
    background: white;
    outline: none;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-result-item {
    padding: 6px 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.75rem;
    transition: background-color 0.2s ease;
}

.search-result-item:hover,
.search-result-item.selected {
    background-color: #f8f9ff;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-question {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.search-result-domain {
    color: #666;
    font-size: 0.65rem;
}