.tr-app { max-width: 680px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }

/* Lang bar */
.tr-lang-bar { display: flex; align-items: center; gap: 8px; }
.tr-lang-select {
    flex: 1; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: var(--radius);
    font-size: 14px; background: var(--bg); color: var(--text); outline: none; cursor: pointer;
}
.tr-lang-select:focus { border-color: var(--primary-light); }
.tr-swap-btn {
    background: var(--bg-2); border: 1.5px solid var(--border); border-radius: 50%;
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-2); flex-shrink: 0; transition: all 0.15s;
}
.tr-swap-btn:hover { background: var(--border); color: var(--text); }
.tr-scan-btn {
    display: flex; align-items: center; gap: 6px; padding: 8px 14px;
    background: var(--primary); color: #fff; border: none; border-radius: var(--radius);
    font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background 0.15s; flex-shrink: 0;
}
.tr-scan-btn:hover { background: var(--primary-dark); }

/* Input */
.tr-input-wrap { position: relative; }
.tr-input {
    width: 100%; padding: 12px 14px 36px;
    border: 1.5px solid var(--border); border-radius: var(--radius);
    font-size: 16px; font-family: inherit; resize: vertical; min-height: 100px;
    outline: none; transition: border-color 0.15s; line-height: 1.5;
}
.tr-input:focus { border-color: var(--primary-light); }
.tr-input-actions {
    position: absolute; bottom: 10px; left: 12px; right: 12px;
    display: flex; align-items: center; gap: 8px;
}
.tr-char-count { font-size: 11px; color: var(--text-2); }
.tr-clear-btn {
    background: none; border: none; font-size: 12px; color: var(--text-2); cursor: pointer;
}
.tr-clear-btn:hover { color: var(--text); }
.tr-play-src-btn {
    margin-left: auto; background: none; border: 1.5px solid var(--border); border-radius: 50%;
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-2); transition: all 0.15s;
}
.tr-play-src-btn:hover { border-color: var(--primary-light); color: var(--primary-dark); }

/* Translate button */
.tr-translate-btn {
    padding: 11px; background: var(--primary); color: #fff; border: none;
    border-radius: var(--radius); font-size: 15px; font-weight: 700; cursor: pointer;
    transition: background 0.15s;
}
.tr-translate-btn:hover { background: var(--primary-dark); }
.tr-translate-btn:disabled { background: var(--border); color: var(--text-2); cursor: not-allowed; }

/* Result */
.tr-result-wrap {
    border: 1.5px solid var(--primary-light); border-radius: var(--radius);
    background: #f0faf0; overflow: hidden;
}
.tr-result-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1px solid var(--primary-light);
}
.tr-result-lang-label { font-size: 12px; font-weight: 700; color: var(--primary-dark); text-transform: uppercase; letter-spacing: 0.5px; }
.tr-result-actions { display: flex; gap: 6px; }
.tr-action-btn {
    display: flex; align-items: center; gap: 5px;
    padding: 5px 10px; border: 1.5px solid var(--primary-light); border-radius: 6px;
    background: transparent; font-size: 12px; font-weight: 600; color: var(--primary-dark);
    cursor: pointer; transition: all 0.15s;
}
.tr-action-btn:hover { background: var(--primary-light); }
.tr-save-btn { border-color: var(--accent); color: #B8871A; }
.tr-save-btn:hover { background: #fff8e1; }
.tr-result-text { padding: 16px 14px; font-size: 22px; line-height: 1.6; color: var(--text); min-height: 60px; }

/* History */
.tr-history { background: var(--bg-2); border-radius: var(--radius); padding: 12px; }
.tr-history-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tr-history-title { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-2); letter-spacing: 0.5px; }
.tr-history-clear { background: none; border: none; font-size: 12px; color: var(--text-2); cursor: pointer; }
.tr-history-clear:hover { color: var(--text); }
.tr-history-list { display: flex; flex-direction: column; gap: 6px; }
.tr-history-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    background: var(--bg); border-radius: 8px; border: 1px solid var(--border); cursor: pointer;
    transition: border-color 0.12s;
}
.tr-history-item:hover { border-color: var(--primary-light); }
.tr-history-texts { flex: 1; min-width: 0; }
.tr-history-src { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-history-tgt { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-history-play {
    background: none; border: 1.5px solid var(--border); border-radius: 50%;
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-2); flex-shrink: 0; transition: all 0.15s;
}
.tr-history-play:hover { border-color: var(--primary-light); color: var(--primary-dark); }

/* Scan modal */
.tr-scan-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200;
}
.tr-scan-backdrop.open { display: block; }
.tr-scan-modal {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    background: #fff; border-radius: 20px 20px 0 0; z-index: 201;
    max-height: 90vh; overflow-y: auto;
}
.tr-scan-modal.open { display: flex; flex-direction: column; }
@media (min-width: 640px) {
    .tr-scan-modal {
        top: 50%; left: 50%; bottom: auto; right: auto;
        transform: translate(-50%, -50%);
        width: 92%; max-width: 520px; border-radius: 16px;
    }
}
.tr-scan-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.tr-scan-header h3 { font-size: 15px; font-weight: 700; }
.tr-scan-close {
    background: var(--bg-2); border: none; border-radius: 50%;
    width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.tr-scan-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.tr-scan-preview {
    background: #111; border-radius: var(--radius); overflow: hidden;
    min-height: 180px; display: flex; align-items: center; justify-content: center;
}
.tr-scan-placeholder { color: #aaa; font-size: 13px; text-align: center; padding: 20px; }
.tr-scan-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.tr-scan-action-btn {
    flex: 1; min-width: 110px; display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 12px; border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s; border: none;
}
.tr-scan-action-btn.secondary { background: var(--bg-2); color: var(--text); border: 1.5px solid var(--border); }
.tr-scan-action-btn.secondary:hover { background: var(--border); }
.tr-scan-action-btn.primary { background: var(--primary); color: #fff; }
.tr-scan-action-btn.primary:hover { background: var(--primary-dark); }
.tr-scan-action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tr-scan-status { font-size: 13px; color: var(--text-2); min-height: 18px; }
.tr-scan-lines { display: flex; flex-direction: column; gap: 8px; }
.tr-scan-line-row {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px; background: var(--bg-2); border-radius: var(--radius); border: 1px solid var(--border);
}
.tr-scan-line-texts { flex: 1; min-width: 0; }
.tr-scan-line-src { font-size: 18px; margin-bottom: 4px; }
.tr-scan-line-tgt { font-size: 13px; color: var(--text-2); }
.tr-scan-line-play {
    background: none; border: 1.5px solid var(--primary-light); border-radius: 50%;
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--primary-dark); flex-shrink: 0; transition: background 0.15s;
}
.tr-scan-line-play:hover { background: var(--primary-light); }
.tr-scan-line-save {
    background: var(--primary); color: #fff; border: none; border-radius: 6px;
    padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; flex-shrink: 0;
    transition: background 0.15s;
}
.tr-scan-line-save:hover { background: var(--primary-dark); }
