﻿:root {
  color-scheme: dark;
  --bg: #0a0b0f;
  --card: #12141c;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --primary: #818cf8;
  --cyan: #06b6d4;
  --line: #282b38;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; padding: 32px 20px; }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; transition: background .15s, border-color .15s; }
button:disabled, input:disabled { cursor: not-allowed; opacity: .5; }
button, input, summary, a { outline-offset: 4px; }
:focus-visible { outline: 2px solid var(--primary); }
a { color: var(--primary); text-underline-offset: 3px; }
[hidden] { display: none !important; }
.app-container { max-width: 760px; margin: 0 auto; }
.app-header { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.chirper-logo { width: 60px; height: 60px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
h1 { font-size: 29px; font-weight: 750; letter-spacing: -.7px; }
.app-header p { color: var(--muted); font-size: 14px; margin-top: 3px; }
.intro { color: var(--muted); font-size: 14px; line-height: 1.65; margin-bottom: 14px; }
.listening-note { display: flex; align-items: flex-start; gap: 9px; color: #d4b27a; font-size: 12px; line-height: 1.6; margin-bottom: 22px; }
.listening-note svg { flex: 0 0 17px; width: 17px; height: 17px; margin-top: 2px; }
.workspace { border: 1px solid var(--line); border-radius: 20px; background: var(--card); padding: 26px; box-shadow: 0 4px 20px #0004; }
.section-heading { margin-bottom: 18px; }
h2 { font-size: 17px; font-weight: 650; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; margin-bottom: 9px; }
label { font-weight: 500; }
#character-count { font: 12px var(--mono); color: var(--muted); }
#encoder-message { width: 100%; min-width: 0; background: #0a0b10; border: 1px solid #343849; border-radius: 8px; padding: 13px 15px; font-size: 18px; color: var(--text); }
#encoder-message::placeholder { font-size: 16px; color: #8b91a2; }
.field-help { margin-top: 9px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.morse-preview { margin: 18px 0; border: 1px solid #242737; border-radius: 10px; background: #08090d; padding: 13px 16px 0; overflow: hidden; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; font: 10px var(--mono); letter-spacing: .6px; color: var(--muted); }
.signal-status { font: 12px "Segoe UI", sans-serif; letter-spacing: 0; }
.signal-status::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #5d6376; }
.morse-code { position: relative; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 5px 15px; min-height: 82px; max-height: 150px; overflow-y: auto; padding: 12px 0; }
.code-letter { display: inline-flex; flex-direction: column; align-items: center; padding: 3px; border-radius: 4px; color: var(--cyan); }
.code-letter .symbols { font: 600 24px var(--mono); letter-spacing: 2px; line-height: 1.2; white-space: nowrap; }
.code-letter .letter { font: 11px var(--mono); margin-top: 6px; color: var(--muted); }
.code-letter.active { background: #262d51; color: #c7d2fe; }
.code-letter.active .letter { color: #e0e7ff; }
.code-letter.sent { opacity: .55; }
.word-gap { align-self: center; font: 16px var(--mono); color: var(--muted); }
.empty-preview { font-size: 13px; color: var(--muted); }
.signal-line { height: 2px; background: #202439; margin: 0 -16px; }
.signal-line span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--cyan)); opacity: 0; }
body.sounding .signal-line span { opacity: 1; }
body.sounding .signal-status::before { background: var(--cyan); }
.playback-row { display: flex; align-items: center; gap: 30px; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 190px; gap: 10px; min-height: 46px; border: 1px solid var(--primary); border-radius: 8px; color: #080b1a; background: var(--primary); font-size: 14px; font-weight: 650; }
.primary-button:hover:not(:disabled) { background: #a5b4fc; }
#transmit-icon { font-size: 12px; }
.speed-control { flex: 1; min-width: 0; max-width: 240px; margin-left: auto; }
.speed-control .label-row { margin-bottom: 0; }
output { font: 13px var(--mono); white-space: nowrap; }
output span { color: var(--muted); font-size: 12px; }
input[type="range"] { --fill: 0%; width: 100%; height: 34px; margin: 0; background: transparent; cursor: pointer; appearance: none; -webkit-appearance: none; }
input[type="range"]::-webkit-slider-runnable-track { height: 5px; border-radius: 5px; background: linear-gradient(to right, var(--primary) var(--fill), #343849 var(--fill)); }
input[type="range"]::-moz-range-track { height: 5px; border-radius: 5px; background: linear-gradient(to right, var(--primary) var(--fill), #343849 var(--fill)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; height: 20px; width: 20px; margin-top: -7.5px; border-radius: 50%; border: 3px solid var(--card); background: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
input[type="range"]::-moz-range-thumb { height: 14px; width: 14px; border-radius: 50%; border: 3px solid var(--card); background: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.sound-panel { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 22px; }
.pitch-description { color: var(--muted); font-size: 12px; text-align: right; }
.frequency-readout { display: flex; align-items: baseline; justify-content: center; gap: 10px; margin: 12px 0; }
.frequency-readout input { width: 185px; max-width: 80%; border: 0; border-bottom: 1px dashed #454b66; border-radius: 0; background: transparent; padding: 0 0 4px; font: 46px var(--mono); letter-spacing: -2px; color: var(--text); appearance: textfield; -moz-appearance: textfield; }
.frequency-readout input::-webkit-inner-spin-button, .frequency-readout input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.frequency-readout > span { font: 20px var(--mono); color: var(--cyan); }
.range-labels { display: flex; justify-content: space-between; font: 12px var(--mono); color: var(--muted); }
.reference-label { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 13px; margin: 22px 0 10px; }
.reference-label > span { font-size: 12px; color: var(--muted); }
.preset-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.preset { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; padding: 13px 12px; color: var(--text); background: #161925; border: 1px solid #303447; border-radius: 9px; }
.preset strong { font: 600 16px var(--mono); }
.preset span { font: 12px/1.5 "Segoe UI", sans-serif; color: var(--muted); }
.preset .age-label { color: #a5b4fc; font-weight: 600; }
.preset[data-freq="15000"] .age-label { color: #22d3ee; }
.preset[data-freq="17400"] .age-label { color: #34d399; }
.preset[data-freq="20000"] .age-label { color: #fbbf24; }
.preset:hover { background: #202439; border-color: #515b7a; }
.preset[aria-pressed="true"] { border-color: var(--primary); background: #20243b; }
.volume-control { margin-top: 22px; }
.volume-control .label-row { margin-bottom: 0; }
.volume-row { display: flex; align-items: center; gap: 10px; }
.mute-button { flex: 0 0 36px; display: grid; place-items: center; min-height: 36px; border: 0; background: transparent; color: var(--muted); border-radius: 5px; }
.mute-button:hover { background: #252a3d; color: var(--text); }
.mute-button svg { width: 20px; height: 20px; }
.volume-labels { margin-left: 46px; font-family: inherit; }
.test-button { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 42px; width: 100%; margin-top: 18px; border: 1px solid #444b6b; border-radius: 8px; background: #1a1e2e; color: #c7d2fe; font-size: 13px; font-weight: 600; }
.test-button:hover:not(:disabled), .test-button[aria-pressed="true"] { background: #293150; border-color: var(--primary); }
#test-icon { font-size: 17px; }
.test-help { margin-top: 8px; font-size: 12px; color: var(--muted); text-align: center; }
.manual-section { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 22px; }
.manual-section > div { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
h3 { font-size: 15px; font-weight: 600; }
.manual-section > div p { font-size: 12px; color: var(--muted); }
.morse-key { display: flex; justify-content: center; align-items: center; gap: 15px; width: 100%; margin-top: 13px; min-height: 52px; border: 1px solid #3d4563; border-bottom-width: 3px; border-radius: 9px; background: #1a1e2e; color: var(--text); font-size: 13px; touch-action: none; user-select: none; -webkit-user-select: none; }
.morse-key:hover:not(:disabled) { background: #242b43; }
.morse-key.key-active { background: #303968; border-color: var(--primary); transform: translateY(1px); }
.key-symbol { font: bold 24px var(--mono); color: var(--cyan); line-height: 1; }
kbd { padding: 3px 7px; border: 1px solid #42485e; border-radius: 4px; font: 11px var(--mono); color: var(--muted); }
.manual-section > .field-help { text-align: center; }
.reference { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; cursor: pointer; list-style: none; font-size: 14px; font-weight: 600; }
summary::-webkit-details-marker { display: none; }
.disclosure { color: var(--primary); font: 21px var(--mono); }
details[open] .disclosure { transform: rotate(45deg); }
.reference-content { padding: 0 20px 20px; }
.reference-content > p { font-size: 12px; line-height: 1.6; color: var(--muted); margin-bottom: 16px; }
.alphabet-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px 20px; }
.alphabet-item { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; padding: 7px 0; font: 13px var(--mono); border-bottom: 1px solid var(--line); }
.alphabet-item span:last-child { color: var(--cyan); letter-spacing: 1px; white-space: nowrap; }
@media (max-width: 560px) {
  body { padding: 22px 16px; }
  .workspace { padding: 20px 16px; border-radius: 16px; }
  .preset-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .playback-row { gap: 20px; }
  .primary-button { flex-basis: 150px; font-size: 13px; }
  .speed-control .label-row { flex-wrap: wrap; gap: 4px; font-size: 12px; }
  .alphabet-grid { grid-template-columns: repeat(3, 1fr); gap: 6px 16px; }
  .pitch-description { max-width: 65%; }
}
@media (max-width: 360px) {
  .playback-row { gap: 14px; }
  .primary-button { flex-basis: 135px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
