/* ═══════════════════════════════════════════════════════════
   style.css  —  Shared dark theme for Wordle Maker
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Space+Mono:wght@400;700&display=swap');

:root {
    --bg:        #0f0f1a;
    --surface:   #1a1a2e;
    --surface2:  #16213e;
    --surface3:  #0d3b66;
    --accent:    #e94560;
    --accent2:   #f5a623;
    --accent3:   #50fa7b;
    --text:      #e8e8f0;
    --text-muted:#8888aa;
    --border:    #2a2a4a;
    --correct:   #50fa7b;
    --present:   #f5a623;
    --absent:    #44475a;
    --radius:    12px;
    --shadow:    0 8px 32px rgba(0,0,0,.4);
    --transition:.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(233,69,96,.07) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 20%, rgba(80,250,123,.05) 0%, transparent 55%);
}

/* ─── HEADER ─── */
.header {
    background: rgba(26,26,46,.96);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 1000;
}
.main-menu {
    max-width: 1200px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; height: 62px;
}
.logo-link {
    display: flex; align-items: center; gap: 10px; text-decoration: none;
    font-family: 'Space Mono', monospace; font-weight: 700; font-size: 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.logo-link img { width: 24px; }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-btn {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 700;
    text-decoration: none; transition: var(--transition); border: none; cursor: pointer;
    font-family: 'Nunito', sans-serif; width: auto; margin: 0;
}
.nav-btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.nav-btn-ghost:hover { border-color: var(--accent); color: var(--text); }
.nav-btn-solid { background: var(--accent); color: #fff; }
.nav-btn-solid:hover { background: #c0392b; }
.nav-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent); cursor: pointer; }

/* Hamburger */
.hamburger {
    background: none; border: none; color: var(--text); font-size: 26px;
    cursor: pointer; width: auto; margin: 0; padding: 4px 8px; line-height: 1;
}

/* ─── SIDENAV ─── */
.sidenav {
    height: 100%; width: 0; position: fixed; z-index: 99999; top: 0; left: 0;
    background: var(--surface); border-right: 1px solid var(--border);
    overflow-x: hidden; transition: .3s ease; padding-top: 62px;
}
.sidenav a, .sidenav .nav-section-label {
    display: block; padding: 12px 28px; text-decoration: none;
    font-size: 15px; color: var(--text-muted); transition: var(--transition);
    border-left: 3px solid transparent;
}
.sidenav a:hover { color: var(--accent); border-left-color: var(--accent); background: rgba(233,69,96,.05); }
.sidenav .closebtn { position: absolute; top: 12px; right: 22px; font-size: 28px; color: var(--text-muted); }
.nav-section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; padding-top: 20px; opacity: .5; }

/* ─── PAGE WRAP ─── */
.page-wrap { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }

/* ─── CARDS ─── */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.card-header {
    padding: 16px 20px; background: var(--surface2); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
    font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted);
}
.card-header .icon { font-size: 17px; }
.card-body { padding: 20px; }
.card-title { font-size: 20px; font-weight: 800; margin-bottom: 4px; }

/* Scrollable panels */
.scrollable { overflow-y: auto; }
.scrollable::-webkit-scrollbar { width: 4px; }
.scrollable::-webkit-scrollbar-track { background: transparent; }
.scrollable::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ─── BUTTONS ─── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 22px; border-radius: 10px; font-family: 'Nunito', sans-serif;
    font-size: 15px; font-weight: 800; cursor: pointer; transition: var(--transition);
    border: none; text-decoration: none; letter-spacing: .2px; width: 100%;
    margin-bottom: 10px; line-height: 1;
}
.btn-primary  { background: linear-gradient(135deg, var(--accent), #c0392b); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(233,69,96,.4); }
.btn-success  { background: linear-gradient(135deg, var(--accent3), #27ae60); color: #0f0f1a; }
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(80,250,123,.35); }
.btn-secondary { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--text); }
.btn-danger   { background: rgba(233,69,96,.15); color: var(--accent); border: 1px solid rgba(233,69,96,.3); }
.btn-danger:hover { background: var(--accent); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 13px; width: auto; margin: 0; }

/* ─── FORM ELEMENTS ─── */
.input-group { margin-bottom: 18px; }
.form-label {
    display: block; margin-bottom: 7px; font-weight: 700; font-size: 12px;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: .6px;
}
.form-control {
    width: 100%; padding: 13px 16px; background: var(--surface2); border: 1px solid var(--border);
    border-radius: 10px; font-size: 15px; color: var(--text); font-family: 'Nunito', sans-serif;
    transition: border-color var(--transition), box-shadow var(--transition); outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(233,69,96,.15); }
.form-control.mono { font-family: 'Space Mono', monospace; text-transform: uppercase; letter-spacing: 2px; }
.form-control.otp-input { font-size: 32px; text-align: center; letter-spacing: 12px; font-family: 'Space Mono', monospace; }
select.form-control { cursor: pointer; }

.checkbox-wrap { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.checkbox-wrap input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* ─── ALERTS ─── */
.alert { padding: 13px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; font-weight: 600; }
.alert-error   { background: rgba(233,69,96,.1); color: var(--accent); border: 1px solid rgba(233,69,96,.3); }
.alert-success { background: rgba(80,250,123,.1); color: var(--accent3); border: 1px solid rgba(80,250,123,.3); }
.alert-info    { background: rgba(245,166,35,.1);  color: var(--accent2); border: 1px solid rgba(245,166,35,.3); }

/* ─── GRID LAYOUT (game page) ─── */
.layout {
    display: grid;
    grid-template-columns: 270px 1fr 270px;
    gap: 20px; margin-bottom: 28px; align-items: start;
}
@media (max-width: 1100px) {
    .layout { grid-template-columns: 1fr 1fr; }
    .main-col { grid-column: 1 / -1; order: -1; }
}
@media (max-width: 640px) {
    .layout { grid-template-columns: 1fr; }
}

/* ─── GAME BOARD ─── */
.game-board { display: flex; flex-direction: column; gap: 8px; align-items: center; margin: 20px 0; }
.guess-row  { display: flex; gap: 8px; justify-content: center; }
.letter-box {
    flex: 1 1 58px; aspect-ratio: 1; max-width: 68px; min-width: 42px;
    border: 2px solid var(--border); border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Space Mono', monospace; font-size: clamp(18px, 3.5vw, 26px); font-weight: 700;
    text-transform: uppercase; color: var(--text); background: var(--surface2);
    transition: border-color .15s; caret-color: transparent; outline: none;
}
.letter-box:focus { border-color: var(--accent); }
.letter-box.correct { background: var(--correct); border-color: var(--correct); color: #0f0f1a; }
.letter-box.present { background: var(--present); border-color: var(--present); color: #0f0f1a; }
.letter-box.absent  { background: var(--absent);  border-color: var(--absent);  color: #888; }

/* ─── HISTORY / SIDEBAR ITEMS ─── */
.history-item {
    padding: 12px; border-radius: 10px; margin-bottom: 8px;
    background: var(--surface2); border: 1px solid var(--border);
    cursor: pointer; transition: border-color .2s, background .2s;
    position: relative; display: flex; align-items: center; gap: 10px; font-size: 13px;
}
.history-item:hover { border-color: var(--accent); background: rgba(233,69,96,.05); }
.history-item img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); flex-shrink: 0; }
.history-item .word { font-family: 'Space Mono', monospace; font-weight: 700; font-size: 14px; color: var(--text); }
.history-item .meta { color: var(--text-muted); font-size: 11px; margin-left: auto; text-align: right; line-height: 1.5; }
.badge-won  { color: var(--correct); font-weight: 800; }
.badge-lost { color: var(--accent);  font-weight: 800; }

.delete-btn {
    position: absolute; top: 6px; right: 6px;
    background: transparent; border: none; color: var(--border);
    cursor: pointer; font-size: 15px; width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center; border-radius: 50%;
    margin: 0; padding: 0; transition: var(--transition);
}
.delete-btn:hover { background: var(--accent); color: #fff; }

/* ─── TODAY'S PUZZLES ─── */
.today-section {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 24px;
}
.today-header {
    padding: 18px 24px; background: linear-gradient(135deg, rgba(233,69,96,.12), rgba(245,166,35,.08));
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.today-header h3 { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.live-badge {
    background: var(--accent); color: #fff; font-size: 11px; font-weight: 800;
    padding: 3px 10px; border-radius: 20px; text-transform: uppercase; letter-spacing: .5px;
    animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{ opacity:1; } 50%{ opacity:.65; } }
.today-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px; padding: 20px; max-height: 320px; overflow-y: auto;
}
.today-card {
    background: var(--surface2); border: 1px solid var(--border); border-radius: 10px;
    padding: 14px; text-decoration: none; color: var(--text); transition: all .2s;
    display: flex; align-items: center; gap: 12px;
}
.today-card:hover { border-color: var(--accent2); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.today-card-icon { font-size: 28px; line-height: 1; }
.today-card-title { font-weight: 700; font-size: 14px; }
.today-card-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; display: flex; gap: 10px; }
.today-card-creator { display: flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.today-card-creator img { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; }

/* ─── LEADERBOARD ─── */
.lb-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 24px; }
.lb-header {
    padding: 18px 24px; background: linear-gradient(135deg, rgba(80,250,123,.08), transparent);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.lb-header h3 { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.period-tabs { display: flex; gap: 4px; background: var(--surface2); border-radius: 8px; padding: 4px; }
.period-tab {
    padding: 6px 13px; border-radius: 6px; font-size: 12px; font-weight: 700;
    cursor: pointer; transition: all .2s; background: transparent; border: none;
    color: var(--text-muted); width: auto; margin: 0; text-transform: uppercase; letter-spacing: .4px;
    font-family: 'Nunito', sans-serif;
}
.period-tab.active { background: var(--accent3); color: #0f0f1a; }
.period-tab:hover:not(.active) { color: var(--text); }
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th { background: var(--surface2); padding: 12px 16px; text-align: left; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); font-weight: 700; }
.lb-table td { padding: 12px 16px; border-bottom: 1px solid rgba(42,42,74,.5); font-size: 14px; vertical-align: middle; }
.lb-table tr:last-child td { border-bottom: none; }
.lb-table tr:hover td { background: rgba(233,69,96,.04); }
.rank-badge { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; font-family: 'Space Mono', monospace; }
.rank-1 { background: linear-gradient(135deg,#ffd700,#f4a942); color: #0f0f1a; }
.rank-2 { background: linear-gradient(135deg,#c0c0c0,#999); color: #0f0f1a; }
.rank-3 { background: linear-gradient(135deg,#cd7f32,#a0522d); color: #fff; }
.rank-other { background: var(--surface3); color: var(--text-muted); }
.player-cell { display: flex; align-items: center; gap: 10px; }
.player-cell img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.win-bar { height: 5px; background: var(--surface3); border-radius: 3px; margin-top: 3px; overflow: hidden; width: 70px; }
.win-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent3), var(--accent2)); border-radius: 3px; transition: width 1s ease; }

/* ─── PUBLIC PUZZLES ─── */
.public-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 24px; }
.public-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; padding: 16px; max-height: 380px; overflow-y: auto; }
.public-card {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    background: var(--surface2); border: 1px solid var(--border); border-left: 3px solid var(--accent);
    border-radius: 10px; text-decoration: none; color: var(--text); font-size: 13px; font-weight: 600;
    transition: all .2s;
}
.public-card:hover { border-color: var(--accent2); transform: translateX(2px); }
.creator-pill { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); margin-left: auto; }
.creator-pill img { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; }

/* ─── MODALS ─── */
.modal-overlay {
    position: fixed; top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,.75); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center; z-index: 10000;
}
.modal-overlay.hidden { display: none !important; }
.modal-box {
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    padding: 30px; max-width: 520px; width: 90%; max-height: 88vh; overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,.6);
}
.modal-box h2 { margin-bottom: 20px; font-size: 22px; color: var(--accent); text-align: center; }

/* ─── GAME OVER MODAL ─── */
.game-over-content { text-align: center; }
.game-over-icon { font-size: 56px; margin-bottom: 12px; }
.game-over-word { font-family: 'Space Mono', monospace; font-size: 28px; font-weight: 700; color: var(--accent2); letter-spacing: 4px; padding: 12px 0; }

/* ─── STATS GRID ─── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; margin: 16px 0; }
.stat-item { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 14px; text-align: center; }
.stat-value { font-family: 'Space Mono', monospace; font-size: 22px; font-weight: 700; color: var(--accent2); }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }

/* ─── SHARE BOX ─── */
.success-box { text-align: center; padding: 20px; background: rgba(80,250,123,.07); border: 1px solid rgba(80,250,123,.2); border-radius: 12px; margin-bottom: 20px; }
.success-box .icon { font-size: 48px; margin-bottom: 10px; }
.share-link { background: var(--surface2); border: 2px dashed var(--accent); border-radius: 10px; padding: 14px 16px; word-break: break-all; font-family: 'Space Mono', monospace; font-size: 13px; color: var(--accent2); margin: 14px 0; }

/* ─── SOLVER LIST (stats screen) ─── */
.solver-item { background: var(--surface2); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 10px; padding: 14px; margin-bottom: 10px; }
.solver-name { font-weight: 700; margin-bottom: 4px; }
.solver-details { color: var(--text-muted); font-size: 13px; }
.solver-status { display: inline-block; padding: 3px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; margin-top: 6px; }
.solver-status.solved { background: rgba(80,250,123,.15); color: var(--correct); }
.solver-status.failed { background: rgba(233,69,96,.15); color: var(--accent); }

/* ─── CONTENT PROSE ─── */
.prose { max-width: 1200px; margin: 0 auto 40px; padding: 0 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.prose h2 { font-size: 20px; padding: 22px 24px 12px; border-bottom: 1px solid var(--border); }
.prose h3 { padding: 16px 24px 4px; font-size: 15px; color: var(--accent2); }
.prose p, .prose li { padding: 6px 24px; font-size: 15px; color: var(--text-muted); line-height: 1.8; }
.prose ul { padding-left: 44px; margin-bottom: 10px; }

/* ─── FOOTER ─── */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 40px 20px 20px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 40px; max-width: 1200px; margin: auto; }
.footer-inner h3, .footer-inner h4 { color: var(--text); margin-bottom: 12px; font-size: 16px; }
.footer-inner p { font-size: 14px; color: var(--text-muted); max-width: 280px; line-height: 1.7; }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: 14px; transition: color .2s; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom { text-align: center; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }

/* ─── UTILITIES ─── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-accent2{ color: var(--accent2); }
.text-accent3{ color: var(--accent3); }
.mono { font-family: 'Space Mono', monospace; }
.mb-0 { margin-bottom: 0 !important; }
.mt-8 { margin-top: 8px; }
.mt-16{ margin-top: 16px; }
.mt-24{ margin-top: 24px; }
.gap-10{ gap: 10px; }

/* Spinner */
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state { padding: 30px; text-align: center; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 36px; margin-bottom: 10px; }

/* Profile avatar (used in modal & page header) */
.avatar-lg { width: 90px; height: 90px; border-radius: 50%; display: block; margin: 0 auto 20px; object-fit: cover; border: 3px solid var(--accent); }
.avatar-md { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent); }

/* DB info box */
.db-info { background: rgba(80,250,123,.06); border: 1px solid rgba(80,250,123,.15); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; font-size: 13px; color: var(--text-muted); }
.db-info strong { color: var(--accent3); display: block; margin-bottom: 4px; }
.code-pill { font-family: 'Space Mono', monospace; font-size: 11px; color: var(--accent2); }

/* Page title gradient */
.page-title { font-size: 26px; text-align: center; margin-bottom: 6px; background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.page-subtitle { font-size: 14px; color: var(--text-muted); text-align: center; margin-bottom: 20px; }

/* Name input divider */
.or-divider { text-align: center; color: var(--text-muted); font-size: 13px; margin: 8px 0; }
