:root {
  color-scheme: light;
  --bg: #f4e8d8;
  --panel: #f8e8b9;
  --panel-strong: #e3ead0;
  --line: rgba(66, 75, 68, 0.14);
  --text: #26332e;
  --muted: #74817b;
  --accent: #4f967c;
  --accent-strong: #2f765f;
  --shadow: 0 3px 14px rgba(44, 57, 50, 0.06);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 6%, rgba(250, 181, 154, 0.72), transparent 25rem),
    radial-gradient(circle at 94% 12%, rgba(170, 211, 230, 0.72), transparent 28rem),
    radial-gradient(circle at 72% 92%, rgba(190, 218, 163, 0.66), transparent 30rem),
    radial-gradient(circle at 12% 88%, rgba(225, 190, 222, 0.52), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", sans-serif;
}

button, input { font: inherit; }

button { color: inherit; }

button:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(40, 98, 79, 0.68);
  outline-offset: 3px;
}

.ambient-glow {
  display: none;
}

.ambient-glow--one { top: 12%; left: -18rem; background: #43d5c0; }
.ambient-glow--two { right: -20rem; bottom: -8rem; background: #467bb1; }

.app-shell {
  position: relative;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 50px;
}

h1, h2, p { margin-top: 0; }

.control-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 24px;
  align-items: center;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(248, 232, 185, 0.88);
  box-shadow: var(--shadow);
}

.control-bar__status {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: flex-end;
}

.master-volume,
.sound-volume {
  display: grid;
  grid-template-columns: 22px minmax(100px, 1fr) 3.2rem;
  gap: 12px;
  align-items: center;
}

.master-volume { font-size: 0.8rem; color: var(--muted); }

output {
  color: var(--muted);
  font-size: 0.72rem;
  text-align: right;
}

.control-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

input[type="range"] {
  width: 100%;
  height: 3px;
  margin: 0;
  appearance: none;
  border-radius: 999px;
  background: #d9ded7;
  accent-color: var(--accent);
}

input[type="range"]::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  appearance: none;
  border: 3px solid #f7faf7;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(61, 123, 99, 0.22);
  cursor: pointer;
}

input[type="range"]:disabled { opacity: 0.32; }

.now-playing {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.now-playing__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b9c1bc;
}

.now-playing.is-active .now-playing__dot {
  background: var(--accent);
  box-shadow: none;
}

.timer-toggle,
.timer-control {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.32);
  cursor: pointer;
}

.timer-toggle {
  width: 38px;
  height: 38px;
}

.timer-toggle.is-running {
  border-color: rgba(47, 118, 95, 0.34);
  color: var(--accent-strong);
  background: rgba(196, 226, 208, 0.68);
}

.timer-toggle.is-finished {
  background: #f0c9b7;
}

.timer-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  margin: -4px 0 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(227, 234, 208, 0.8);
  box-shadow: var(--shadow);
}

.timer-panel[hidden] { display: none; }

.timer-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.timer-preset {
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.32);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.timer-preset strong { color: inherit; font-size: 0.76rem; }

.timer-preset.is-selected {
  border-color: rgba(47, 118, 95, 0.22);
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.68);
}

.timer-readout {
  display: flex;
  gap: 9px;
  align-items: center;
}

.timer-display {
  min-width: 5.2ch;
  color: var(--text);
  font-family: "Segoe UI Variable Display", "Avenir Next", "Helvetica Neue", sans-serif;
  font-size: 1.68rem;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.055em;
  text-align: right;
}

.timer-control {
  width: 36px;
  height: 36px;
  color: var(--muted);
}

.timer-control--primary {
  color: #f7faf7;
  background: var(--accent-strong);
}

.timer-control svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.timer-start-icon--pause { display: none; }
.timer-control--primary.is-running .timer-start-icon--play { display: none; }
.timer-control--primary.is-running .timer-start-icon--pause { display: block; }

.sound-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.clear-all-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f4d7c8;
  cursor: pointer;
}

.clear-all-button:disabled { opacity: 0.35; cursor: default; }

.sound-group__title {
  display: flex;
  gap: 9px;
  align-items: center;
  margin: 0 0 11px;
  color: rgba(38, 51, 46, 0.62);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.sound-group__title::after {
  height: 1px;
  flex: 1;
  background: rgba(66, 75, 68, 0.12);
  content: "";
}

.sound-group__title svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.sound-group--human { margin-top: 28px; }

.sound-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.sound-card {
  --card-tint: #f4dccf;
  --card-active: #edc3ae;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card-tint);
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.sound-card:nth-child(1) { --card-tint: #f4d3c2; --card-active: #ebb59a; }
.sound-card:nth-child(2) { --card-tint: #cfe2ef; --card-active: #afd0e5; }
.sound-card:nth-child(3) { --card-tint: #d9d2eb; --card-active: #c1b5df; }
.sound-card:nth-child(4) { --card-tint: #c9e5e5; --card-active: #a9d5d6; }
.sound-card:nth-child(5) { --card-tint: #cfe5d9; --card-active: #add3bf; }
.sound-card:nth-child(6) { --card-tint: #dce7c5; --card-active: #c5d8a3; }
.sound-card:nth-child(7) { --card-tint: #c9dfca; --card-active: #a8cbaa; }
.sound-card:nth-child(8) { --card-tint: #f1dfad; --card-active: #e8cb82; }
.sound-card:nth-child(9) { --card-tint: #d8d0ea; --card-active: #beb2dd; }
.sound-grid--human .sound-card:nth-child(1) { --card-tint: #eed2c4; --card-active: #e3b6a2; }
.sound-grid--human .sound-card:nth-child(2) { --card-tint: #cad9e5; --card-active: #adc5d7; }
.sound-grid--human .sound-card:nth-child(3) { --card-tint: #dfd0c4; --card-active: #cdb6a5; }
.sound-grid--human .sound-card:nth-child(4) { --card-tint: #e5d6c9; --card-active: #d7c0ad; }
.sound-grid--human .sound-card:nth-child(5) { --card-tint: #d1dce9; --card-active: #b8c9dc; }
.sound-grid--human .sound-card:nth-child(6) { --card-tint: #e4d7c8; --card-active: #d5c0a8; }

.sound-card:hover { transform: none; border-color: rgba(47, 64, 56, 0.35); background: var(--card-active); }

.sound-card.is-active {
  border-color: rgba(47, 64, 56, 0.5);
  background: var(--card-active);
  box-shadow: none;
}

.sound-card.is-upcoming {
  opacity: 0.72;
}

.sound-card.is-upcoming:hover {
  border-color: var(--line);
  background: var(--card-tint);
}

.sound-card.is-upcoming .sound-toggle {
  cursor: default;
}

.sound-card.is-upcoming .sound-volume {
  visibility: hidden;
}

.sound-toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 112px;
  padding: 22px 18px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.sound-card__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: #35463f;
  transition: color 180ms ease, transform 180ms ease;
}

.sound-card__icon svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.is-active .sound-card__icon {
  color: #24342e;
  transform: scale(1.04);
}

.sound-card__state {
  position: absolute;
  top: 13px;
  right: 13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c4cac6;
  transition: background 180ms ease, box-shadow 180ms ease;
}

.is-active .sound-card__state {
  background: #35463f;
  box-shadow: none;
}

.sound-volume {
  grid-template-columns: 1fr;
  margin: 0 14px;
  padding: 12px 0 17px;
  border-top: 1px solid #e8eae4;
}

.sound-volume output { display: none; }

.sound-volume input[type="range"] { accent-color: #4f655b; }

.sound-volume input[type="range"]::-webkit-slider-thumb {
  background: #4f655b;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 0.65; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.12); }
}

@media (max-width: 880px) {
  .sound-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 580px) {
  .app-shell { width: min(100% - 22px, 1120px); padding-top: 18px; }
  .control-bar { grid-template-columns: 1fr; gap: 14px; margin-bottom: 12px; padding: 16px; }
  .master-volume { grid-column: 1 / -1; }
  .control-bar__status { grid-column: 1; grid-row: 2; justify-content: space-between; }
  .now-playing { overflow: hidden; }
  .timer-panel { grid-template-columns: 1fr; gap: 14px; margin-top: 0; padding: 14px; }
  .timer-readout { justify-content: flex-end; }
  .timer-display { margin-right: auto; text-align: left; }
  .sound-actions { margin-bottom: 8px; }
  .sound-group--human { margin-top: 22px; }
  .sound-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
  .sound-card { border-radius: 16px; }
  .sound-toggle { min-height: 88px; padding: 18px 12px 10px; }
  .sound-card__icon { width: 40px; height: 40px; }
  .sound-volume { margin-inline: 11px; padding-bottom: 14px; }
}

@media (max-width: 390px) {
  .sound-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
