/* Rainy Cafe. Dark by design: the page sits on a rainy-window photo. */
:root {
  --bg: #0b1220;
  --card: rgba(12, 19, 34, 0.62);
  --tile: rgba(255, 255, 255, 0.06);
  --tile-line: rgba(255, 255, 255, 0.14);
  --text: #eef3fa;
  --muted: #b4c0d2;
  --accent: #4f97f0;
  --accent-soft: rgba(79, 151, 240, 0.22);
  --panel: #f7f9fc;
  --panel-text: #1e293b;
  --panel-muted: #475569;
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, rgba(8, 13, 24, 0.45) 0%, rgba(8, 13, 24, 0.7) 55%, rgba(8, 13, 24, 0.95) 100%),
    url("../img/bg-1920.55834b5c94.jpg");
  background-image:
    linear-gradient(180deg, rgba(8, 13, 24, 0.45) 0%, rgba(8, 13, 24, 0.7) 55%, rgba(8, 13, 24, 0.95) 100%),
    image-set(url("../img/bg-1920.697d4ed7a8.webp") type("image/webp"), url("../img/bg-1920.55834b5c94.jpg") type("image/jpeg"));
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Hiragino Sans", "Yu Gothic", sans-serif;
}
@media (max-width: 900px) {
  body {
    background-attachment: scroll;
    background-image:
      linear-gradient(180deg, rgba(8, 13, 24, 0.45) 0%, rgba(8, 13, 24, 0.75) 45%, rgba(8, 13, 24, 0.97) 100%),
      url("../img/bg-1080.c2ee55dfa6.jpg");
    background-image:
      linear-gradient(180deg, rgba(8, 13, 24, 0.45) 0%, rgba(8, 13, 24, 0.75) 45%, rgba(8, 13, 24, 0.97) 100%),
      image-set(url("../img/bg-1080.df43fbb2f9.webp") type("image/webp"), url("../img/bg-1080.c2ee55dfa6.jpg") type("image/jpeg"));
    background-position: center top;
  }
}

a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left));
}

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 4px 18px; }
.wordmark { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: 0.01em; }
.fm-logo { display: block; line-height: 0; opacity: 0.92; }
.fm-logo:hover { opacity: 1; }
.fm-logo img { width: 117px; height: auto; }

.card {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 28px;
  padding: 24px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.col { min-width: 0; }

.eyebrow {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.row-head .eyebrow { margin: 0; }

.play-all {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 6px 14px 6px 10px;
  border: 1px solid var(--tile-line); border-radius: 999px;
  background: var(--tile); cursor: pointer; font-size: 16px;
}
.play-all[hidden] { display: none; }
.play-all svg { width: 18px; height: 18px; fill: currentColor; }
.play-all .i-pause { display: none; }
.play-all[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.play-all[aria-pressed="true"] .i-play { display: none; }
.play-all[aria-pressed="true"] .i-pause { display: block; }

/* Sound tiles */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.tile {
  position: relative;
  height: 168px;
  border: 1px solid var(--tile-line);
  border-radius: var(--radius);
  background: var(--tile);
  transition: border-color 0.15s, background-color 0.15s;
}
.tile.on { border-color: var(--accent); background: var(--accent-soft); }
.tile-toggle {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  width: 100%; padding: 12px 4px 10px;
  border: 0; border-radius: inherit; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tile-toggle svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; }
.tile.on .tile-toggle svg { opacity: 1; color: #cfe3ff; }
.tile-name { font-size: 16px; line-height: 1.2; }
.tile.loading .tile-name::after { content: "\2026"; }
.level {
  position: absolute; left: 50%; top: 50px; bottom: 40px;
  width: 36px; margin-left: -18px;
  display: flex; justify-content: center;
  cursor: ns-resize; touch-action: none;
}
.level::before {
  content: ""; position: absolute; top: 0; bottom: 0; width: 8px; left: 14px;
  border-radius: 4px; background: rgba(255, 255, 255, 0.16);
}
.level .fill {
  position: absolute; bottom: 0; width: 8px; left: 14px; height: 0;
  border-radius: 4px; background: rgba(255, 255, 255, 0.45);
}
.tile.on .level .fill { background: var(--accent); }

.hint { margin: 12px 2px 16px; color: var(--muted); font-size: 16px; }

.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 8px 16px;
  border: 1px solid var(--tile-line); border-radius: 999px;
  background: var(--tile); cursor: pointer; font-size: 16px;
}
.chip[aria-pressed="true"] { background: var(--text); color: #0b1220; border-color: var(--text); }

/* Timer */
.timer {
  padding: 18px;
  border: 1px solid var(--tile-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}
.lengths { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.len {
  min-height: 36px; padding: 6px 14px;
  border: 1px solid var(--tile-line); border-radius: 999px; background: none; cursor: pointer; font-size: 16px;
}
.len[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.custom { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.custom[hidden] { display: none; }
.custom input {
  width: 72px; min-height: 36px; padding: 4px 8px;
  border: 1px solid var(--tile-line); border-radius: 10px;
  background: rgba(0, 0, 0, 0.25); color: var(--text); font: inherit;
}
.clock-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.clock { font-size: 60px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.timer.running .clock { color: #fff; }
.timer-btns { display: flex; gap: 8px; }
.timer-note { margin: 12px 0 0; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 10px 20px;
  border: 1px solid transparent; border-radius: 12px;
  font-size: 16px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #3f87e3; }
.btn-ghost { background: none; border-color: var(--tile-line); }
.btn-wide { width: 100%; }

/* FocusMe panel */
.fm-panel {
  margin-top: 16px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--panel-text);
}
.fm-panel h2 { margin: 0 0 6px; font-size: 20px; line-height: 1.3; }
.fm-panel p { margin: 0 0 14px; color: var(--panel-muted); }
.fm-panel .fm-done { color: var(--panel-text); font-weight: 600; padding: 10px 12px; border-radius: 10px; background: #e3eefc; }

/* Footer */
.foot { margin: 22px 4px 0; color: var(--muted); }
.foot blockquote { margin: 0 0 14px; }
.foot blockquote p { margin: 0 0 4px; color: var(--text); }
.foot cite { font-style: normal; }
.foot p { margin: 0 0 10px; }
.foot a { color: #cfe3ff; }

@media (max-width: 760px) {
  .card { grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 16px; border-radius: 20px; }
  .clock { font-size: 56px; }
}
@media (max-width: 400px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wordmark { font-size: 24px; }
  .fm-logo img { width: 100px; }
  .timer { padding: 14px; }
  .clock { font-size: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
