/* ══════════════════════════════════════════
   BIRD CLOCK — Global Styles
══════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;900&display=swap');

:root {
  --sky: #0e1b2a;
  --sky2: #1a2e44;
  --dawn: #e8a45a;
  --leaf: #4caf79;
  --feather: #7ecbf5;
  --cream: #f5f0e8;
  --muted: #8ba8c4;
  --card: rgba(255,255,255,0.06);
  --card-border: rgba(255,255,255,0.12);
  --accent: #f0c040;
  --danger: #e05b5b;
  --radius: 20px;
  --font: 'Nunito', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: linear-gradient(160deg, var(--sky) 0%, #0a2233 60%, #051018 100%);
  color: var(--cream);
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
}

/* ── Floating feather bg ── */
.bg-feathers {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  overflow: hidden;
}
.feather-particle {
  position: absolute;
  font-size: 1.4rem;
  opacity: 0.18;
  --dx: 0px;
  animation: floatFeather linear infinite;
}
.btn-icon {
  vertical-align: middle;
  margin-right: 0.25em;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes floatFeather {
  0%   { transform: translateY(110vh) translateX(0)                            rotate(0deg)   scale(0.8); opacity: 0; }
  8%   { opacity: 0.2; }
  50%  { transform: translateY(48vh)  translateX(calc(var(--dx) * 0.55))       rotate(200deg) scale(1.1); opacity: 0.22; }
  80%  { opacity: 0.15; }
  100% { transform: translateY(-12vh) translateX(var(--dx))                    rotate(430deg) scale(0.65); opacity: 0; }
}

/* ── Header / Nav ── */
.app-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.75rem 1.2rem;
  background: rgba(10,25,40,0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-border);
  flex-wrap: wrap;
}
.logo {
  display: flex; align-items: center; gap: 0.55rem;
  color: var(--accent);
  text-decoration: none;
  user-select: none;
}
.logo-goose-wrap {
  width: 38px; height: 38px; border-radius: 50%;
  background: #d6ccbb;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
  box-shadow: 0 0 12px rgba(240,192,64,0.35);
}
.logo-goose { width: 26px; height: 26px; object-fit: contain; display: block; }
.logo-text {
  font-size: 1.2rem; font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.nav-tabs {
  display: flex; gap: 0.35rem; flex-wrap: wrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.tab {
  background: transparent;
  border: 1.5px solid var(--card-border);
  color: var(--muted);
  padding: 0.4rem 0.9rem;
  border-radius: 50px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s;
}
.tab:hover  { border-color: var(--feather); color: var(--feather); }
.tab.active { background: var(--accent); border-color: var(--accent); color: var(--sky); }

/* ── Section visibility ── */
.tab-content {
  display: none;
  padding: 1.5rem 1rem 4rem;
  position: relative; z-index: 1;
  animation: fadeUp 0.35s ease both;
}
.tab-content.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════
   WORLD CLOCK
══════════════════════════════════════ */
.search-bar-wrap {
  position: relative; max-width: 600px;
  margin: 0 auto 1.5rem; z-index: 50;
}
.search-row {
  display: flex; gap: 0.5rem; align-items: center;
}
.search-bar-wrap input {
  flex: 1;
  padding: 0.75rem 1.2rem;
  border-radius: 50px;
  border: 1.5px solid var(--card-border);
  background: rgba(255,255,255,0.07);
  color: var(--cream);
  font-family: var(--font);
  font-size: 1rem;
  backdrop-filter: blur(8px);
  outline: none;
  transition: border-color 0.2s;
  min-width: 0;
}
.search-bar-wrap input:focus { border-color: var(--feather); }
.search-bar-wrap input::placeholder { color: var(--muted); }

.btn-location {
  white-space: nowrap;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid var(--feather);
  color: var(--feather);
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.6rem 1rem;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-location:hover { background: rgba(126,203,245,0.18); }
.btn-location.loading { opacity: 0.6; cursor: wait; }

.search-suggestions {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: #15283d;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  overflow: hidden;
  max-height: 250px;
  overflow-y: auto;
  z-index: 200;
}
.search-suggestions:empty { display: none; }
.suggestion-item {
  padding: 0.65rem 1.2rem;
  cursor: pointer;
  font-size: 0.95rem;
  display: flex; align-items: center; gap: 0.5rem;
  transition: background 0.15s;
}
.suggestion-item:hover { background: rgba(255,255,255,0.08); }
.suggestion-bird { font-size: 1.2rem; }

.clocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.4rem;
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Clock Card ── */
.clock-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.2rem 1rem 1rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  position: relative;
  backdrop-filter: blur(10px);
  transition: transform 0.2s, box-shadow 0.2s;
}
.clock-card {
  cursor: pointer;
}
.clock-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4), 0 0 0 1.5px var(--accent);
}
.clock-card .remove-btn {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; color: var(--muted);
  font-size: 1rem; cursor: pointer; line-height: 1;
  transition: color 0.2s;
}
.clock-card .remove-btn:hover { color: var(--danger); }

.clock-tz    { font-size: 0.72rem; color: var(--muted); }
.clock-time  { font-size: 1.5rem; font-weight: 900; letter-spacing: 1px; color: var(--accent); }
.clock-date  { font-size: 0.75rem; color: var(--muted); }

/* ── SVG Analog Clock ── */
.analog-clock { width: 170px; height: 170px; }

.clock-face-bg   { fill: rgba(255,255,255,0.04); stroke: var(--card-border); stroke-width:1.5; }
.clock-outer     { fill: none; stroke: var(--feather); stroke-width: 1.5; opacity: 0.3; }
.tick-major      { stroke: var(--dawn); stroke-width: 2; stroke-linecap: round; }
.tick-minor      { stroke: var(--muted); stroke-width: 1; stroke-linecap: round; opacity: 0.5; }
.hand-hour       { stroke: var(--cream); stroke-width: 5; stroke-linecap: round; transition: all 0.4s cubic-bezier(.4,2,.6,1); }
.hand-min        { stroke: var(--feather); stroke-width: 3; stroke-linecap: round; transition: all 0.4s cubic-bezier(.4,2,.6,1); }
.hand-sec        { stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; }
.center-dot      { fill: var(--accent); }
/* Bird background circles on clock face */
.bird-bg-dark  { fill: #d6ccbb; } /* cream bg for black birds */
.bird-bg-light { fill: #132437; } /* navy bg for white birds */

/* City card bird wrapper */
.city-bird-wrap {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.city-bird-wrap.dark-bird  { background: #d6ccbb; }
.city-bird-wrap.light-bird { background: #132437; border: 1px solid rgba(126,203,245,0.2); }
.city-bird-wrap img {
  width: 30px; height: 30px;
  object-fit: contain;
  display: block;
}

/* Suggestion bird icon */
.suggestion-bird-wrap {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.suggestion-bird-wrap.dark-bird  { background: #d6ccbb; }
.suggestion-bird-wrap.light-bird { background: #1a2e44; }
.suggestion-bird-wrap img { width: 18px; height: 18px; object-fit: contain; }

/* ══════════════════════════════════════
   SHARED CARD / CONTROLS
══════════════════════════════════════ */
.center-card {
  max-width: 420px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.8rem 1.5rem 2rem;
  backdrop-filter: blur(12px);
  display: flex; flex-direction: column; align-items: center; gap: 1.2rem;
}

.section-title {
  font-size: 1.3rem; font-weight: 900;
  letter-spacing: -0.3px;
}

/* ── Ring SVG ── */
.ring-svg { width: 220px; height: 220px; transform: rotate(-90deg); }
.ring-bg {
  fill: none;
  stroke: rgba(255,255,255,0.06);
  stroke-width: 14;
}
.ring-prog {
  fill: none;
  stroke: var(--accent);
  stroke-width: 14;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s linear, stroke 0.4s;
}
.ring-label {
  fill: var(--cream);
  font-family: var(--font);
  font-size: 22px;
  font-weight: 900;
  transform: rotate(90deg);
  transform-origin: 110px 110px;
}

/* ring color variants */
.ring-prog.running { stroke: var(--leaf); }
.ring-prog.warn    { stroke: var(--dawn); }
.ring-prog.done    { stroke: var(--danger); }

/* ── Buttons ── */
.controls {
  display: flex; gap: 0.7rem; flex-wrap: wrap; justify-content: center;
}
.btn-bird {
  background: var(--accent);
  border: none;
  color: var(--sky);
  font-family: var(--font);
  font-weight: 800;
  font-size: 0.9rem;
  padding: 0.6rem 1.4rem;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
  box-shadow: 0 4px 18px rgba(240,192,64,0.25);
}
.btn-bird:hover  { transform: scale(1.06); box-shadow: 0 6px 24px rgba(240,192,64,0.4); }
.btn-bird:active { transform: scale(0.97); }
.btn-bird.secondary {
  background: rgba(255,255,255,0.08);
  color: var(--cream);
  box-shadow: none;
  border: 1.5px solid var(--card-border);
}
.btn-bird.secondary:hover { background: rgba(255,255,255,0.15); }

/* ── Bird Ping ── */
.bird-ping {
  min-height: 1.6rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  animation: pulseFade 1.2s ease infinite;
}
@keyframes pulseFade {
  0%,100% { opacity: 1; } 50% { opacity: 0.4; }
}

/* ══════════════════════════════════════
   TIMER INPUTS
══════════════════════════════════════ */
.timer-inputs {
  display: flex; align-items: center; gap: 0.4rem;
}
.timer-inputs label {
  display: flex; flex-direction: column; align-items: center;
  gap: 0.2rem; font-size: 0.7rem; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
}
.timer-inputs input[type="number"] {
  width: 60px;
  padding: 0.45rem 0.3rem;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid var(--card-border);
  border-radius: 10px;
  color: var(--cream);
  font-family: var(--font);
  font-size: 1.3rem;
  font-weight: 800;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}
.timer-inputs input[type="number"]:focus { border-color: var(--feather); }
.timer-inputs input[type="number"]::-webkit-inner-spin-button { display: none; }
.colon { font-size: 1.5rem; font-weight: 900; color: var(--muted); }

/* ══════════════════════════════════════
   ALARM
══════════════════════════════════════ */
.alarm-set {
  display: flex; flex-direction: column; gap: 0.7rem; width: 100%;
}
.alarm-set input[type="time"],
.alarm-set input[type="text"] {
  width: 100%;
  padding: 0.65rem 1rem;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid var(--card-border);
  border-radius: 12px;
  color: var(--cream);
  font-family: var(--font);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.alarm-set input:focus { border-color: var(--feather); }

.alarm-list {
  list-style: none; width: 100%; display: flex; flex-direction: column; gap: 0.55rem;
}
.alarm-item {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 0.65rem 1rem;
  gap: 0.6rem;
}
.alarm-item.ringing {
  border-color: var(--accent);
  animation: ringPulse 0.5s ease infinite alternate;
}
@keyframes ringPulse {
  from { box-shadow: 0 0 0 0 rgba(240,192,64,0.4); }
  to   { box-shadow: 0 0 0 10px rgba(240,192,64,0); }
}
.alarm-info { display: flex; flex-direction: column; gap: 0.1rem; }
.alarm-time  { font-size: 1.2rem; font-weight: 900; color: var(--accent); }
.alarm-lbl   { font-size: 0.75rem; color: var(--muted); }
.alarm-actions { display: flex; gap: 0.4rem; align-items: center; }
.alarm-toggle {
  background: none; border: 1.5px solid;
  border-color: var(--leaf); color: var(--leaf);
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 0.95rem; cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.alarm-toggle.off { border-color: var(--muted); color: var(--muted); }
.alarm-del {
  background: none; border: 1.5px solid var(--danger); color: var(--danger);
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 0.95rem; cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}

/* ══════════════════════════════════════
   STOPWATCH LAPS
══════════════════════════════════════ */
.lap-list {
  list-style: none; width: 100%; max-height: 200px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.lap-item {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
}
.lap-num  { color: var(--muted); font-weight: 700; }
.lap-time { font-weight: 800; color: var(--feather); }
.lap-delta { color: var(--dawn); font-size: 0.78rem; }

/* ══════════════════════════════════════
   CLOCK EXPAND MODAL
══════════════════════════════════════ */
.clock-expand-card {
  background: #0d1f31;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2rem 1.8rem 1.8rem;
  width: 100%; max-width: 460px;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  position: relative;
  animation: fadeUp 0.25s ease both;
}
.modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; color: var(--muted);
  font-size: 1.2rem; cursor: pointer; line-height:1;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--danger); }
.clock-expand-city   { font-size: 1.5rem; font-weight: 900; }
.clock-expand-tz     { font-size: 0.8rem; color: var(--muted); }
.clock-expand-time   { font-size: 2.8rem; font-weight: 900; letter-spacing: 2px; color: var(--accent); }
.clock-expand-date   { font-size: 0.9rem; color: var(--muted); }
.analog-clock-lg     { width: 300px; height: 300px; }

/* ══════════════════════════════════════
   SHARKFLAP
══════════════════════════════════════ */
.sf-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0,0,0,0.6);
  border: 1px solid var(--card-border);
  touch-action: none;
}
#sfCanvas {
  display: block;
  width: 100%;
  image-rendering: pixelated;
}
.sf-overlay {
  position: absolute; inset: 0;
  background: rgba(5,15,28,0.82);
  backdrop-filter: blur(4px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0.8rem; padding: 2rem;
  z-index: 10;
}
.sf-title {
  font-size: 2.2rem; font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(240,192,64,0.5);
}
.sf-sub  { font-size: 0.85rem; color: var(--muted); text-align: center; }
.sf-best-wrap { font-size: 1rem; font-weight: 700; color: var(--feather); }
.sf-hud {
  position: absolute; top: 16px; left: 0; right: 0;
  display: flex; justify-content: center; pointer-events: none; z-index: 5;
}
.sf-score {
  font-size: 1.5rem; font-weight: 900;
  color: #fff;
  text-shadow: 0 3px 12px rgba(0,0,0,0.7);
  max-width: 92%;
  text-align: center;
  word-break: break-all;
  line-height: 1.35;
  letter-spacing: 1px;
}
.tab-shark { border-color: rgba(240,80,80,0.5); color: #f07070; }
.tab-shark:hover { border-color: #f07070; color: #f07070; }
.tab-shark.active { background: #c0392b; border-color: #c0392b; color: #fff; }

/* ══════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 99px; }

/* ── Clock card header bird row ── */
.clock-card-header {
  display: flex; align-items: center; gap: 0.5rem;
  justify-content: center;
}
.clock-city { font-size: 0.95rem; font-weight: 700; text-align: center; }

/* ══════════════════════════════════════
   MODAL
══════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(5,16,24,0.75);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadeUp 0.2s ease both;
}
.modal-card {
  background: #112233;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.8rem 1.6rem;
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 1rem;
}
.modal-card h3 { font-size: 1.15rem; font-weight: 900; }
.modal-hint { font-size: 0.85rem; color: var(--muted); }
.modal-hint strong { color: var(--feather); }
.modal-label {
  display: flex; flex-direction: column; gap: 0.4rem;
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--muted);
}
.modal-label input {
  padding: 0.65rem 1rem;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid var(--card-border);
  border-radius: 10px;
  color: var(--cream);
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
}
.modal-label input:focus { border-color: var(--feather); }
.modal-actions { display: flex; gap: 0.6rem; }

/* ══════════════════════════════════════
   MOBILE
══════════════════════════════════════ */
@media (max-width: 600px) {
  .app-header  { padding: 0.5rem 0.7rem; gap: 0.5rem; }
  .logo-text   { font-size: 0.95rem; }
  .logo-goose-wrap { width: 30px; height: 30px; }
  .logo-goose  { width: 20px; height: 20px; }
  .tab         { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
  .nav-tabs    { gap: 0.25rem; flex-wrap: nowrap; }
  .clocks-grid { grid-template-columns: 1fr; }
  .center-card { padding: 1.2rem 0.9rem; }
  .ring-svg    { width: 185px; height: 185px; }
  .clock-expand-card { padding: 1.4rem 1rem; }
  .analog-clock-lg { width: 240px; height: 240px; }
  .clock-expand-time { font-size: 2.2rem; }
  .sf-wrap     { border-radius: 12px; }
  .sf-title    { font-size: 1.7rem; }
  .timer-inputs input[type="number"] { width: 52px; font-size: 1.1rem; }
}
