/* Transponeerija */
:root {
    --tr-accent: #0f766e;
    --tr-accent-soft: rgba(15, 118, 110, 0.10);
    --tr-chord: #0f766e;
    --tr-shadow-1: 0 1px 2px rgba(17, 17, 26, .06), 0 4px 12px rgba(17, 17, 26, .08);
}
[data-theme="dark"] {
    --tr-accent: #5eb8ad;
    --tr-accent-soft: rgba(94, 184, 173, 0.14);
    --tr-chord: #7cc9bf;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --tr-accent: #5eb8ad;
        --tr-accent-soft: rgba(94, 184, 173, 0.14);
        --tr-chord: #7cc9bf;
    }
}

.tr-wrap [hidden] { display: none !important; }
.tr-section { padding-top: 24px; }
.tr-wrap { max-width: 1100px; }

.tr-head { margin-bottom: 16px; }
.tr-head .title { letter-spacing: -0.01em; margin-bottom: 4px; }
.tr-lead { color: var(--text-secondary); font-size: 1rem; }

.tr-tabs { margin-bottom: 16px; }
.tr-tabs a { color: var(--text-secondary); }
.tr-tabs li.is-active a { color: var(--tr-accent); border-bottom-color: var(--tr-accent); }

.tr-wrap .button.is-ghost { color: var(--tr-accent); }
@media (hover: hover) {
    .tr-wrap .button.is-ghost:hover { color: var(--tr-accent); text-decoration: underline; }
}

.tr-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: var(--tr-shadow-1);
    padding: 16px;
    margin-bottom: 16px;
}

/* Faili valik */
.tr-drop {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    border: 1.5px dashed var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 150ms, background-color 150ms;
}
.tr-drop:hover, .tr-drop.is-over { border-color: var(--tr-accent); background: var(--tr-accent-soft); }
#trSource:has(#trFile:focus-visible) .tr-drop { outline: 2px solid var(--tr-accent); outline-offset: 2px; }
.tr-drop-icon {
    flex: none;
    width: 48px; height: 48px;
    display: grid; place-items: center;
    border-radius: 12px;
    background: var(--tr-accent-soft);
    color: var(--tr-accent);
    font-size: 1.25rem;
}
.tr-drop-text { display: flex; flex-direction: column; gap: 2px; color: var(--text-secondary); font-size: 0.875rem; }
.tr-drop-text strong { color: var(--text-primary); font-size: 1rem; }

.tr-source-foot { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; margin-top: 12px; }
.tr-howto { flex: 1 1 260px; font-size: 0.875rem; color: var(--text-secondary); }
.tr-howto summary { cursor: pointer; color: var(--text-link, var(--tr-accent)); padding: 4px 0; }
.tr-howto ol { margin: 8px 0 8px 20px; }
.tr-howto li { margin-bottom: 4px; }

/* Juhtpaneel */
.tr-file-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.tr-file-meta { display: flex; flex-direction: column; min-width: 0; }
.tr-file-title { font-weight: 600; font-size: 1.125rem; color: var(--text-primary); overflow-wrap: anywhere; }
.tr-file-name { font-size: 0.75rem; color: var(--text-muted); overflow-wrap: anywhere; }
.tr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.tr-grid .field { margin-bottom: 0; }

.tr-seg { display: flex; border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.tr-seg button {
    flex: 1 1 0;
    min-height: 40px;
    padding: 6px 8px;
    border: 0;
    border-left: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 150ms, color 150ms;
}
.tr-seg button:first-child { border-left: 0; }
.tr-seg button[aria-pressed="true"] { background: var(--tr-accent); color: #fff; font-weight: 600; }
[data-theme="dark"] .tr-seg button[aria-pressed="true"] { color: #0b1f1d; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .tr-seg button[aria-pressed="true"] { color: #0b1f1d; }
}
@media (hover: hover) {
    .tr-seg button[aria-pressed="false"]:hover { background: var(--bg-hover); }
}

.tr-instr { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-top: 16px; }
.tr-instr-label { font-size: 0.875rem; color: var(--text-secondary); }
.tr-instr .buttons { margin-bottom: 0; }

.tr-warn {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    border-left: 4px solid #d97706;
    color: var(--text-primary);
    font-size: 0.875rem;
}
.tr-actions { margin-top: 16px; margin-bottom: 0; }
.tr-actions .button.is-primary { background: var(--tr-accent); font-weight: 600; }
[data-theme="dark"] .tr-actions .button.is-primary { color: #0b1f1d; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .tr-actions .button.is-primary { color: #0b1f1d; }
}

/* Mängijariba — jääb pika pala kerimisel nähtavale */
.tr-player {
    position: sticky;
    top: 8px;
    z-index: 5;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 24px;
    padding: 12px 16px;
}
.tr-player-main { display: flex; gap: 8px; }
.tr-play { min-width: 112px; min-height: 44px; background: var(--tr-accent); border-color: transparent; color: #fff; font-weight: 600; }
.tr-play:hover, .tr-play:focus { color: #fff; }
[data-theme="dark"] .tr-play, [data-theme="dark"] .tr-play:hover { color: #0b1f1d; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .tr-play, :root:not([data-theme="light"]) .tr-play:hover { color: #0b1f1d; }
}
.tr-icon-btn { width: 44px; height: 44px; }
.tr-tempo, .tr-from { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--text-secondary); }
.tr-tempo { flex: 1 1 220px; }
.tr-tempo input[type="range"] { flex: 1 1 auto; min-width: 100px; accent-color: var(--tr-accent); }
.tr-tempo output { min-width: 4.5em; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.tr-from .input { width: 72px; }

/* Noodipaber jääb valgeks ka tumedas teemas — noot on must tint paberil. */
.tr-paper {
    position: relative;
    background: #fff;
    color: #111;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px;
    min-height: 160px;
    overflow-x: auto;
}
.tr-loading {
    position: absolute;
    top: 12px; right: 16px;
    display: flex; align-items: center; gap: 8px;
    font-size: 0.875rem;
    color: #555;
}

/* Akordid */
.tr-chord-controls { display: grid; grid-template-columns: auto 1fr 1fr; gap: 16px; align-items: start; }
.tr-chord-controls .field { margin-bottom: 0; }
.tr-stepper-row { display: flex; align-items: center; gap: 8px; }
.tr-stepper-row .button:not(.is-ghost) { width: 44px; height: 44px; }
.tr-semis {
    min-width: 3ch;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--tr-accent);
}

.tr-chord-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
/* Ilma selleta venitab <pre> veeru oma pikima rea laiuseks ja leht voolab mobiilis üle. */
.tr-chord-grid > * { min-width: 0; }
.tr-col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; min-height: 40px; margin-bottom: 8px; }
.tr-col-head .label { margin-bottom: 0; }
.tr-col-head .buttons { margin-bottom: 0; }
.tr-mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.875rem; line-height: 1.5; }
/* Akordid ja tab on veergudes — murdmine nihutaks need silpidest/keeltest lahku. */
textarea.tr-mono { min-height: 360px; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
.tr-output {
    min-height: 360px;
    margin: 0;
    padding: 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    white-space: pre;
    overflow-x: auto;
}
.tr-chord { color: var(--tr-chord); font-weight: 700; }
.tr-tab { color: var(--text-secondary); }
.tr-listen-hint { margin: -4px 0 8px; color: var(--text-secondary); }
.tr-playable { cursor: pointer; border-radius: 3px; transition: background-color 150ms; }
@media (hover: hover) {
    .tr-playable:hover { background: var(--tr-accent-soft); }
}
.tr-playable.is-playing { background: var(--tr-accent-soft); outline: 1px solid var(--tr-accent); }
.tr-tabfix { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--text-primary); }
.tr-tabfix input { width: 18px; height: 18px; accent-color: var(--tr-accent); }
.tr-notes {
    margin: -4px 0 16px;
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--tr-accent);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.875rem;
}
.tr-notes p + p { margin-top: 4px; }

@media (max-width: 768px) {
    .tr-chord-controls { grid-template-columns: 1fr 1fr; }
    .tr-stepper { grid-column: 1 / -1; }
    .tr-chord-grid { grid-template-columns: 1fr; }
    textarea.tr-mono, .tr-output { min-height: 220px; }
}
@media (max-width: 480px) {
    .tr-drop { padding: 16px; }
    .tr-chord-controls { grid-template-columns: 1fr; }
}

/* Printimine: ainult valitud tulemus */
@media print {
    .navbar, footer, .footer, .tr-noprint, #toast-container, .toast-container { display: none !important; }
    html, body { background: #fff !important; transition: none !important; }
    .tr-section { padding: 0 !important; }
    .tr-chord-grid { display: block; }
    body.tr-print-notes #trPanelChords,
    body.tr-print-chords #trPanelNotes { display: none !important; }
    .tr-paper { border: 0; padding: 0; overflow: visible; }
    .tr-output { background: #fff !important; color: #000 !important; border: 0; min-height: 0; white-space: pre-wrap; font-size: 11pt; }
    .tr-chord, .tr-tab { color: #000 !important; }
}
