:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --primary-color: #3b82f6;
    --accent-critical: #ef4444;
    --accent-normal: #10b981;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-bg: #1e293b;
    --font-main: 'Noto Sans TC', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    /* Prevent text selection during swiping */
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    /* Prevent scrolling on mobile */
    height: 100vh;
    width: 100vw;
}

.app-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 480px;
    /* Mobile-first constraint for desktop view */
    margin: 0 auto;
    background: linear-gradient(to bottom, #0f172a, #1e293b);
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

/* Background Effects */
.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    z-index: 0;
}

.orb-1 {
    width: 300px;
    height: 300px;
    background: var(--primary-color);
    top: -50px;
    left: -100px;
    animation: float 10s infinite ease-in-out;
}

.orb-2 {
    width: 250px;
    height: 250px;
    background: var(--accent-critical);
    bottom: -50px;
    right: -50px;
    animation: float 12s infinite ease-in-out reverse;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(20px, 30px);
    }
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
    transform: scale(0.95);
    z-index: 1;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
    z-index: 10;
}

/* Typography & Layout */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 2;
}

h1 {
    font-size: 2.5rem;
    line-height: 1.2;
    margin-bottom: 10px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h1 span {
    font-size: 1.8rem;
    font-weight: 500;
}

.subtitle {
    color: #94a3b8;
    margin-bottom: 40px;
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px 24px;
    margin-bottom: 16px;
    border: none;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: var(--font-main);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #2563eb);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    backdrop-filter: blur(10px);
}

.icon {
    margin-right: 8px;
}

/* Info Screen */
.screen-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    z-index: 2;
}

.btn-back {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1rem;
    cursor: pointer;
    padding: 8px;
}

.screen-header h2 {
    flex: 1;
    text-align: center;
    margin-right: 40px;
    /* Balance the back button */
}

.scroll-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
    z-index: 2;
}

.info-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
}

.info-card.critical h3 {
    color: var(--accent-critical);
}

.info-card.normal h3 {
    color: var(--accent-normal);
}

.info-card ul {
    list-style-position: inside;
    margin-top: 10px;
    text-align: left;
    color: #cbd5e1;
}

.info-card li {
    margin-bottom: 8px;
    line-height: 1.4;
}

/* Quiz Screen */
.game-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    z-index: 2;
}

.timer-badge {
    background: var(--glass-bg);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    border: 1px solid var(--glass-border);
    color: var(--accent-critical);
}

.game-area {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

.zone {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    /* Reduced width */
    height: 200px;
    /* Reduced height */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0.3;
    transition: opacity 0.3s;
    border-radius: 12px;
    z-index: 1;
    /* Behind cards */
}

.zone.active {
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.1);
}

.left-zone {
    left: -20px;
    /* Partially off-screen or just on edge */
    border: 2px dashed var(--accent-normal);
    border-left: none;
    color: var(--accent-normal);
}

.right-zone {
    right: -20px;
    /* Partially off-screen or just on edge */
    border: 2px dashed var(--accent-critical);
    border-right: none;
    color: var(--accent-critical);
}

.zone-label {
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-weight: 700;
    letter-spacing: 4px;
    font-size: 0.9rem;
}

.card-stack-container {
    position: relative;
    width: 320px;
    /* Increased width */
    height: 420px;
    /* Increased height */
    perspective: 1000px;
    z-index: 10;
}

.quiz-card {
    position: absolute;
    width: 100%;
    height: 100%;
    background: white;
    color: #1e293b;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    cursor: grab;
    transition: transform 0.1s;
    /* Smooth drag */
    will-change: transform;
}

.quiz-card:active {
    cursor: grabbing;
}

.controls-hint {
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 20px;
    z-index: 2;
}

/* Result Screen */
.result-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}

.stat-item {
    flex: 1;
    background: var(--glass-bg);
    padding: 15px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid var(--glass-border);
}

.stat-item .value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-item:first-child .value {
    color: var(--accent-normal);
}

.stat-item:last-child .value {
    color: var(--accent-critical);
}

.accuracy-ring {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 40px;
}

.ring-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.ring-content .percent {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
}

.progress-ring__circle {
    transition: stroke-dashoffset 1s ease-in-out;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    stroke: var(--primary-color);
    stroke-dasharray: 326.72;
    /* 2 * pi * 52 */
    stroke-dashoffset: 326.72;
}

.btn-back-home {
    background: none;
    border: none;
    color: #94a3b8;
    margin-top: 10px;
    cursor: pointer;
    text-decoration: underline;
}