/* Watango Study Timer (बस बैठो) — quiet dark utility UI */

:root {
  --bg: #12161c;
  --panel: #1a212b;
  --panel-border: #2a3544;
  --text: #e8eef6;
  --muted: #8b9aab;
  --accent: #3d9a7a;
  --accent-dim: #2a6b55;
  --warn: #c9a227;
  --danger: #c45c5c;
  --ring: #3d9a7a;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: "Segoe UI", system-ui, -apple-system, "Noto Sans", "Noto Sans Devanagari",
    sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

body {
  padding: calc(12px + var(--safe-t)) 14px calc(24px + var(--safe-b));
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, #1e3a32 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, #1a2433 0%, transparent 50%),
    var(--bg);
}

.app {
  max-width: 440px;
  margin: 0 auto;
}

.header {
  text-align: center;
  margin-bottom: 1.1rem;
}

.brand {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

h1 {
  margin: 0.25rem 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.hi {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.85em;
}

.tagline-hi {
  display: block;
  margin-top: 0.15rem;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1rem 1.05rem 1.1rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.panel-head h2 {
  margin: 0;
}

.pill {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: #2a3140;
  color: var(--muted);
  border: 1px solid var(--panel-border);
}

.pill.open {
  background: rgba(61, 154, 122, 0.18);
  color: var(--accent);
  border-color: var(--accent-dim);
}

.fine {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.fine.muted {
  opacity: 0.9;
}

.presets {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.45rem;
}

.chip {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: #141a22;
  color: var(--text);
  border-radius: 10px;
  padding: 0.7rem 0.35rem;
  font-size: 1.05rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chip:hover {
  border-color: var(--accent-dim);
}

.chip.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: #fff;
}

.timer-panel {
  text-align: center;
}

.ring-wrap {
  position: relative;
  width: min(220px, 70vw);
  margin: 0.25rem auto 1rem;
}

.ring {
  width: 100%;
  height: auto;
  transform: rotate(-90deg);
}

.ring-track,
.ring-prog {
  fill: none;
  stroke-width: 6;
}

.ring-track {
  stroke: #243040;
}

.ring-prog {
  stroke: var(--ring);
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.35s linear;
}

.time-display {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.time {
  font-variant-numeric: tabular-nums;
  font-size: 2.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.status {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.controls {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 0.45rem;
}

button.primary,
button.secondary,
button.ghost {
  appearance: none;
  border-radius: 11px;
  border: 1px solid transparent;
  padding: 0.78rem 0.5rem;
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s, border-color 0.15s;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  color: #06140f;
}

button.primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

button.secondary {
  background: #243040;
  color: var(--text);
  border-color: var(--panel-border);
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--panel-border);
}

.ambient-controls {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.toggle-row,
.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.toggle-row input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
}

.slider-row {
  flex-wrap: wrap;
}

.slider-row span {
  flex: 1 1 100%;
  color: var(--muted);
  font-size: 0.8rem;
}

.slider-row input[type="range"] {
  flex: 1;
  width: 100%;
  accent-color: var(--accent);
}

.slider-row output {
  min-width: 3.2rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-size: 0.85rem;
}

.options .toggle-row {
  margin-bottom: 0.35rem;
}

.footer {
  text-align: center;
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.footer p {
  margin: 0;
}

body.running .ring-prog {
  stroke: var(--accent);
}

body.paused .ring-prog {
  stroke: var(--warn);
}

body.done .ring-prog {
  stroke: var(--accent);
}

/* Laptop / wide embed: timer on the left, sound + options on the right */
@media (min-width: 760px) {
  body {
    padding-top: calc(18px + var(--safe-t));
  }

  .app {
    max-width: 900px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "header header"
      "duration sounds"
      "timer sounds"
      "timer options"
      "footer footer";
    grid-template-rows: auto auto auto 1fr auto;
    column-gap: 0.95rem;
    align-items: start;
  }

  .header { grid-area: header; }
  .panel-duration { grid-area: duration; }
  .timer-panel { grid-area: timer; }
  .panel-sounds { grid-area: sounds; }
  .options { grid-area: options; }
  .footer { grid-area: footer; }
}

/* Short wide screens (laptops, itch embed): compact so it fits without scrolling */
@media (min-width: 760px) and (max-height: 860px) {
  body {
    padding-top: calc(12px + var(--safe-t));
    padding-bottom: calc(12px + var(--safe-b));
  }

  .header {
    margin-bottom: 0.7rem;
  }

  h1 {
    margin: 0.15rem 0 0.25rem;
    font-size: 1.5rem;
  }

  .panel {
    padding: 0.8rem 0.95rem 0.9rem;
    margin-bottom: 0.7rem;
  }

  .ring-wrap {
    width: 190px;
    margin: 0 auto 0.8rem;
  }

  .ambient-controls {
    margin-top: 0.55rem;
    gap: 0.4rem;
  }

  .slider-row span {
    flex: 0 0 46%;
  }

  .slider-row input[type="range"] {
    width: auto;
  }

  .slider-row output {
    min-width: 2.6rem;
  }
}

@media (max-width: 360px) {
  .controls {
    grid-template-columns: 1fr;
  }

  .time {
    font-size: 2rem;
  }
}
