/* Echuni base components. Depends on tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  background-color: var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
a { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }

/* Wordmark: lowercase "echuni" whose i-dot is the cyan voice point of the symbol */
.wordmark { font-weight: 600; letter-spacing: -0.035em; line-height: 1.1; white-space: nowrap; }
.wordmark .i { position: relative; display: inline-block; }
.wordmark .i::after {
  content: ""; position: absolute; left: 50%; top: 0.12em;
  width: 0.15em; height: 0.15em; margin-left: -0.075em; border-radius: 50%;
  background: var(--accent);
}

/* Panels: frosted glass with a lit edge, like the layers of the app icon – the page light shines
   through blurred, the upper edge catches the light */
.panel {
  background: var(--sheen), var(--panel); border: 1px solid var(--rim); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.panel-title { font-size: 15px; font-weight: 600; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 12px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--rim);
  background: var(--sheen), var(--panel); color: var(--text); font-weight: 600; font-size: 14px; box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(12px) saturate(160%); backdrop-filter: blur(12px) saturate(160%);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--sheen), var(--panel-raised); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--grad-primary); border-color: transparent; color: var(--on-primary); box-shadow: var(--glow-primary); }
.btn-primary:hover { background: var(--grad-primary); filter: brightness(1.08); }
.btn-danger { background: linear-gradient(180deg, #F97066, #D92D20); border-color: transparent; color: #FFFFFF;
              box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 8px 20px rgba(217, 45, 32, 0.28); }
.btn-danger:hover { background: linear-gradient(180deg, #F97066, #D92D20); filter: brightness(0.92); }
.btn-ghost { background: transparent; border-color: var(--border); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.btn-ghost:hover { background: var(--panel-2); }
.btn-lg { min-height: 54px; font-size: 16px; border-radius: 14px; padding: 0 20px; }
.btn-block { width: 100%; }
.btn svg { flex: none; }
.icon-btn { width: 44px; padding: 0; }

/* Form fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, .select {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 12px;
  background-color: var(--field); box-shadow: var(--field-shadow); color: var(--text); width: 100%;
}
.hint { font-size: 13px; color: var(--text-2); }
.error-text { font-size: 13px; color: var(--error); }

/* Chips and badges */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-live { background: var(--success-bg); color: var(--success); }
.chip-live .dot { background: var(--live); box-shadow: var(--glow-voice); }
.chip-warn { background: var(--warning-bg); color: var(--warning); }
.chip-error { background: var(--error-bg); color: var(--error); }
.chip-info { background: var(--info-bg); color: var(--info); }
.chip-neutral { background: var(--panel-2); color: var(--text-2); }
.badge-live { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; }
.lang-code { flex: none; display: inline-block; min-width: 34px; padding: 3px 6px; border-radius: 6px; background: var(--panel-2); text-align: center; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }

/* Level meter */
.meter { display: grid; grid-template-columns: repeat(var(--segments, 20), minmax(0, 1fr)); gap: 2px; height: 10px; }
.meter > span { border-radius: 2px; background: var(--wave-off); }
.meter > span.on-ok { background: var(--live); box-shadow: 0 0 6px rgba(99, 214, 208, 0.45); }
.meter > span.on-hot { background: #F79009; }
.meter > span.on-clip { background: var(--danger); }

/* Theme switch */
.theme-switch { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--panel-2); gap: 2px; box-shadow: var(--field-shadow); }
.theme-switch button {
  min-height: 36px; min-width: 40px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 600;
}
.theme-switch button[aria-pressed="true"] { background: var(--sheen), var(--panel-raised); color: var(--text); box-shadow: var(--shadow-sm); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 500; z-index: 50;
}
