@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@200..700&display=swap');

/* Variables */
:root {
    --gradient: linear-gradient(90deg, #7c3aed 0%, #06b6d4 100%);
    --primary-gradient: linear-gradient(90deg, #7c3aed 0%, #06b6d4 100%);
    --navy: #0b1220;
    --dark-navy: #0b1220;
    --light: #f8fafc;
    --dark: #0f172a;
    --gray: #666;
    --text-gray: #666;
    --shadow: 0 8px 20px rgba(99, 102, 241, 0.12);
    --radius: 12px;
    --spacing-md: 18px;
    --transition: all 0.3s ease;
}

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

/* Base */
body {
    font-family: 'Oswald', sans-serif;
    background: linear-gradient(135deg, #e6f7ff 0%, #eef2ff 50%, #f8f6ff 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px 20px 140px;
    padding-top: 100px;
    color: var(--dark);
}

/* Layout */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--navy);
    color: var(--light);
    padding: 4px 10px;
    text-align: center;
    box-shadow: 0 4px 18px rgba(11, 18, 32, 0.35);
    z-index: 1000;
}

header h1 {
    font-size: 1.45rem;
    line-height: 1.1;
    margin-bottom: 0;
}

form {
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
    max-width: 560px;
    width: 100%;
    border: 1px solid rgba(15, 23, 42, 0.04);
}

form label, form div, .question {
    display: block;
    width: 100%;
    border-radius: 8px;
}

form label, form div {
    margin: auto;
    padding: 8px 6px;
    margin-bottom: 14px;
    font-size: 15px;
    color: var(--dark);
}

.question {
    background: linear-gradient(180deg, rgba(124, 58, 237, 0.03), rgba(6, 182, 212, 0.02));
    padding: 12px 10px;
    margin-bottom: 10px;
    border: 1px solid rgba(15, 23, 42, 0.04);
}

div {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--dark);
}

input[type="radio"] {
    margin-right: 8px;
    cursor: pointer;
}

/* Buttons */
button {
    background: var(--gradient);
    color: white;
    padding: 12px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    cursor: pointer;
    width: 100%;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    margin-top: 4px;
    box-shadow: var(--shadow);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.14);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#score {
    text-align: center;
    margin-top: 18px;
    font-size: 18px;
    font-weight: 700;
    color: #6b21a8;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: linear-gradient(180deg, #ffffff, #fbfdff);
    padding: 20px 24px;
    border-radius: var(--radius);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
    max-width: 90%;
    width: 380px;
    text-align: center;
}

.modal h2 {
    margin-bottom: 8px;
    color: var(--navy);
}

.modal p {
    margin-bottom: 16px;
    font-size: 18px;
    color: #334155;
}

.modal .modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal .btn {
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
}

.modal .btn.primary {
    background: var(--gradient);
    color: white;
}

.modal .btn.ghost {
    background: transparent;
    border: 1px solid #ccc;
    color: #333;
    box-shadow: none;
}

.submit-container {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 8px;
    width: calc(100% - 40px);
    max-width: 520px;
    z-index: 1800;
}

.submit-container button {
    padding: 9px 14px;
    font-size: 14px;
    border-radius: 9px;
}

/* How to Play */
#how-to-play-btn {
    background: none;
    border: none;
    color: var(--light);
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
    padding: 0;
    transition: opacity 0.3s ease;
}

#how-to-play-btn:hover {
    opacity: 0.8;
}

.how-to-play-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 20px;
}

.how-to-play-modal.active {
    display: flex;
}

.how-to-play-content {
    background: white;
    border-radius: var(--radius);
    padding: 40px;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--gray);
    padding: 0;
    width: 30px;
    height: 30px;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #000;
}

.how-to-play-content h2 {
    color: var(--navy);
    font-size: 2em;
    margin-bottom: 10px;
    text-align: center;
}

.how-to-play-content .subtitle {
    text-align: center;
    color: var(--gray);
    margin-bottom: 30px;
}

.how-to-play-content .section {
    margin-bottom: 40px;
}

.how-to-play-content .section-title {
    color: var(--navy);
    font-size: 1.5em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid #7c3aed;
}

.how-to-play-content .steps {
    display: grid;
    gap: 15px;
}

.how-to-play-content .step {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    background: #f5f7fa;
    border-radius: 8px;
}

.how-to-play-content .step:hover {
    background: #eef2ff;
}

.how-to-play-content .step-number {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: var(--gradient);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.how-to-play-content .step-content h4 {
    color: var(--navy);
    font-size: 1.1em;
    margin-bottom: 5px;
}

.how-to-play-content .step-content p {
    color: var(--gray);
    font-size: 0.95em;
    line-height: 1.5;
}

.how-to-play-content .tips {
    background: #fff5e6;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #ff9800;
}

.how-to-play-content .tips h4 {
    color: #ff9800;
    font-size: 1.2em;
    margin-bottom: 15px;
}

.how-to-play-content .tips ul {
    list-style: none;
    padding: 0;
}

.how-to-play-content .tips li {
    color: var(--gray);
    line-height: 1.8;
    margin-bottom: 8px;
    padding-left: 25px;
    position: relative;
}

.how-to-play-content .tips li:before {
    content: "✓";
    color: #ff9800;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Standalone How-to-Play Page */
.container {
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
    max-width: 700px;
    width: 100%;
    border: 1px solid rgba(15, 23, 42, 0.04);
    text-align: center;
}

.container h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.container .subtitle {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 40px;
    font-weight: 300;
}

.container .section {
    text-align: left;
    margin-bottom: 35px;
}

.container .section-title {
    color: var(--navy);
    font-size: 1.6em;
    margin-bottom: 25px;
    padding-bottom: 12px;
    border-bottom: 3px solid;
    border-image: var(--gradient) 1;
}

.container .steps {
    display: grid;
    gap: 15px;
}

.container .step {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: var(--spacing-md);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%);
    border-radius: 10px;
    border: 1px solid rgba(124, 58, 237, 0.1);
    transition: var(--transition);
}

.container .step:hover {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.12) 0%, rgba(6, 182, 212, 0.12) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.1);
}

.container .step-number {
    flex-shrink: 0;
    width: 45px;
    height: 45px;
    background: var(--gradient);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}

.container .step-content h4 {
    color: var(--navy);
    font-size: 1.15em;
    margin-bottom: 8px;
    font-weight: 600;
}

.container .step-content p {
    color: var(--gray);
    font-size: 0.95em;
    line-height: 1.6;
    margin: 0;
}

.container .tips {
    background: linear-gradient(135deg, #fff8f0 0%, #fff5e6 100%);
    padding: 25px;
    border-radius: 10px;
    border-left: 5px solid #ff9800;
    text-align: left;
}

.container .tips h4 {
    color: #ff9800;
    font-size: 1.3em;
    margin-bottom: 18px;
    font-weight: 700;
}

.container .tips ul {
    list-style: none;
    padding: 0;
}

.container .tips li {
    color: var(--gray);
    line-height: 1.8;
    margin-bottom: 12px;
    padding-left: 28px;
    position: relative;
    font-size: 0.95em;
}

.container .tips li::before {
    content: "✓";
    color: #ff9800;
    font-weight: bold;
    position: absolute;
    left: 0;
    font-size: 1.2em;
}

.container .scoring-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.container .score-card {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid rgba(124, 58, 237, 0.2);
    transition: var(--transition);
}

.container .score-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(124, 58, 237, 0.15);
    border-color: rgba(124, 58, 237, 0.4);
}

.container .score-icon {
    font-size: 2.5em;
    margin-bottom: 12px;
    font-weight: bold;
}

.container .score-card h4 {
    font-size: 1.1em;
    margin-bottom: 10px;
    color: var(--navy);
}

.container .score-card p {
    color: var(--gray);
    font-size: 1.3em;
    font-weight: 600;
}

.container .cta-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

.container .btn {
    display: inline-block;
    background: var(--gradient);
    color: white;
    padding: 12px 30px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.container .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.14);
}

/* Media Queries */
@media (max-width: 768px) {
    header { padding: 4px 10px; gap: 2px; }
    header h1 { font-size: 1.3rem; }
    body { padding-top: 95px; padding-bottom: 160px; }
    form, .how-to-play-content, .container { padding: 25px; margin: 0 10px; }
    .question { padding: 12px 10px; margin-bottom: 12px; }
    div { font-size: 16px; margin-bottom: 12px; }
    button { padding: 11px 16px; font-size: 15px; }
    .modal { max-width: 85%; padding: 18px 20px; }
    .modal h2 { font-size: 1.3em; }
    .submit-container { width: calc(100% - 20px); bottom: 6px; flex-direction: column; gap: 8px; }
    .submit-container button { padding: 8px 12px; font-size: 13px; }
    .how-to-play-content h2 { font-size: 1.6em; }
    .how-to-play-content .subtitle { font-size: 0.95em; margin-bottom: 25px; }
    .how-to-play-content .section-title { font-size: 1.3em; margin-bottom: 18px; }
    .how-to-play-content .step { gap: 12px; padding: 12px; }
    .how-to-play-content .step-number { width: 38px; height: 38px; }
    .how-to-play-content .tips { padding: 18px; }
    .container .step { gap: 12px; padding: 15px; }
    .container .step-number { width: 40px; height: 40px; font-size: 1.1em; }
    .container .step-content h4 { font-size: 1em; }
    .container .step-content p, .container .tips li { font-size: 0.9em; }
    .container .tips { padding: 18px; }
}

@media (max-width: 480px) {
    header { padding: 3px 8px; gap: 2px; }
    header h1 { font-size: 1.15rem; }
    body { padding: 90px 10px 150px; }
    form, .how-to-play-content, .container { padding: 15px; }
    form { max-width: 100%; border-radius: 10px; }
    form label, form div { padding: 8px 5px; margin-bottom: 12px; }
    .question { padding: 10px 8px; margin-bottom: 10px; border-radius: 6px; }
    div { font-size: 15px; margin-bottom: 10px; }
    input[type="radio"] { margin-right: 6px; }
    button { padding: 10px 14px; font-size: 14px; border-radius: 8px; }
    button:hover { transform: translateY(-1px); }
    .modal-overlay { padding: 10px; }
    .modal { width: 90%; padding: 14px 16px; border-radius: 10px; }
    .modal h2 { font-size: 1.1em; margin-bottom: 6px; }
    .modal p { font-size: 15px; margin-bottom: 12px; }
    .modal .btn { padding: 7px 12px; font-size: 14px; }
    .submit-container { width: calc(100% - 10px); bottom: 4px; flex-direction: column; gap: 6px; }
    .submit-container button { padding: 7px 11px; font-size: 12px; }
    #how-to-play-btn { font-size: 11px; }
    .how-to-play-modal { padding: 10px; }
    .how-to-play-content { max-width: 100%; max-height: 95vh; padding: 20px; border-radius: 10px; }
    .close-btn { width: 28px; height: 28px; font-size: 24px; top: 10px; right: 10px; }
    .how-to-play-content h2 { font-size: 1.4em; margin-bottom: 8px; }
    .how-to-play-content .subtitle { font-size: 0.9em; margin-bottom: 20px; }
    .how-to-play-content .section { margin-bottom: 25px; }
    .how-to-play-content .section-title { font-size: 1.15em; margin-bottom: 15px; padding-bottom: 8px; }
    .how-to-play-content .step { gap: 10px; padding: 10px; border-radius: 6px; }
    .how-to-play-content .step-number { width: 35px; height: 35px; font-size: 1em; }
    .how-to-play-content .step-content h4 { font-size: 0.95em; margin-bottom: 4px; }
    .how-to-play-content .step-content p { font-size: 0.85em; line-height: 1.4; }
    .how-to-play-content .tips { padding: 15px; border-left: 3px solid #ff9800; }
    .how-to-play-content .tips h4 { font-size: 1.05em; margin-bottom: 12px; }
    .how-to-play-content .tips li { font-size: 0.85em; line-height: 1.6; margin-bottom: 6px; padding-left: 22px; }
    .container .step { gap: 10px; padding: 12px; border-radius: 6px; }
    .container .step-number { width: 35px; height: 35px; font-size: 0.95em; }
    .container .step-content h4 { font-size: 0.95em; }
    .container .step-content p, .container .tips li { font-size: 0.85em; }
    .container .tips { padding: 15px; border-left: 3px solid #ff9800; }
    .container .tips h4 { font-size: 1.1em; }
}

@media (max-width: 375px) {
    header { padding: 2px 6px; }
    header h1 { font-size: 1rem; }
    body { padding-top: 85px; padding-bottom: 140px; }
    form, .how-to-play-content, .container { padding: 12px; }
    div { font-size: 14px; }
    button { padding: 8px 12px; font-size: 13px; }
    .modal { width: 95%; padding: 12px 14px; }
    .modal h2 { font-size: 1em; }
    .modal p { font-size: 14px; }
    .how-to-play-content h2 { font-size: 1.2em; }
    .how-to-play-content .section-title { font-size: 1em; }
    .how-to-play-content .step-number { width: 32px; height: 32px; font-size: 0.9em; }
    .container .step { gap: 8px; padding: 10px; }
    .container .step-number { width: 32px; height: 32px; font-size: 0.9em; }
    .container .step-content h4 { font-size: 0.9em; }
    .container .step-content p { font-size: 0.8em; }
    .container .tips { padding: 12px; }
    .container .tips h4 { font-size: 1em; }
    .container .tips li { font-size: 0.8em; }
}
