/* ============ DAY THEME OVERRIDE ============
   style.css is untouched; this file re-skins the same classes when
   html[data-theme="day"] is set, and adds new components (auth,
   nav, difficulty grid, tables, toggle, topbar) in the same visual
   language (Fredoka/Nunito, glass cards, purple/pink/cyan gradients). */

/* ============ PASSWORD INPUT (style.css only themed type="text") ============ */
input[type="password"] {
  font-family: 'Nunito', sans-serif; font-size: 18px; padding: 12px 16px; border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.06);
  color: #fff; width: 100%; outline: none; transition: border-color 0.2s;
}
input[type="password"]:focus { border-color: #a855f7; }

html[data-theme="day"] body {
  background: #eef1fb;
  color: #211d3a;
}
html[data-theme="day"] .bg-animation {
  background:
    radial-gradient(circle at 20% 20%, rgba(147, 51, 234, 0.10) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.07) 0%, transparent 50%);
}
html[data-theme="day"] .card {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(33, 29, 58, 0.08);
  box-shadow: 0 8px 32px rgba(80, 60, 150, 0.12);
}
html[data-theme="day"] .subtitle,
html[data-theme="day"] .set-hint,
html[data-theme="day"] .waiting-hint,
html[data-theme="day"] .room-label,
html[data-theme="day"] .set-status,
html[data-theme="day"] .history-header,
html[data-theme="day"] .modal-hint,
html[data-theme="day"] .secret-reveal p,
html[data-theme="day"] .input-group label,
html[data-theme="day"] .divider { color: rgba(33, 29, 58, 0.55); }
html[data-theme="day"] .divider::before,
html[data-theme="day"] .divider::after { background: rgba(33, 29, 58, 0.12); }
html[data-theme="day"] input[type="text"],
html[data-theme="day"] input[type="password"] {
  background: rgba(33, 29, 58, 0.05);
  border-color: rgba(33, 29, 58, 0.12);
  color: #211d3a;
}
html[data-theme="day"] .digit-box {
  background: rgba(33, 29, 58, 0.05);
  border-color: rgba(33, 29, 58, 0.14);
  color: #211d3a;
}
html[data-theme="day"] .digit-box.filled {
  background: rgba(168, 85, 247, 0.10);
  border-color: rgba(168, 85, 247, 0.5);
}
html[data-theme="day"] .btn-ghost {
  background: rgba(33, 29, 58, 0.06);
  color: rgba(33, 29, 58, 0.7);
  border-color: rgba(33, 29, 58, 0.12);
}
html[data-theme="day"] .btn-ghost:hover { background: rgba(33, 29, 58, 0.12); color: #211d3a; }
html[data-theme="day"] .game-header,
html[data-theme="day"] .guess-area,
html[data-theme="day"] .secret-reveal,
html[data-theme="day"] .history-item,
html[data-theme="day"] .np-btn { background: rgba(33, 29, 58, 0.05); color: #211d3a; }
html[data-theme="day"] .np-clear { color: rgba(33, 29, 58, 0.45); }
html[data-theme="day"] .stat-badge,
html[data-theme="day"] .turn-counter { background: rgba(33, 29, 58, 0.06); color: rgba(33, 29, 58, 0.65); border-color: rgba(33, 29, 58, 0.1); }
html[data-theme="day"] .turn-banner.waiting { background: rgba(33, 29, 58, 0.04); border-color: rgba(33, 29, 58, 0.08); color: rgba(33, 29, 58, 0.55); }
html[data-theme="day"] .history-empty { color: rgba(33, 29, 58, 0.3); }
html[data-theme="day"] .secret-reveal strong { color: #211d3a; }
html[data-theme="day"] .modal-card { background: linear-gradient(135deg, #ffffff, #f3eefc); border-color: rgba(33,29,58,0.1); }
html[data-theme="day"] .modal-close { color: rgba(33, 29, 58, 0.4); }
html[data-theme="day"] .modal-close:hover { color: #211d3a; background: rgba(33,29,58,0.08); }

/* ============ TOPBAR ============ */
.topbar-pill {
  position: fixed; top: 16px; right: 16px; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.06); backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 999px;
  padding: 8px 14px; font-family: 'Nunito', sans-serif;
}
html[data-theme="day"] .topbar-pill { background: rgba(255,255,255,0.8); border-color: rgba(33,29,58,0.08); }
#whoami { font-weight: 700; font-size: 13px; color: rgba(255,255,255,0.8); }
html[data-theme="day"] #whoami { color: #211d3a; }
.pill-btn {
  background: rgba(255,255,255,0.1); border: none; color: inherit; cursor: pointer;
  border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 700;
  font-family: 'Nunito', sans-serif; transition: transform .15s, background .15s;
}
.pill-btn:hover { transform: translateY(-1px); background: rgba(255,255,255,0.2); }
html[data-theme="day"] .pill-btn { background: rgba(33,29,58,0.08); }
html[data-theme="day"] .pill-btn:hover { background: rgba(33,29,58,0.14); }

/* ============ AUTH TABS ============ */
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; padding: 10px; border: none; border-radius: 12px; cursor: pointer;
  background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.6);
  font-family: 'Fredoka', sans-serif; font-weight: 600; transition: all .2s;
}
html[data-theme="day"] .auth-tab { background: rgba(33,29,58,0.06); color: rgba(33,29,58,0.55); }
.auth-tab.active { background: linear-gradient(135deg, #a855f7, #ec4899); color: #fff; }
.auth-err { color: #f87171; font-size: 13px; min-height: 18px; margin-top: 6px; text-align: center; }
.auth-form { display: flex; flex-direction: column; }

/* ============ NAV PILLS ============ */
.nav-pills { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.nav-pill {
  padding: 9px 16px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.65);
  font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 14px; cursor: pointer;
  transition: all .2s;
}
html[data-theme="day"] .nav-pill { background: rgba(33,29,58,0.05); border-color: rgba(33,29,58,0.1); color: rgba(33,29,58,0.6); }
.nav-pill.active { background: linear-gradient(135deg, #a855f7, #ec4899); color: #fff; border-color: transparent; box-shadow: 0 4px 16px rgba(168,85,247,0.35); }
.lobby-pane { max-width: 520px; margin: 0 auto; }
.pane-title { font-family: 'Fredoka', sans-serif; font-size: 20px; margin-bottom: 16px; }

/* ============ DIFFICULTY GRID ============ */
.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.diff-card {
  background: rgba(255,255,255,0.06); border: 2px solid rgba(255,255,255,0.1); border-radius: 14px;
  padding: 14px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; color: #fff;
  font-family: 'Nunito', sans-serif; transition: all .2s; text-align: left;
}
html[data-theme="day"] .diff-card { background: rgba(33,29,58,0.05); border-color: rgba(33,29,58,0.12); color: #211d3a; }
.diff-card b { font-family: 'Fredoka', sans-serif; font-size: 16px; }
.diff-card span { font-size: 12px; color: rgba(255,255,255,0.5); }
html[data-theme="day"] .diff-card span { color: rgba(33,29,58,0.5); }
.diff-card:hover { transform: translateY(-2px); border-color: rgba(168,85,247,0.4); }
.diff-card.selected {
  border-color: #a855f7; background: linear-gradient(135deg, rgba(168,85,247,0.18), rgba(236,72,153,0.12));
  box-shadow: 0 0 0 3px rgba(168,85,247,0.25);
}

/* ============ DATA TABLES ============ */
.data-table { width: 100%; border-collapse: collapse; font-family: 'Nunito', sans-serif; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 14px; }
html[data-theme="day"] .data-table th, html[data-theme="day"] .data-table td { border-color: rgba(33,29,58,0.08); }
.data-table th { color: rgba(255,255,255,0.5); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
html[data-theme="day"] .data-table th { color: rgba(33,29,58,0.5); }
.data-table tbody tr:hover { background: rgba(255,255,255,0.04); }
html[data-theme="day"] .data-table tbody tr:hover { background: rgba(33,29,58,0.03); }
.promote-btn {
  background: rgba(168,85,247,0.15); color: #c084fc; border: 1px solid rgba(168,85,247,0.3);
  border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: 'Nunito', sans-serif;
}
.promote-btn:hover { background: rgba(168,85,247,0.28); }

/* ============ GUESS-HISTORY TOGGLE ============ */
.history-toggle-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: rgba(255,255,255,0.15); border-radius: 999px; cursor: pointer; transition: .2s; }
html[data-theme="day"] .switch .slider { background: rgba(33,29,58,0.15); }
.switch .slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: linear-gradient(135deg, #a855f7, #ec4899); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ============ DUPLICATE GUESS SHAKE ============ */
.digit-input-row.shake-alert { animation: shakeRow .5s ease; }
@keyframes shakeRow {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}
.digit-box.dup-flash { border-color: #ef4444 !important; box-shadow: 0 0 16px rgba(239,68,68,0.5) !important; }

/* ============ LONG CODE SUPPORT (Difficult/Extreme) ============ */
.digit-input-row { flex-wrap: wrap; }
.digit-input-row.len-8 .digit-box,
.digit-input-row.len-16 .digit-box { width: 40px; height: 48px; font-size: 20px !important; border-radius: 10px; }
.digit-input-row.len-16 .digit-box { width: 32px; height: 40px; font-size: 16px !important; gap: 4px; }
.digit-input-row.len-8, .digit-input-row.len-16 { gap: 6px; }

/* ============ GAMEOVER DRAW STATE ============ */
.gameover-card.draw h2 { color: #fbbf24; }

.np-zero { grid-column: 2; }
.np-actions { display: flex; gap: 8px; margin-top: 10px; }
.np-action-btn { flex: 1; font-size: 13px !important; padding: 10px !important; border-radius: 10px !important; }

/* real <input> digit boxes (clickable/typeable), themed to match the original span-based look */
input.digit-box { cursor: text; }
input.digit-box:disabled { opacity: .45; cursor: not-allowed; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.custom-config { margin: -8px 0 16px; }
.custom-config input[type="number"] {
  font-family: 'Nunito', sans-serif; font-size: 16px; padding: 10px 14px; border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.06); color: #fff; width: 100%; outline: none;
}
html[data-theme="day"] .custom-config input[type="number"] { background: rgba(33,29,58,0.05); border-color: rgba(33,29,58,0.12); color: #211d3a; }
.admin-new-user { margin-bottom: 14px; }
.admin-new-user input { flex: 1; min-width: 120px; }
.danger-btn { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: 'Nunito', sans-serif; margin-left: 4px; }
.danger-btn:hover { background: rgba(239,68,68,0.28); }

/* ============ DESKTOP WIDTH ============
   style.css caps .container at 520px, which squeezes the two-column game
   screen. Widen the container on desktop and re-center the narrow screens. */
@media (min-width: 900px) {
  .container { max-width: 1060px; }
  #screen-auth, #screen-waiting, #screen-set-number, #screen-gameover { max-width: 560px; margin: 0 auto; }
  #screen-game .game-content { gap: 24px; align-items: stretch; }
  #screen-game .game-left { flex: 0 0 420px; }
  #screen-game .game-right { flex: 1; display: flex; flex-direction: column; }
  #screen-game .history-list { max-height: none; flex: 1; min-height: 360px; }
  #screen-game .num-pad { max-width: 300px; }
  #screen-game .guess-area { padding: 28px; }
}
@media (min-width: 900px) {
  #screen-set-number .num-pad { max-width: 300px; }
}

.hidden { display: none !important; }

@media (max-width: 480px) {
  .diff-grid { grid-template-columns: 1fr; }
  .topbar-pill { top: 8px; right: 8px; padding: 6px 10px; gap: 6px; }
  #whoami { display: none; }
}
