/* Web Harmonium — warm acoustic look, mobile-first, no external assets. */

:root {
  --bg: #1c1410;
  --bg-soft: #2a1f17;
  --panel: #33251a;
  --panel-edge: #4a3626;
  --wood: #5b3d24;
  --wood-hi: #7a5533;
  --text: #f3e9dc;
  --text-dim: #c9b49a;
  --accent: #e8a94b;
  --accent-soft: #b97f2e;
  --key-white: #f7f1e3;
  --key-white-press: #e8d9b8;
  --key-black: #241a12;
  --key-black-press: #3d2c1d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  line-height: 1.55;
}

body {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

header { text-align: center; margin: 8px 0 18px; }
header h1 {
  font-size: 1.55rem;
  margin: 0 0 4px;
  letter-spacing: 0.5px;
}
header h1 .accent { color: var(--accent); }
header p.tagline { margin: 0; color: var(--text-dim); font-size: 0.95rem; }

/* ---- Stage / keyboard ---- */
.stage {
  background: linear-gradient(180deg, var(--wood-hi), var(--wood));
  border: 2px solid #2e2015;
  border-radius: 14px;
  padding: 14px 12px 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.15);
  position: relative;
}

#keyboard {
  position: relative;
  height: 190px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.key {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 0 0 7px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 10px;
  cursor: pointer;
}

.key.white {
  background: linear-gradient(180deg, #fffdf6 0%, var(--key-white) 82%, #ddd0b4 100%);
  border: 1px solid #b8a888;
  box-shadow: inset 0 -5px 0 rgba(120,95,55,0.25);
  color: #6b5537;
  z-index: 1;
}

.key.black {
  background: linear-gradient(180deg, #38281a 0%, var(--key-black) 70%, #120c07 100%);
  border: 1px solid #000;
  height: 60%;
  bottom: auto;
  box-shadow: 0 4px 6px rgba(0,0,0,0.5), inset 0 -4px 0 rgba(255,255,255,0.06);
  color: #cbb08e;
  z-index: 2;
}

.key.white.active {
  background: linear-gradient(180deg, var(--key-white-press) 0%, #dcc99d 90%);
  box-shadow: inset 0 -2px 0 rgba(120,95,55,0.35);
  transform: translateY(1px);
}
.key.black.active {
  background: linear-gradient(180deg, #4d3826 0%, var(--key-black-press) 70%);
  transform: translateY(1px);
}

.key .note { font-size: 0.78rem; font-weight: 600; pointer-events: none; }
.key.black .note { font-size: 0.62rem; }
.key .note sup { font-size: 0.62em; }
.key .kbd-hint {
  font-size: 0.6rem;
  color: var(--accent-soft);
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 4px;
  padding: 0 4px;
  margin-top: 3px;
  pointer-events: none;
}
.key.black .kbd-hint { color: #d9a75c; border-color: rgba(255,255,255,0.15); }
.key .sargam {
  font-size: 0.62rem;
  color: #9c1f2e;
  min-height: 0.9em;
  margin-top: 2px;
  pointer-events: none;
}
.key.black .sargam { color: #e6b45c; }
.key.is-sa .sargam { font-weight: 700; }
.key.is-sa.white { box-shadow: inset 0 -5px 0 rgba(156,31,46,0.35); }
.key.is-sa.black { box-shadow: 0 4px 6px rgba(0,0,0,0.5), inset 0 -4px 0 rgba(230,180,92,0.4); }

@media (max-width: 480px) {
  #keyboard { height: 170px; }
  .key .kbd-hint { display: none; } /* no hardware keyboard on the go */
  .key .note { font-size: 0.68rem; }
  header h1 { font-size: 1.25rem; }
}

#tap-hint {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  background: rgba(20,12,6,0.82);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.95rem;
  z-index: 5;
  pointer-events: none;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.95; }
  50% { opacity: 0.55; }
}

/* ---- Controls ---- */
.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  padding: 12px 14px;
}
.panel h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  margin: 0 0 10px;
}

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.row label { font-size: 0.85rem; color: var(--text-dim); min-width: 84px; }

button.ui {
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.85rem;
  cursor: pointer;
}
button.ui.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #1c1410;
  font-weight: 600;
}
button.ui[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }

.sa-btn { min-width: 38px; }
.sa-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #1c1410;
  font-weight: 700;
}

input[type="range"] { flex: 1; min-width: 90px; accent-color: var(--accent); }
input[type="number"] {
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 5px 7px;
  width: 76px;
  font-size: 0.85rem;
}

.status { font-size: 0.85rem; color: var(--text-dim); }
.status.ok { color: #9fce91; }
.status.err { color: #e08a7a; }
#latency-info { font-size: 0.78rem; color: var(--text-dim); }
.latency-note { font-size: 0.78rem; color: var(--text-dim); margin-top: 6px; }

/* ---- Content sections ---- */
section.text { margin-top: 28px; }
section.text h2 {
  font-size: 1.15rem;
  border-bottom: 1px solid var(--panel-edge);
  padding-bottom: 6px;
}
section.text h3 { font-size: 0.98rem; color: var(--accent); margin-bottom: 4px; }

kbd {
  background: var(--bg-soft);
  border: 1px solid var(--panel-edge);
  border-bottom-width: 3px;
  border-radius: 5px;
  padding: 1px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
}

.faq details {
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 8px 0;
  background: var(--bg-soft);
}
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 2px; color: var(--text-dim); }

footer {
  margin-top: 36px;
  padding-top: 14px;
  border-top: 1px solid var(--panel-edge);
  font-size: 0.8rem;
  color: var(--text-dim);
}
footer a { color: var(--accent); }
