/* ═══════════════════════════════════════════════════════
   WORLD CLOCK — style.css  (v2 — Updated)
   Color: Navy · Teal (#0EA5E9) · White
   Font: Outfit + Space Mono
═══════════════════════════════════════════════════════ */

/* ── 1. CSS VARIABLES ─────────────────────────────────── */
:root {
  --accent:   #0EA5E9;
  --accent2:  #6366F1;
  --danger:   #EF4444;

  --bg:       #F8FAFC;
  --bg2:      #EFF6FF;
  --surface:  #FFFFFF;
  --border:   #E2E8F0;
  --text:     #0F172A;
  --text2:    #64748B;
  --shadow:   rgba(15,23,42,0.08);

  --font-ui:  'Outfit', sans-serif;
  --font-num: 'Space Mono', monospace;
  --radius:   14px;
  --radius-sm:8px;
}

/* Dark theme */
body.theme-dark,
body.theme-system.is-night {
  --bg:      #0B1120;
  --bg2:     #111827;
  --surface: #1E293B;
  --border:  #1E3A5F;
  --text:    #F1F5F9;
  --text2:   #94A3B8;
  --shadow:  rgba(0,0,0,0.35);
}

/* ── 2. RESET ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-ui);
  background:  var(--bg);
  color:       var(--text);
  min-height:  100vh;
  transition:  background 0.4s, color 0.4s;
  overflow-x:  hidden;
}

button { font-family: var(--font-ui); cursor: pointer; border: none; outline: none; background: none; }
input  { font-family: var(--font-ui); }

/* ── 3. NIGHT OVERLAY ─────────────────────────────────── */
.night-overlay {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.night-overlay.hidden { display: none; }
#stars-canvas-wrap { position: absolute; inset: 0; }
#stars-canvas { width: 100%; height: 100%; }
.moon {
  position: absolute; top: 60px; right: 80px;
  font-size: 72px; opacity: 0.55;
  animation: moonFloat 8s ease-in-out infinite;
  filter: drop-shadow(0 0 24px rgba(253,224,71,0.4));
}
@keyframes moonFloat {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-14px); }
}

/* ── 4. 🐦 SPARROW WINDOW — 10% bigger (64→71, 56→62) ── */
#sparrow-window {
  position: fixed;
  top: 16px; left: 16px;
  width: 71px;   /* was 64px → +10% */
  height: 62px;  /* was 56px → +10% */
  z-index: 100;
  cursor: pointer;
  user-select: none;
}
.window-frame {
  display: flex;
  width: 100%;
  height: 48px;  /* was 44px */
  border: 2.5px solid var(--accent);
  border-radius: 6px 6px 0 0;
  overflow: hidden;
  background: var(--surface);
  position: relative;
}
.window-pane {
  flex: 1;
  border: 1px solid var(--accent);
  background: rgba(14,165,233,0.07);
  transition: transform 0.3s ease;
}
.window-sill {
  height: 9px; /* was 8px */
  background: var(--accent);
  border-radius: 0 0 4px 4px;
  opacity: 0.7;
}
#sparrow {
  position: absolute;
  top: 5px; left: 50%;
  transform: translateX(-50%);
  font-size: 24px;  /* was 22px → +10% */
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 101;
  pointer-events: none;
}
#sparrow.visible { opacity: 1; }
#sparrow.flap { animation: sparrowFlap 1.2s ease-in-out; }
@keyframes sparrowFlap {
  0%   { transform: translateX(-50%) translateY(0) rotate(0deg); }
  20%  { transform: translateX(-50%) translateY(-8px) rotate(-10deg); }
  50%  { transform: translateX(-50%) translateY(-22px) rotate(10deg); }
  80%  { transform: translateX(-50%) translateY(-8px) rotate(-5deg); }
  100% { transform: translateX(-50%) translateY(0) rotate(0deg); }
}

/* ── 5. BELL ALERT ────────────────────────────────────── */
.bell-alert {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 28px 40px;
  text-align: center;
  z-index: 999;
  box-shadow: 0 24px 64px var(--shadow);
  animation: bellPop 0.4s cubic-bezier(.34,1.56,.64,1);
}
.bell-alert.hidden { display: none; }
@keyframes bellPop {
  from { transform: translate(-50%,-50%) scale(0.5); opacity: 0; }
  to   { transform: translate(-50%,-50%) scale(1);   opacity: 1; }
}
.bell-icon { font-size: 56px; animation: bellRing 0.5s infinite alternate; }
@keyframes bellRing {
  from { transform: rotate(-15deg); }
  to   { transform: rotate(15deg); }
}
.bell-alert span { display: block; font-size: 1.1rem; font-weight: 600; margin: 10px 0 16px; color: var(--text); }
#bell-dismiss {
  background: var(--accent); color: #fff;
  padding: 8px 24px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.95rem; transition: opacity 0.2s;
}
#bell-dismiss:hover { opacity: 0.85; }

/* ── 6. APP WRAPPER ───────────────────────────────────── */
.app-wrapper {
  position: relative; z-index: 1;
  max-width: 980px; margin: 0 auto;
  padding: 16px 20px 56px;
}

/* ── 7. TOP BAR ───────────────────────────────────────── */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0 12px;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 4px;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-icon { width: 28px; height: 28px; color: var(--accent); flex-shrink: 0; }
.app-title { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.5px; }
.header-center { text-align: center; }
.live-date { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 0.82rem; color: var(--text2); }
.live-date span:first-child { font-weight: 600; font-size: 0.95rem; color: var(--text); }

.theme-switcher {
  display: flex; gap: 4px;
  background: var(--bg2); border: 1.5px solid var(--border);
  border-radius: 30px; padding: 4px;
}
.theme-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); transition: background 0.2s, color 0.2s;
}
.theme-btn svg { width: 16px; height: 16px; }
.theme-btn:hover  { background: var(--surface); color: var(--text); }
.theme-btn.active { background: var(--accent); color: #fff; }

/* ── 8. TAB NAV ───────────────────────────────────────── */
.tab-nav {
  display: flex; gap: 4px;
  padding: 14px 0 0;
  overflow-x: auto; scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }
.tab-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 30px;
  font-size: 0.88rem; font-weight: 500;
  color: var(--text2); white-space: nowrap;
  transition: background 0.2s, color 0.2s;
  border: 1.5px solid transparent;
}
.tab-btn svg { width: 15px; height: 15px; }
.tab-btn:hover  { background: var(--bg2); color: var(--text); }
.tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── 9. TAB CONTENT ───────────────────────────────────── */
.tab-content { padding-top: 24px; }
.tab-content.hidden { display: none; }

/* ── 10. SECTION TITLES ───────────────────────────────── */
.section-title { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.section-title svg { width: 20px; height: 20px; color: var(--accent); }
.section-title h2  { font-size: 1.1rem; font-weight: 600; }

/* ── 11. CLOCK TAB ────────────────────────────────────── */
.welcome-strip {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 18px; margin-bottom: 24px;
}
.welcome-icon { width: 18px; height: 18px; color: var(--accent); }
#welcome-text { font-weight: 600; font-size: 1.02rem; }
.welcome-sub  { font-size: 0.85rem; color: var(--text2); }

/* Tick-tock toggle */
.tick-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.82rem; color: var(--text2);
  margin-bottom: 16px;
}
.tick-toggle input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.tick-toggle label { cursor: pointer; }

.clock-type-toggle, .format-toggle {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.type-btn, .fmt-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 18px; border-radius: 30px;
  font-size: 0.86rem; font-weight: 500;
  color: var(--text2); border: 1.5px solid var(--border);
  transition: all 0.2s;
}
.type-btn svg { width: 14px; height: 14px; }
.type-btn:hover, .fmt-btn:hover { border-color: var(--accent); color: var(--text); }
.type-btn.active, .fmt-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Digital clock */
.digital-clock {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px 32px;
  text-align: center;
  box-shadow: 0 4px 24px var(--shadow);
  margin-bottom: 24px;
}
.digital-time {
  font-family: var(--font-num);
  font-size: clamp(3rem, 12vw, 6rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -2px; line-height: 1;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.dig-ampm {
  font-size: 1.5rem; color: var(--accent); font-weight: 700;
  align-self: flex-end; padding-bottom: 8px; margin-left: 6px;
}
.blink { animation: blink 1s step-start infinite; }
@keyframes blink { 50% { opacity: 0; } }
.digital-timezone {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 14px; font-size: 0.88rem; color: var(--text2);
}
.tz-pin { width: 14px; height: 14px; color: var(--accent); }

/* Analog clock */
.analog-clock {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; margin-bottom: 24px;
}
#analog-canvas { filter: drop-shadow(0 4px 24px var(--shadow)); max-width: 300px; }
.analog-label  { display: flex; align-items: center; gap: 6px; font-size: 0.88rem; color: var(--text2); }

/* ── 12. WORLD CLOCK TAB ──────────────────────────────── */
.globe-section { margin-bottom: 32px; text-align: center; }

/* BIGGER globe container — no more clipping */
#globe-container {
  width: 100%;
  max-width: 560px;
  height: 420px;   /* was 320px — increased to prevent top/bottom clipping */
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg2);
  border: 1.5px solid var(--border);
  position: relative;
}
.globe-hint {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; font-size: 0.8rem; color: var(--text2); margin-top: 10px;
}
.globe-hint svg { width: 13px; height: 13px; }

.zone-search {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 20px;
}
.zone-search svg { width: 16px; height: 16px; color: var(--text2); flex-shrink: 0; }
#zone-search-input {
  border: none; outline: none; background: none;
  width: 100%; font-size: 0.92rem; color: var(--text);
}

.zones-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.zone-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  transition: border-color 0.2s, transform 0.2s;
}
.zone-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.zone-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.zone-name   { font-weight: 600; font-size: 0.95rem; }
.zone-offset { font-family: var(--font-num); font-size: 0.78rem; color: var(--accent); background: rgba(14,165,233,0.1); padding: 2px 8px; border-radius: 20px; font-weight: 700; }
.zone-time   { font-family: var(--font-num); font-size: 1.5rem; font-weight: 700; color: var(--text); margin: 6px 0 4px; }
.zone-desc   { font-size: 0.78rem; color: var(--text2); line-height: 1.5; }
.zone-countries { font-size: 0.75rem; color: var(--text2); margin-top: 5px; opacity: 0.8; }

/* ── 13. STOPWATCH TAB ────────────────────────────────── */
.sw-display {
  font-family: var(--font-num);
  font-size: clamp(2.8rem, 10vw, 5rem);
  font-weight: 700; text-align: center; color: var(--text);
  letter-spacing: -1px;
  padding: 28px 0 20px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); margin-bottom: 20px;
}
.sw-sep { color: var(--accent); }
.sw-ms  { font-size: 1.4rem; color: var(--text2); font-weight: 400; }

.sw-controls { display: flex; gap: 10px; justify-content: center; margin-bottom: 24px; }
.ctrl-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 22px; border-radius: 30px;
  font-size: 0.9rem; font-weight: 600;
  border: 2px solid var(--border); color: var(--text2);
  transition: all 0.2s;
}
.ctrl-btn svg    { width: 15px; height: 15px; }
.ctrl-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.ctrl-btn.primary  { background: var(--accent); color: #fff; border-color: var(--accent); }
.ctrl-btn.primary:hover { opacity: 0.88; }
.ctrl-btn.danger   { color: var(--danger); border-color: var(--danger); }
.ctrl-btn.danger:hover { background: var(--danger); color: #fff; }
.ctrl-btn.lap      { color: var(--accent2); border-color: var(--accent2); }
.ctrl-btn.lap:hover:not(:disabled) { background: var(--accent2); color: #fff; }
.ctrl-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.runner-scene {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; text-align: center;
}
#runner-canvas { width: 100%; max-width: 600px; height: 130px; display: block; margin: 0 auto; }
.road-label {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; font-size: 0.8rem; color: var(--text2); padding: 6px 0 10px;
}
.road-label svg { width: 13px; height: 13px; }

.lap-section { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.lap-list { width: 100%; max-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.lap-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px; font-size: 0.88rem;
}
.lap-label { color: var(--text2); }
.lap-time  { font-family: var(--font-num); font-weight: 700; color: var(--accent); }

/* ── 14. TIMER TAB ────────────────────────────────────── */
.timer-input-section { margin-bottom: 16px; }
.time-inputs {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin-bottom: 20px;
}
.time-input-group { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.time-input-group input {
  width: 80px; text-align: center;
  font-family: var(--font-num); font-size: 2rem; font-weight: 700;
  padding: 10px 4px;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); transition: border-color 0.2s;
}
.time-input-group input:focus { border-color: var(--accent); outline: none; }
.time-input-group label { font-size: 0.72rem; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; }
.ti-sep { font-size: 2rem; font-weight: 700; color: var(--accent); align-self: flex-start; padding-top: 10px; }

.bell-choice { text-align: center; }
.bell-choice label {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; font-size: 0.88rem; color: var(--text2); margin-bottom: 10px;
}
.bell-choice label svg { width: 14px; height: 14px; }
.bell-options { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.bell-opt {
  padding: 7px 16px; border-radius: 30px;
  border: 1.5px solid var(--border); font-size: 0.83rem; color: var(--text2); transition: all 0.2s;
}
.bell-opt:hover  { border-color: var(--accent); color: var(--text); }
.bell-opt.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.sand-timer-wrap { display: flex; justify-content: center; margin-bottom: 16px; }
#sand-canvas { border-radius: 8px; }

.timer-display {
  font-family: var(--font-num);
  font-size: clamp(2.8rem, 10vw, 5rem);
  font-weight: 700; text-align: center; color: var(--text);
  letter-spacing: -1px;
  padding: 28px 0 20px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); margin-bottom: 20px;
}
.timer-display.hidden { display: none; }

/* ── 15. CALENDAR TAB ─────────────────────────────────── */

/* Blurred background card wrapping the calendar */
.cal-blur-bg {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  padding: 20px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: 0 4px 24px var(--shadow);
}

/* The big blurred month/year label behind the dates */
#cal-bg-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(3rem, 10vw, 6.5rem);
  font-weight: 900;
  color: var(--accent);
  opacity: 0.055;   /* very subtle */
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  letter-spacing: -2px;
  filter: blur(3px);
  z-index: 0;
}

/* Calendar nav sits above the blur */
.cal-nav {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
  position: relative; z-index: 1;
}
.cal-nav-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); transition: all 0.2s;
}
.cal-nav-btn svg { width: 16px; height: 16px; }
.cal-nav-btn:hover { border-color: var(--accent); color: var(--accent); }
.cal-month-year { display: flex; gap: 8px; flex: 1; justify-content: center; }
.cal-month-year select {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 10px;
  font-size: 0.9rem; font-family: var(--font-ui); color: var(--text); cursor: pointer;
}
.cal-today-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: 30px;
  border: 1.5px solid var(--accent); color: var(--accent);
  font-size: 0.83rem; font-weight: 600; transition: all 0.2s;
}
.cal-today-btn svg { width: 13px; height: 13px; }
.cal-today-btn:hover { background: var(--accent); color: #fff; }

.cal-day-headers {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px; margin-bottom: 6px; text-align: center;
  position: relative; z-index: 1;
}
.cal-day-headers span {
  font-size: 0.75rem; font-weight: 600; color: var(--text2);
  text-transform: uppercase; padding: 4px 0;
}

/* BIGGER calendar date numbers */
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px; margin-bottom: 16px;
  position: relative; z-index: 1;
}
.cal-cell {
  aspect-ratio: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;   /* was 0.88rem — bigger numbers */
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border: 1.5px solid transparent;
  min-width: 0; min-height: 0;
  padding: 2px;
  position: relative;
}
.cal-day-num {
  font-size: 1.1rem;  /* large date number */
  font-weight: 600;
  line-height: 1;
}
/* Girl emoji inside a cell */
.cal-girl {
  font-size: 0.75rem;
  line-height: 1;
  display: block;
}
.cal-cell:hover     { background: var(--bg2); border-color: var(--border); }
.cal-cell.empty     { cursor: default; }
.cal-cell.other-month { color: var(--text2); opacity: 0.35; }
.cal-cell.today     { background: var(--accent); color: #fff; font-weight: 700; }
.cal-cell.selected  { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.cal-cell.sunday    { color: var(--danger); }
.cal-cell.today .cal-girl { filter: grayscale(0); }

.cal-selected-info {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-left: 4px solid var(--accent2);
  border-radius: var(--radius-sm); padding: 12px 16px;
  font-size: 0.88rem; color: var(--text2);
  position: relative; z-index: 1;
}
.cal-selected-info svg { width: 14px; height: 14px; color: var(--accent2); flex-shrink: 0; }

/* ── 16. TIME INFO PANEL (calendar tab) ───────────────── */
#time-info-panel {
  margin-top: 28px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.time-info-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 1rem; font-weight: 700; color: var(--text);
  margin-bottom: 16px;
  border-bottom: 1.5px solid var(--border);
  padding-bottom: 12px;
}
.time-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.time-info-card {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
  transition: border-color 0.2s, transform 0.2s;
}
.time-info-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.ti-icon  { font-size: 1.4rem; margin-bottom: 4px; }
.ti-value { font-family: var(--font-num); font-size: 1.2rem; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.ti-label { font-size: 0.72rem; color: var(--text2); line-height: 1.3; margin-bottom: 2px; }
.ti-sub   { font-size: 0.68rem; color: var(--text2); opacity: 0.7; }

/* ── 17. RESPONSIVE ───────────────────────────────────── */
@media (max-width: 600px) {
  .top-bar { flex-wrap: wrap; gap: 10px; }
  .header-center { order: 3; width: 100%; }
  .app-title { font-size: 1.3rem; }
  .digital-time { font-size: 3rem; }
  .zones-grid { grid-template-columns: 1fr; }
  .time-inputs { gap: 6px; }
  .time-input-group input { width: 64px; font-size: 1.5rem; }
  #globe-container { height: 300px; }
  .time-info-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── 18. SCROLLBAR ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
