@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

:root {
    --bg-color: #fcfcfc;
    --paper-bg: #ffffff;
    --text-primary: #2c2c2c;
    --text-secondary: #6e6e6e;
    --primary-color: #d13030; /* Minimal Japanese Deep Red */
    --primary-hover: #b02626;
    --sakura-accent: #fbebf0;
    --border-color: #eaeaea;
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.08);
    --success-color: #2b8a3e;
    --danger-color: #c92a2a;
    --radius: 8px;
    --font-sans: 'Inter', 'Noto Sans JP', sans-serif;
    --transition: all 0.2s ease-in-out;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Utilities */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

h1, h2, h3, h4, h5 {
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Header & Navigation */
header {
    background-color: var(--paper-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Cards */
.card {
    background: var(--paper-bg);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--sakura-accent);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Inputs */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--sakura-accent);
}

/* Timer */
.timer-container {
    position: sticky;
    top: 70px;
    z-index: 999;
    background: var(--paper-bg);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    text-align: center;
    display: inline-block;
    border: 2px solid var(--primary-color);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.timer-critical {
    color: var(--danger-color);
    animation: flash 1s infinite alternate;
}

@keyframes flash {
    from { opacity: 1; }
    to { opacity: 0.6; }
}

/* Progress */
.progress-container {
    width: 100%;
    height: 6px;
    background-color: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

/* Test layout */
.question-item {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px dashed var(--border-color);
}

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

.question-text {
    font-size: 1.15rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.option-label {
    display: block;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    background: var(--paper-bg);
}

.option-label:hover {
    background: var(--bg-color);
    border-color: #ccc;
}

.option-label input[type="radio"] {
    margin-right: 0.75rem;
    accent-color: var(--primary-color);
}

.option-label.selected {
    border-color: var(--primary-color);
    background: var(--sakura-accent);
}

/* Dashboard Grid */
.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.level-card {
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.level-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: var(--bg-color);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
}
.badge-master { background: #fff3cd; color: #856404; }
.badge-pass { background: #d4edda; color: #155724; }
.badge-fail { background: #f8dbdf; color: #721c24; }

/* Modal and hidden elements */
.hidden {
    display: none !important;
}

/* Anti-Cheat UI Enhancements */

/* Protect test copying global constraint */
body.test-mode {
    user-select: none !important;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Dynamic tile watermark */
.watermark-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.05;
    background-image: var(--watermark-bg);
    background-repeat: repeat;
    background-size: 300px;
}

/* Hard blur lock */
.blur-lock {
    filter: blur(15px);
    pointer-events: none;
    user-select: none;
}

/* WhatsApp Float Button */
.whatsapp-float {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: #25D366;
    color: white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    box-shadow: var(--shadow-hover);
    cursor: pointer;
    z-index: 1000;
    text-decoration: none;
    transition: var(--transition);
}

.whatsapp-float:hover {
    transform: scale(1.1);
    background-color: #128C7E;
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }
    .brand {
        font-size: 1.1rem;
    }
}
