/* Тема: совпадает с shadcn-подобными токенами сайта; родитель шлёт postMessage chords-theme */
html[data-theme="light"] {
  --tuner-bg: oklch(1 0 0);
  --tuner-fg: oklch(0.145 0 0);
  --tuner-accent: #e74c3c;
  --tuner-muted: oklch(0.556 0 0);
  --modal-bg: oklch(1 0 0);
  --modal-fg: oklch(0.145 0 0);
  --modal-muted: oklch(0.556 0 0);
  --modal-border: oklch(0.922 0 0);
  --modal-overlay: oklch(0.145 0 0 / 0.4);
  --modal-ring: oklch(0.708 0 0);
  --modal-primary: oklch(0.205 0 0);
  --modal-primary-fg: oklch(0.985 0 0);
  --modal-secondary: oklch(0.97 0 0);
  --modal-secondary-fg: oklch(0.205 0 0);
  color-scheme: light;
}

html[data-theme="dark"] {
  --tuner-bg: oklch(0.145 0 0);
  --tuner-fg: oklch(0.985 0 0);
  --tuner-accent: #f87171;
  --tuner-muted: oklch(0.708 0 0);
  --modal-bg: oklch(0.205 0 0);
  --modal-fg: oklch(0.985 0 0);
  --modal-muted: oklch(0.708 0 0);
  --modal-border: oklch(1 0 0 / 12%);
  --modal-overlay: oklch(0 0 0 / 0.55);
  --modal-ring: oklch(0.556 0 0);
  --modal-primary: oklch(0.922 0 0);
  --modal-primary-fg: oklch(0.205 0 0);
  --modal-secondary: oklch(0.269 0 0);
  --modal-secondary-fg: oklch(0.985 0 0);
  color-scheme: dark;
}

html {
  height: 100%;
}

body {
  position: fixed;
  font-family: sans-serif;
  color: var(--tuner-fg);
  background: var(--tuner-bg);
  margin: 0;
  width: 100%;
  height: 100%;
  cursor: default;
  user-select: none;
}

.notes {
  margin: auto;
  width: 400px;
  position: fixed;
  top: 50%;
  left: 0;
  right: 0;
  text-align: center;
}

.note {
  font-size: 90px;
  font-weight: bold;
  position: relative;
  display: inline-block;
  padding-right: 30px;
  padding-left: 10px;
}

.note.active {
  color: var(--tuner-accent);
}

.notes-list {
  overflow: auto;
  overflow: -moz-scrollbars-none;
  white-space: nowrap;
  -ms-overflow-style: none;
  -webkit-mask-image: -webkit-linear-gradient(
    left,
    transparent,
    var(--tuner-bg),
    transparent
  );
}

.notes-list::-webkit-scrollbar {
  display: none;
}

.note {
  -webkit-tap-highlight-color: transparent;
}

.note span {
  position: absolute;
  right: 0.25em;
  font-size: 40%;
  font-weight: normal;
}

.note-sharp {
  top: 0.3em;
}

.note-octave {
  bottom: 0.3em;
}

.frequency {
  font-size: 32px;
}

.frequency span {
  font-size: 50%;
  margin-left: 0.25em;
}

.meter {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 50%;
  width: 400px;
  height: 33%;
  margin: 0 auto 5vh auto;
}

.meter-pointer {
  width: 2px;
  height: 100%;
  background: var(--tuner-fg);
  transform: rotate(45deg);
  transform-origin: bottom;
  transition: transform 0.5s;
  position: absolute;
  right: 50%;
}

.meter-dot {
  width: 10px;
  height: 10px;
  background: var(--tuner-fg);
  border-radius: 50%;
  position: absolute;
  bottom: -5px;
  right: 50%;
  margin-right: -4px;
}

.meter-scale {
  width: 1px;
  height: 100%;
  transform-origin: bottom;
  transition: transform 0.2s;
  box-sizing: border-box;
  border-top: 10px solid;
  position: absolute;
  right: 50%;
}

.meter-scale-strong {
  width: 2px;
  border-top-width: 20px;
}

.frequency-bars {
  position: fixed;
  bottom: 0;
}

@media (max-width: 768px) {
  .meter {
    width: 100%;
  }

  .notes {
    width: 100%;
  }
}

/* Кнопка A4 рендерится в родительском приложении (поверх iframe) — здесь скрыта */
.a4 {
  position: absolute;
  top: 16px;
  left: 16px;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--tuner-fg);
  font: inherit;
  cursor: pointer;
  visibility: hidden;
  pointer-events: none;
}

.a4 span {
  color: var(--tuner-accent);
}

/* Минималистичная модалка в стиле сайта */
.a4-modal {
  position: fixed;
  inset: 0;
  z-index: 10;
}

.a4-modal__backdrop {
  position: absolute;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(2px);
}

.a4-modal__panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(280px, calc(100% - 32px));
  background: var(--modal-bg);
  color: var(--modal-fg);
  border: 1px solid var(--modal-border);
  border-radius: 0.625rem;
  box-shadow: 0 16px 48px oklch(0 0 0 / 0.12);
  padding: 1rem 1rem 0.75rem;
}

html[data-theme="dark"] .a4-modal__panel {
  box-shadow: 0 16px 48px oklch(0 0 0 / 0.45);
}

.a4-modal__title {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--modal-muted);
}

.a4-modal__hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--modal-muted);
}

.a4-modal__input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--modal-border);
  border-radius: 0.5rem;
  background: var(--modal-bg);
  color: var(--modal-fg);
  outline: none;
}

.a4-modal__input:focus {
  box-shadow: 0 0 0 2px var(--modal-bg), 0 0 0 4px var(--modal-ring);
}

.a4-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--modal-border);
}

.a4-modal__btn {
  border: 0;
  border-radius: 0.5rem;
  font: inherit;
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
  cursor: pointer;
}

.a4-modal__btn--ghost {
  background: var(--modal-secondary);
  color: var(--modal-secondary-fg);
}

.a4-modal__btn--primary {
  background: var(--modal-primary);
  color: var(--modal-primary-fg);
}

.a4-modal__btn:focus-visible {
  outline: 2px solid var(--modal-ring);
  outline-offset: 2px;
}
