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

:root {
  --bg:   #a8bfb0;
  --text: #4a6460;
  --wave: #4a6460;
  --font: 'Poppins', sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background 0.6s ease, color 0.6s ease;
}

/* ── Branding ── */
#brand {
  position: fixed;
  top: 24px;
  left: 32px;
  font-size: 32px;
  font-weight: 300;
  letter-spacing: 0.02em;
  line-height: 1;
  opacity: 0.85;
  z-index: 10;
  cursor: default;
  user-select: none;
}

#brand-sub {
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.04em;
  opacity: 0.5;
  margin-top: 4px;
}

/* ── Corner controls ── */
#corner-controls {
  position: fixed;
  top: 18px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
}

.ctrl-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  opacity: 0.6;
  font-size: 16px;
  font-family: var(--font);
  font-weight: 400;
  padding: 6px 10px;
  border-radius: 6px;
  transition: opacity 0.2s, background 0.2s;
  letter-spacing: 0.04em;
  line-height: 1;
}
.ctrl-btn:hover { opacity: 1; background: rgba(74,100,96,0.08); }
.ctrl-btn.active { opacity: 1; font-weight: 600; }

/* ── 12/24 toggle ── */
#hr-toggle {
  font-size: 13px;
  letter-spacing: 0.06em;
  font-weight: 400;
  opacity: 0.6;
  padding: 6px 10px;
}

/* ── Font menu ── */
#font-menu { position: relative; }
#font-trigger { font-size: 15px; font-weight: 500; }

#font-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: color-mix(in srgb, var(--bg) 92%, white);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  overflow: hidden;
  min-width: 170px;
  box-shadow: 0 6px 24px rgba(74,100,96,0.18);
}
#font-dropdown.open { display: block; }

.font-option {
  display: block;
  width: 100%;
  padding: 11px 18px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  font-weight: 300;
  text-align: left;
  transition: background 0.15s;
  letter-spacing: 0.02em;
}
.font-option:hover { background: rgba(74,100,96,0.1); }
.font-option.selected { font-weight: 500; }

/* ── Palette menu ── */
#palette-menu { position: relative; }

#palette-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: color-mix(in srgb, var(--bg) 92%, white);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  padding: 14px;
  gap: 9px;
  box-shadow: 0 6px 24px rgba(74,100,96,0.18);
  width: 180px;
  flex-wrap: wrap;
}
#palette-dropdown.open { display: flex; }

.palette-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.palette-dot:hover { transform: scale(1.2); }
.palette-dot.selected { border-color: var(--text); }

/* ── Main stage ── */
#stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 1;
  padding-bottom: 80px;
}

/* ── Clock ── */
#clock-display {
  font-size: clamp(88px, 17vw, 190px);
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1;
  transition: opacity 0.3s ease;
  font-family: var(--font);
  user-select: none;
  display: inline-flex;
  align-items: flex-start;
}

#clock-period {
  font-size: 0.18em;
  font-weight: 300;
  letter-spacing: 0.04em;
  opacity: 0.6;
  margin-top: 0.35em;
  margin-left: 0.3em;
}

/* ── Pomo indicator under clock ── */
#pomo-indicator {
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.12em;
  opacity: 0;
  margin-top: 14px;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
#pomo-indicator.visible { opacity: 0.45; }

/* ── Pomodoro panel ── */
#pomo-panel {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}
#pomo-panel.visible { display: flex; }

#pomo-time {
  font-size: clamp(88px, 17vw, 190px);
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1;
  font-family: var(--font);
  user-select: none;
}



/* custom duration slider */
#custom-duration {
  display: flex;
  align-items: center;
  gap: 12px;
}

#duration-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 180px;
  height: 2px;
  background: rgba(74,100,96,0.25);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
#duration-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
  opacity: 0.75;
  transition: opacity 0.2s, transform 0.2s;
}
#duration-slider::-webkit-slider-thumb:hover {
  opacity: 1;
  transform: scale(1.3);
}
#duration-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: var(--text);
  opacity: 0.75;
  cursor: pointer;
}

#duration-label {
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.05em;
  opacity: 0.6;
  min-width: 44px;
}

/* controls */
#pomo-controls {
  display: flex;
  gap: 28px;
  align-items: center;
}
.pomo-ctrl {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  opacity: 0.55;
  font-size: 13px;
  font-family: var(--font);
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: opacity 0.2s;
  padding: 4px 2px;
}
.pomo-ctrl:hover { opacity: 1; }

/* pulse on finish */
@keyframes pulse-finish {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}
.pulse { animation: pulse-finish 0.9s ease-in-out 4; }

/* hover hint */
#pomo-hint {
  position: fixed;
  bottom: 340px;
  z-index: 2;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 300;
  opacity: 0;
  transition: opacity 0.5s ease;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
  color: var(--text);
  white-space: nowrap;
}
#stage:hover ~ #pomo-hint { opacity: 0.4; }
body.pomo-mode #stage:hover ~ #pomo-hint { opacity: 0; }

/* ── Developer info panel ── */
#info-panel {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.08);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
#info-panel.open { opacity: 1; pointer-events: all; }

#info-panel-inner {
  background: color-mix(in srgb, var(--bg) 96%, white);
  border-radius: 18px;
  width: min(460px, 92vw);
  max-height: min(580px, 85vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

#info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid rgba(74,100,96,0.1);
}
#info-title {
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 0.02em;
}
#info-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  opacity: 0.4;
  padding: 2px;
  display: flex;
  align-items: center;
  transition: opacity 0.2s;
}
#info-close:hover { opacity: 0.9; }

#info-body {
  padding: 20px 22px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#info-body::-webkit-scrollbar { width: 4px; }
#info-body::-webkit-scrollbar-thumb { background: rgba(74,100,96,0.2); border-radius: 2px; }

.info-section-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.45;
  margin-top: 14px;
}
.info-section-label:first-child { margin-top: 0; }

.info-text {
  font-size: 13px;
  font-weight: 300;
  line-height: 1.7;
  opacity: 0.8;
  letter-spacing: 0.01em;
}

.info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.info-list li {
  font-size: 13px;
  font-weight: 300;
  opacity: 0.75;
  letter-spacing: 0.01em;
  padding-left: 14px;
  position: relative;
}
.info-list li::before {
  content: '·';
  position: absolute;
  left: 0;
  opacity: 0.5;
}

#info-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.info-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid rgba(74,100,96,0.25);
  font-size: 12px;
  font-weight: 300;
  font-family: var(--font);
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.04em;
  opacity: 0.7;
  transition: opacity 0.2s, background 0.2s;
}
.info-link:hover { opacity: 1; background: rgba(74,100,96,0.08); }

/* ── Timezone label under clock ── */
#tz-label {
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0;
  margin-top: 10px;
  transition: opacity 0.4s ease;
  pointer-events: none;
  text-align: center;
}
#tz-label.visible { opacity: 0.45; }

/* ── World clock panel ── */
#tz-panel {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.08);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
#tz-panel.open {
  opacity: 1;
  pointer-events: all;
}

#tz-panel-inner {
  background: color-mix(in srgb, var(--bg) 96%, white);
  border-radius: 18px;
  width: min(420px, 90vw);
  max-height: min(520px, 80vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

#tz-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(74,100,96,0.1);
}

#tz-search {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 300;
  color: var(--text);
  letter-spacing: 0.02em;
}
#tz-search::placeholder { opacity: 0.4; }

#tz-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  opacity: 0.4;
  padding: 2px;
  display: flex;
  align-items: center;
  transition: opacity 0.2s;
}
#tz-close:hover { opacity: 0.9; }

#tz-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
}
#tz-list::-webkit-scrollbar { width: 4px; }
#tz-list::-webkit-scrollbar-thumb { background: rgba(74,100,96,0.2); border-radius: 2px; }

.tz-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 20px;
  cursor: pointer;
  transition: background 0.15s;
  gap: 12px;
}
.tz-item:hover { background: rgba(74,100,96,0.07); }
.tz-item.selected { background: rgba(74,100,96,0.12); }

.tz-item-left { display: flex; flex-direction: column; gap: 1px; }
.tz-city {
  font-size: 14px;
  font-weight: 300;
  color: var(--text);
  letter-spacing: 0.02em;
}
.tz-country {
  font-size: 11px;
  font-weight: 300;
  opacity: 0.45;
  letter-spacing: 0.04em;
}
.tz-time {
  font-size: 13px;
  font-weight: 300;
  opacity: 0.6;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ── Waves ── */
#waves {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 320px;      /* doubled from 160 */
  overflow: hidden;
  pointer-events: none;
}

.wave-svg {
  position: absolute;
  bottom: 0;
  width: 200%;
  height: 100%;
}

@keyframes wave-drift {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.wave-svg:nth-child(1) { animation: wave-drift  9s linear infinite;         opacity: 0.70; }
.wave-svg:nth-child(2) { animation: wave-drift 11s linear infinite reverse; opacity: 0.55; }
.wave-svg:nth-child(3) { animation: wave-drift 13s linear infinite;         opacity: 0.45; }
.wave-svg:nth-child(4) { animation: wave-drift 15s linear infinite reverse; opacity: 0.35; }
.wave-svg:nth-child(5) { animation: wave-drift 10s linear infinite;         opacity: 0.28; }
.wave-svg:nth-child(6) { animation: wave-drift 12s linear infinite reverse; opacity: 0.20; }

/* ── Mobile portrait ── */
@media (max-width: 600px) {
  #brand { font-size: 22px; top: 16px; left: 20px; }
  #brand-sub { font-size: 9px; }
  #corner-controls { top: 14px; right: 14px; gap: 2px; }
  .ctrl-btn { font-size: 13px; padding: 5px 7px; }
  #clock-display, #pomo-time { font-size: clamp(64px, 20vw, 110px); }
  #stage { padding-bottom: 60px; }
  #waves { height: 200px; }
  #pomo-panel { gap: 18px; }
  #duration-slider { width: 200px; }
  #pomo-hint { bottom: 220px; }
}

/* ── Mobile landscape (short viewport) ── */
@media (max-height: 500px) {
  #brand { font-size: 16px; top: 10px; left: 16px; }
  #brand-sub { display: none; }
  #corner-controls { top: 8px; right: 12px; gap: 2px; }
  .ctrl-btn { font-size: 12px; padding: 4px 6px; }
  #clock-display, #pomo-time { font-size: clamp(48px, 14vh, 90px); }
  #stage { padding-bottom: 40px; }
  #waves { height: 110px; }
  #pomo-panel { gap: 12px; }
  #custom-duration { margin-top: -4px; }
  #duration-slider { width: 160px; }
  #pomo-hint { bottom: 125px; }
  #pomo-controls { gap: 18px; }
  .pomo-ctrl { font-size: 11px; }
}
