/* Peaceful Wind Chimes – neumorphism UI. MIT licensed. */
:root {
  --bg: #e6e9ef;
  --text: #333b50;
  --muted: #6c7690;
  --accent: #573AFC;
  --accent-soft: rgba(87, 58, 252, .14);
  --sh-d: rgba(150, 163, 188, .62);
  --sh-l: rgba(255, 255, 255, .95);
  --stage-top: #dfe3ec;
  --radius: 28px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #222633;
  --text: #e8ebf7;
  --muted: #9aa3bf;
  --accent: #9A7AFB;
  --accent-soft: rgba(154, 122, 251, .18);
  --sh-d: rgba(10, 12, 20, .72);
  --sh-l: rgba(62, 69, 96, .55);
  --stage-top: #1d202b;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  transition: background .3s, color .3s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

/* ---- neumorphic primitives ---- */
.raised { box-shadow: 6px 6px 14px var(--sh-d), -6px -6px 14px var(--sh-l); background: var(--bg); }
.inset  { box-shadow: inset 5px 5px 11px var(--sh-d), inset -5px -5px 11px var(--sh-l); background: var(--bg); }
.card   { background: var(--bg); border-radius: var(--radius); box-shadow: 10px 10px 22px var(--sh-d), -10px -10px 22px var(--sh-l); }

.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- header ---- */
.site-header { max-width: 1200px; margin: 0 auto; padding: 22px 22px 6px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; color: var(--accent); }
.ic-brand { width: 26px; height: 26px; stroke-width: 2.4; }
.brand-text { white-space: nowrap; display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.05rem; }
.brand-text small { color: var(--muted); font-size: .78rem; }
.header-right { display: flex; align-items: center; gap: 14px; }

/* ---- buttons ---- */
.btn {
  white-space: nowrap;
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 600; color: var(--text);
  background: var(--bg); border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 6px 6px 13px var(--sh-d), -6px -6px 13px var(--sh-l);
  transition: box-shadow .18s, color .18s, transform .18s; -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; color: var(--accent); }
.btn:active, .btn.is-on { box-shadow: inset 4px 4px 9px var(--sh-d), inset -4px -4px 9px var(--sh-l); color: var(--accent); }
.btn:focus-visible, .select:focus-visible, input[type=range]:focus-visible, .seg button:focus-visible, .chime:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn.pill { padding: 11px 20px; }
.btn.icon { width: 46px; height: 46px; padding: 0; }
.btn.big { padding: 18px 30px; font-size: 1.05rem; }
.btn.wide { width: 100%; }
#themeBtn .ic-moon { display: none; }
:root[data-theme="dark"] #themeBtn .ic-sun { display: none; }
:root[data-theme="dark"] #themeBtn .ic-moon { display: block; }
#soundBtn .ic-mute { display: none; }
#soundBtn[aria-pressed="true"] .ic-vol { display: none; }
#soundBtn[aria-pressed="true"] .ic-mute { display: block; }

/* ---- layout ---- */
.wrap { max-width: 1200px; margin: 0 auto; padding: 8px 22px 40px; }
.hero { text-align: center; padding: 22px 0 28px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(2rem, 4.6vw, 3.1rem); letter-spacing: -.02em; line-height: 1.1; }
.hero p { margin: 0 auto; max-width: 560px; color: var(--muted); font-size: 1.05rem; }
.layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 32px; align-items: stretch; }

/* ---- stage ---- */
.stage { position: relative; min-height: 620px; overflow: hidden; padding: 0;
  box-shadow: 10px 10px 22px var(--sh-d), -10px -10px 22px var(--sh-l); }
.stage::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 7px 7px 16px var(--sh-d), inset -7px -7px 16px var(--sh-l); }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#scene:active { cursor: grabbing; }
.stage-top { position: absolute; z-index: 2; top: 18px; left: 18px; right: 18px; display: flex; justify-content: space-between; align-items: center; gap: 10px; pointer-events: none; }
.stage-top > * { pointer-events: auto; }
.stage-actions { display: flex; align-items: center; gap: 10px; }
.chip { border-radius: 999px; padding: 9px 16px; display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: .9rem; color: var(--muted); }
.note-name { min-width: 2.7em; color: var(--text); font-variant-numeric: tabular-nums; }
.beads { display: inline-flex; gap: 6px; }
.bead { width: 11px; height: 11px; border-radius: 50%; background: var(--bg); box-shadow: inset 2px 2px 4px var(--sh-d), inset -2px -2px 4px var(--sh-l); }
.start { position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--accent); }
.start:active { transform: translate(-50%, -50%); }
.loader { position: absolute; z-index: 3; left: 50%; bottom: 74px; transform: translateX(-50%); }
.spin { width: 15px; height: 15px; border-radius: 50%; border: 2.5px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint { position: absolute; z-index: 2; left: 0; right: 0; bottom: 20px; margin: 0; text-align: center; font-size: .85rem; color: var(--muted); transition: opacity .8s; pointer-events: none; padding: 0 16px; }
.hint.gone { opacity: 0; }
kbd { font: inherit; font-size: .78rem; padding: 1px 8px; border-radius: 8px; box-shadow: 2px 2px 5px var(--sh-d), -2px -2px 5px var(--sh-l); }
.nogl { position: absolute; z-index: 2; top: 50%; left: 0; right: 0; margin: 0; padding: 0 28px; text-align: center; color: var(--muted); }

/* ---- panel ---- */
.panel { padding: 26px; display: flex; flex-direction: column; gap: 22px; }
.label { display: block; margin: 0 0 10px; font-size: .74rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.group { display: flex; flex-direction: column; gap: 16px; }
.group > .label { margin-bottom: 0; }

.picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.chime { appearance: none; border: 0; cursor: pointer; font: inherit; color: var(--muted); background: var(--bg); border-radius: 20px; padding: 10px 4px 9px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  box-shadow: 5px 5px 11px var(--sh-d), -5px -5px 11px var(--sh-l); transition: box-shadow .18s, color .18s; -webkit-tap-highlight-color: transparent; }
.chime img { width: 100%; max-width: 62px; height: 92px; object-fit: contain; display: block; }
.chime span { font-size: .72rem; font-weight: 700; line-height: 1.15; text-align: center; }
.chime:hover { color: var(--text); }
.chime[aria-checked="true"] { color: var(--accent); box-shadow: inset 4px 4px 9px var(--sh-d), inset -4px -4px 9px var(--sh-l); }

.slider { display: block; }
.slider .row { display: flex; justify-content: space-between; margin-bottom: 10px; font-weight: 600; font-size: .92rem; }
.slider output { color: var(--accent); font-variant-numeric: tabular-nums; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; border-radius: 99px; background: var(--bg); cursor: pointer;
  box-shadow: inset 3px 3px 6px var(--sh-d), inset -3px -3px 6px var(--sh-l); margin: 0; --fill: 50%; }
input[type=range]::-webkit-slider-runnable-track { height: 14px; border-radius: 99px; background: linear-gradient(90deg, var(--accent-soft) var(--fill), transparent var(--fill)); }
input[type=range]::-moz-range-track { height: 14px; border-radius: 99px; background: linear-gradient(90deg, var(--accent-soft) var(--fill), transparent var(--fill)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -6px; border-radius: 50%; border: 0; background: var(--bg);
  box-shadow: 4px 4px 9px var(--sh-d), -4px -4px 9px var(--sh-l), inset 0 0 0 8px var(--bg), inset 0 0 0 13px var(--accent); }
input[type=range]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--accent);
  box-shadow: 4px 4px 9px var(--sh-d), -4px -4px 9px var(--sh-l), 0 0 0 7px var(--bg) inset; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px; border-radius: 999px; box-shadow: inset 4px 4px 9px var(--sh-d), inset -4px -4px 9px var(--sh-l); }
.seg button { appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: .9rem; padding: 10px 6px; border-radius: 999px; cursor: pointer; transition: all .18s; }
.seg button[aria-checked="true"] { color: var(--accent); background: var(--bg); box-shadow: 4px 4px 9px var(--sh-d), -4px -4px 9px var(--sh-l); }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: end; }
.field { display: block; min-width: 0; }
.select { appearance: none; -webkit-appearance: none; width: 100%; border: 0; background: var(--bg); color: var(--text); font: inherit; font-weight: 600; font-size: .92rem;
  padding: 12px 38px 12px 16px; border-radius: 999px; cursor: pointer;
  box-shadow: inset 4px 4px 9px var(--sh-d), inset -4px -4px 9px var(--sh-l);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%238a93ad' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 15px center; }
.select option { background: var(--bg); color: var(--text); }

.footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 34px 6px 0; }
.footer p { margin: 0 auto; max-width: 760px; }

/* ---- responsive ---- */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; gap: 26px; }
  .stage { min-height: 500px; }
}
@media (max-width: 520px) {
  .site-header { padding: 16px 14px 4px; }
  .wrap { padding: 4px 14px 30px; }
  .brand-text small { display: none; }
  .btn.pill span { font-size: .88rem; }
  .btn.pill { padding: 10px 15px; }
  .stage { min-height: 440px; }
  .panel { padding: 20px 16px; }
  .picker { gap: 8px; }
  .chime img { height: 78px; }
  .two { grid-template-columns: 1fr; }
  .chip { padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .spin { animation-duration: 2s; } }

@media (hover: none) { .desk-only { display: none; } }
@media (max-width: 520px) { .stage { min-height: 500px; } .btn.big { padding: 16px 24px; } .hint { bottom: 14px; font-size: .8rem; } }
@media (max-width: 480px) { .brand-text { display: none; } .header-right { gap: 10px; } }
