* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg-edge); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg) fixed;
  color: var(--fg);
  font: 300 16px/1.45 var(--f-body);
  -webkit-text-size-adjust: 100%;
}

main { min-height: 100vh; min-height: 100dvh; display: flex; }
main > section {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 420px;
  margin: 0 auto;
  padding: max(40px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}

.spc { flex: 1; min-height: 16px; }
.ttl { font: 300 34px/1.1 var(--f-head); margin: 24px 0 0; color: var(--fg-title); }
.sub { font-size: 16px; color: var(--fg-sub); margin: 10px 0 0; letter-spacing: .02em; }
.small { font-size: 14px; line-height: 1.4; color: var(--fg-small); margin: 14px 0 0; min-height: 1.4em; }

.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: var(--touch); padding: 14px 16px;
  border: 0; border-radius: 999px;
  font: 500 17px var(--f-body); letter-spacing: .01em; text-decoration: none;
  background: var(--btn-bg); color: var(--btn-fg);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.btn.q { background: transparent; border: 1px solid var(--btn-q-border); color: var(--btn-q-fg); font-weight: 400; }
.btn:disabled { opacity: .55; cursor: default; }
.btn:focus-visible { outline: 2px solid var(--fg-title); outline-offset: 3px; }

.lbl { align-self: stretch; text-align: left; margin: 0; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-small); }
.guide { align-self: stretch; margin: 12px 0 0; padding: 0; list-style: none; counter-reset: g; text-align: left; font-size: 17px; line-height: 1.45; color: var(--fg); }
.guide li { counter-increment: g; display: flex; gap: 12px; margin-bottom: 14px; }
.guide li::before { content: counter(g) "."; flex: none; width: 16px; color: var(--fg-small); }

/* Settings screens */
.ttl.h2 { font-size: 28px; margin-top: 12px; align-self: stretch; text-align: left; }
.sub.left { align-self: stretch; text-align: left; margin-top: 4px; }
.back { align-self: flex-start; display: inline-flex; align-items: center; min-height: var(--touch); color: var(--btn-bg); font-size: 16px; text-decoration: none; }
.rows { list-style: none; padding: 0; margin: 12px 0 0; align-self: stretch; text-align: left; }
.rows > li, .rows > a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; border-bottom: 1px solid var(--card-border); font-size: 17px; color: var(--fg); text-decoration: none; }
.rows .row { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 56px; color: var(--fg); text-decoration: none; }
.rows em { font-style: normal; font-size: 15px; color: var(--fg-sub); }
.rows input[type=time] {
  font: 300 26px var(--f-head); color: var(--fg-title); background: transparent; border: 0;
  min-height: var(--touch); padding: 0; font-variant-numeric: tabular-nums; color-scheme: dark;
}
.x, .stp button {
  flex: none; width: var(--touch); height: var(--touch); border-radius: 50%;
  border: 0; background: transparent; color: var(--btn-bg); font: 400 22px var(--f-body); cursor: pointer;
}
.x:focus-visible, .stp button:focus-visible, .row:focus-visible, .back:focus-visible, .rows input:focus-visible { outline: 2px solid var(--fg-title); outline-offset: 2px; }
.stp { display: flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.stp b { font-weight: 400; min-width: 40px; text-align: center; }
.stp button:disabled { opacity: .35; cursor: default; }
.btn.slim { margin-top: 18px; }

/* Corner menu (Home only) */
.menu {
  position: fixed; z-index: 3; top: max(18px, env(safe-area-inset-top)); right: max(18px, env(safe-area-inset-right));
  width: var(--touch); height: var(--touch); padding: 0; border: 0; background: transparent;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.menu i { display: block; width: 16px; height: 1.5px; border-radius: 1px; background: #cfc6ee; opacity: .8; }
.menu:focus-visible { outline: 2px solid var(--fg-title); outline-offset: 2px; border-radius: 12px; }
.scrim { position: fixed; inset: 0; z-index: 2; background: rgba(12, 10, 24, .4); }
.pop {
  position: fixed; z-index: 3; width: 170px; padding: 2px 16px; border-radius: 18px;
  top: calc(max(18px, env(safe-area-inset-top)) + var(--touch) + 4px); right: max(18px, env(safe-area-inset-right));
  background: rgba(38, 34, 62, .96); border: 1px solid rgba(207, 198, 238, .22); box-shadow: 0 10px 24px rgba(8, 6, 18, .4);
  text-align: left;
}
.pop .li { display: flex; align-items: center; min-height: var(--touch); font-size: 16px; color: #e6e1f4; text-decoration: none; border-bottom: 1px solid var(--card-border); }
.pop .li:last-child { border-bottom: 0; }
.pop .li:focus-visible { outline: 2px solid var(--fg-title); outline-offset: 2px; border-radius: 8px; }
.on { margin: 0 0 14px; font-size: 11px; letter-spacing: .06em; color: #a8a0c6; }
.ttl + .sub.narrow { max-width: 170px; }
.spc.grow { flex: 2; }

/* Quiet, static orb + ring (breathing itself lives in breathe.html) */
.stage { position: relative; width: 200px; height: 200px; flex: none; display: flex; align-items: center; justify-content: center; margin: 8px 0; }
.ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: var(--ring-width) solid rgba(var(--ring-rgb), .6);
  box-shadow: 0 0 8px rgba(var(--ring-glow-rgb), .15);
}
.orb { width: 100%; height: 100%; border-radius: 50%; background: var(--orb); transform: scale(var(--orb-min-scale)); }

@media (prefers-reduced-motion: no-preference) {
  .orb { animation: drift 8s ease-in-out infinite alternate; }
  @keyframes drift { to { transform: scale(.62); } }
}
#view-install .ttl { margin-top: 30px; }
