/* =============================================
   Sudoku Corner — Flat Design System
   Font: Inter · No shadows · Clean & professional
   ============================================= */

:root {
    --primary: #0a6aae;
    --primary-hover: #085a94;
    --primary-light: #e8f2fa;
    --accent: #e63946;
    --accent-hover: #cf2f3d;
    --accent-light: #fdeaec;

    --green: #2ecc71;
    --green-hover: #27ae60;
    --green-light: #eafaf1;
    --orange: #f39c12;
    --orange-hover: #d68910;
    --orange-light: #fef5e7;
    --red: #e63946;
    --red-hover: #cf2f3d;
    --red-light: #fdeaec;
    --blue: #1cb0f6;
    --blue-hover: #1899d6;
    --blue-light: #e8f7fe;
    --purple: #a855f7;

    --beginner: #2ecc71;
    --beginner-hover: #27ae60;
    --beginner-light: #eafaf1;
    --intermediate: #f39c12;
    --intermediate-hover: #d68910;
    --intermediate-light: #fef5e7;
    --expert: #e63946;
    --expert-hover: #cf2f3d;
    --expert-light: #fdeaec;

    --bg: #ffffff;
    --bg-page: #f5f5f5;
    --border: #e0e0e0;
    --border-hover: #ccc;
    --text: #333;
    --text-2: #666;
    --text-3: #999;
    --text-4: #ccc;

    --radius: 8px;        /* RADIUS experiment: was 12px — revert: change back to 12px */
    --radius-sm: 5px;      /* RADIUS experiment: was 8px  — revert: change back to 8px  */
    --radius-pill: 100px;
    --nav-h: 56px;
    --mob-nav-h: 82px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg-page);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    overflow-x: clip; /* Bootstrap sets overflow-x:hidden which breaks Popper.js tooltip positioning */
}

/* ── Page background grid ── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background-image:
        linear-gradient(rgba(0,0,0,.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,.07) 1px, transparent 1px);
    background-size: 48px 48px;
    opacity: 0.55;
    mask-image: radial-gradient(ellipse at 50% 20%, transparent 30%, black 72%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 20%, transparent 30%, black 72%);
}


h1,h2,h3,h4,h5,h6 {
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
    margin: 0 0 8px;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 12px; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ── Logo ── */
.logo-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.logo-badge {
    width: 32px; height: 32px;
    background: var(--primary);
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-mini {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 1px;
    width: 17px; height: 17px;
}

.logo-mini span {
    display: flex; align-items: center; justify-content: center;
    font-size: 4.5px; font-weight: 800; color: rgba(255,255,255,.85);
}

.logo-mini span.star {
    background: rgba(255,255,255,.25);
    border-radius: 1.5px;
    color: #fff;
}

.logo-text { font-size: 17px; font-weight: 700; color: var(--text); }
.logo-text .corner { color: var(--primary); }
.logo-text-sm { font-size: 14px; font-weight: 700; color: var(--text); }

/* ── Buttons — fully flat ── */
.btn {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: .02em;
    border: none;
    border-radius: var(--radius);
    padding: 10px 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    transition: background .15s, opacity .15s;
    box-shadow: none;
}

.btn:active { opacity: .85; }

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

.btn-accent, .btn-danger { background: var(--accent); color: #fff; }
.btn-accent:hover, .btn-danger:hover { background: var(--accent-hover); color: #fff; }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: var(--green-hover); color: #fff; }

.btn-warning { background: var(--orange); color: #fff; }
.btn-warning:hover { background: var(--orange-hover); color: #fff; }

.btn-info { background: var(--blue); color: #fff; }
.btn-info:hover { background: var(--blue-hover); color: #fff; }

.btn-outline-primary {
    background: #fff; color: var(--primary);
    border: 2px solid var(--border);
}
.btn-outline-primary:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

.btn-outline-light {
    background: transparent; color: #fff;
    border: 2px solid rgba(255,255,255,.4);
}
.btn-outline-light:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.7); color: #fff; }

.btn-lg { padding: 12px 28px; font-size: 14px; }
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-block { width: 100%; }

.btn[disabled], .btn.disabled {
    opacity: .45;
    pointer-events: none;
}

/* ── Cards — flat ── */
.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.card-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-3);
    margin-bottom: 14px;
}

/* ── Division badges ── */
.division-badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: var(--radius-pill);
    font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: .04em;
}
.division-badge.beginner { background: var(--beginner-light); color: var(--beginner-hover); }
.division-badge.intermediate { background: var(--intermediate-light); color: var(--intermediate-hover); }
.division-badge.expert { background: var(--expert-light); color: var(--expert-hover); }

/* ── Class badges ── */
.class-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 10px; border-radius: var(--radius-pill);
    font-weight: 600; font-size: 11px;
}
.class-badge.class-c { background: #f5f5f5; color: #999; }
.class-badge.class-b { background: var(--blue-light); color: var(--blue); }
.class-badge.class-a { background: var(--orange-light); color: var(--orange); }
.class-badge.class-elite { background: #f3e8ff; color: var(--purple); }

/* ── ELO ── */
.elo-value { font-weight: 700; font-size: 1.75rem; line-height: 1; }
.elo-change { font-weight: 600; font-size: 13px; }
.elo-change.positive { color: var(--green); }
.elo-change.negative { color: var(--red); }

/* ── Forms ── */
.form-group { margin-bottom: 14px; }

.form-label {
    display: block;
    font-weight: 600; font-size: 12px;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 4px;
}

.form-control {
    width: 100%; padding: 10px 14px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color .15s;
}
.form-control:focus { border-color: var(--primary); }
.form-control.is-invalid { border-color: var(--red); }
.invalid-feedback { color: var(--red); font-size: 12px; margin-top: 3px; }

.form-check-input {
    width: 18px; height: 18px;
    border: 1px solid var(--border);
    border-radius: 3px;
    accent-color: var(--primary);
}

/* ── Top nav ── */
.top-nav {
    background: #fff;
    border-bottom: 1px solid var(--border);
    height: var(--nav-h);
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center;
}
.top-nav .container { height: 100%; }

.nav-links { display: flex; gap: 2px; }

.nav-link {
    font-weight: 600; font-size: 13px;
    color: var(--text-3);
    padding: 6px 14px; border-radius: var(--radius-sm);
    transition: all .15s;
}
.nav-link:hover { color: var(--primary); background: var(--primary-light); }
.nav-link.active { color: var(--primary); background: var(--primary-light); font-weight: 700; }

.nav-right { display: flex; align-items: center; gap: 14px; }

.nav-icon-link {
    position: relative; font-size: 18px; color: var(--text-3);
    transition: color .15s;
}
.nav-icon-link:hover { color: var(--primary); }

.notif-badge, .notif-badge-mobile {
    position: absolute; top: -5px; right: -7px;
    background: var(--accent); color: #fff;
    font-size: 9px; font-weight: 700;
    min-width: 15px; height: 15px; border-radius: 5px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 3px;
}

.nav-user-btn {
    font-weight: 600; font-size: 13px;
    color: var(--text); text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 12px; background: #fff;
    transition: border-color .15s;
}
.nav-user-btn:hover { border-color: var(--border-hover); }

.admin-link { color: var(--primary) !important; font-weight: 600; }

/* ── Mobile bottom nav ── */
.mobile-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #f2f2f7;
    border-top: none;
    box-shadow: 0 -1px 0 rgba(0,0,0,.06), 0 -4px 16px rgba(0,0,0,.07);
    display: flex; justify-content: space-around; align-items: center;
    height: var(--mob-nav-h);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
    padding-top: 0;
}
/* Capacitor: no extra safe-area padding, Android handles it natively */
.capacitor-android .mobile-nav {
    padding-bottom: 0;
    height: var(--mob-nav-h);
}

.mobile-nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; text-decoration: none; color: #8e8e93;
    font-size: 10px; font-weight: 600; padding: 8px 6px 6px;
    position: relative; transition: color .15s; min-width: 0; flex: 1;
    border-radius: 12px; margin: 6px 3px;
}
.mobile-nav-item .mobile-nav-icon { font-size: 20px; line-height: 1; }
.mobile-nav-item i { font-size: 24px; line-height: 1; }
.mobile-nav-item.active {
    color: var(--primary);
    background: rgba(0, 122, 255, 0.1);
}

/* ── Main content ── */
.main-content {
    padding: 20px 0;
    min-height: calc(100vh - var(--nav-h) - 60px);
}
@media (max-width:767.98px) {
    .main-content { padding-bottom: calc(var(--mob-nav-h) + env(safe-area-inset-bottom) + 32px); }
}

/* ── Guest / Landing ── */
.guest-nav {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
    position: sticky; top: 0; z-index: 100;
}

.guest-nav-actions { display: flex; gap: 6px; align-items: center; }
.guest-nav-actions .btn-outline-light {
    color: var(--text-2); border: 1px solid var(--border);
    background: #fff;
}
.guest-nav-actions .btn-outline-light:hover { background: var(--bg-page); color: var(--text); border-color: var(--border-hover); }

.hero-section {
    background: var(--primary); color: #fff;
    padding: 64px 0; text-align: center;
}
.hero-section h1 {
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    color: #fff; margin-bottom: 10px;
}
.hero-subtitle {
    font-size: 15px; font-weight: 400;
    opacity: .9; max-width: 480px;
    margin: 0 auto 28px;
}
@media (max-width:767.98px) { .hero-section { padding: 40px 16px; } }

.features-section { padding: 48px 0; background: #fff; }
.feature-card { text-align: center; padding: 24px 16px; }
.feature-icon { font-size: 36px; margin-bottom: 10px; color: var(--primary); }
.feature-card h3 { margin-bottom: 6px; }
.feature-card p { color: var(--text-2); font-size: 13px; }

/* ── Auth pages ── */
.auth-body {
    background: var(--bg-page);
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
}

.auth-container { width: 100%; max-width: 380px; padding: 20px; }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-link { display: inline-flex; align-items: center; justify-content: center; }

.auth-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}
.auth-card h2 { text-align: center; margin-bottom: 20px; }

.auth-footer { display: flex; justify-content: center; gap: 16px; margin-top: 20px; }
.auth-footer a { color: var(--text-3); font-size: 12px; font-weight: 500; }
.auth-footer a:hover { color: var(--text-2); }

.pin-input {
    text-align: center; font-weight: 700;
    font-size: 1.8rem; letter-spacing: .35em; padding: 14px;
}

/* ── Flash ── */
.flash-container {
    position: fixed; top: calc(var(--nav-h) + 8px); right: 16px;
    z-index: 1050; max-width: 360px;
}
.flash-alert {
    border: none; border-radius: var(--radius-sm);
    font-weight: 500; font-size: 13px;
    animation: slideIn .25s ease;
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ── Stats ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 10px;
    text-align: center;
}

.stat-value {
    font-weight: 700; font-size: 1.6rem;
    line-height: 1; color: var(--primary);
}

.stat-label {
    font-size: 10px; font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-top: 4px;
}

/* ── Stat Bar (single-row stats) ── */
.stat-bar {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 4px;
    gap: 0;
}
.stat-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
}
.stat-bar-divider {
    width: 1px;
    height: 28px;
    background: var(--border);
    flex-shrink: 0;
}
.stat-bar-value {
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}
.stat-bar-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .07em;
}
.stat-bar-trend {
    font-size: 11px;
    font-weight: 700;
    color: var(--green, #22c55e);
}

/* ── Progress ── */
.progress-bar-sc {
    height: 8px; background: var(--border);
    border-radius: 3px; overflow: hidden;
}
.progress-bar-sc .fill {
    height: 100%; border-radius: 3px;
    background: var(--primary);
    transition: width .4s ease;
}

/* ── Footer ── */
.app-footer {
    border-top: 1px solid var(--border);
    padding: 20px 0; text-align: center;
    background: #fff;
}
@media (max-width:767.98px) {
    .app-footer { display: none; }
}
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-bottom: 6px; padding: 0 12px; }
.footer-links a { color: var(--text-3); font-size: 12px; font-weight: 500; text-decoration: none; padding: 2px 0; white-space: nowrap; }
.footer-links a:hover { color: var(--text); }
.footer-copy { color: var(--text-3); font-size: 12px; margin: 0; }

.guest-footer { background: #1a1a1a; color: #fff; padding: 40px 0 20px; }
.guest-footer a { color: rgba(255,255,255,.55); display: block; font-size: 13px; margin-bottom: 6px; }
.guest-footer a:hover { color: #fff; }
.footer-heading {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .1em;
    margin-bottom: 12px; color: rgba(255,255,255,.3);
}
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.08);
    padding-top: 20px; margin-top: 20px;
}
.footer-bottom p { color: rgba(255,255,255,.3); font-size: 12px; margin: 0; }

/* ── Utility ── */

/* Select arrow */
select.form-control {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8.5L1 3.5h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
}

/* Password toggle wrapper */
.password-wrapper {
    position: relative;
}
.password-wrapper .form-control {
    padding-right: 44px;
}
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    font-size: 15px;
    padding: 0;
    line-height: 1;
}
.password-toggle:hover {
    color: var(--text-2);
}
.text-muted { color: var(--text-3) !important; }
.text-success { color: var(--green) !important; }
.text-warning { color: var(--orange) !important; }
.text-danger { color: var(--red) !important; }
.text-primary { color: var(--primary) !important; }
.streak-fire { color: var(--accent); }

/* ── Responsive ── */
@media (max-width:767.98px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.2rem; }
    .card { padding: 14px; }
    .stats-grid { grid-template-columns: repeat(2,1fr); }
    .flash-container { top: 8px; left: 8px; right: 8px; max-width: 100%; }
}

/* ── Gochi Hand display headings ── */
.gochi-blue,
.gochi-green,
.gochi-red,
.gochi-black {
    font-family: 'Gochi Hand', cursive;
    font-weight: 400;
    line-height: 1.1;
}
.gochi-blue  { color: #0a6aae; text-shadow: 0 0 5px #fff, 0 0 5px #fff, 0 0 5px #fff; }
.gochi-green { color: #22c55e; text-shadow: 0 0 5px #fff, 0 0 5px #fff, 0 0 5px #fff; }
.gochi-red   { color: #ef4444; text-shadow: 0 0 5px #fff, 0 0 5px #fff, 0 0 5px #fff; }
.gochi-black { color: #000000; text-shadow: 0 0 5px #fff, 0 0 5px #fff, 0 0 5px #fff; }

/* ── Google OAuth button ── */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    background: #fff;
    color: #3c4043;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    margin-bottom: 16px;
}
.btn-google:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
    color: #3c4043;
    text-decoration: none;
}
.auth-divider {
    position: relative;
    text-align: center;
    margin: 16px 0;
    color: var(--text-4);
    font-size: 12px;
}
.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}
.auth-divider span {
    position: relative;
    background: var(--bg);
    padding: 0 10px;
}
