/* ================================================================
   TONAL DRAWING COMPONENT - Speakking
   Подключается на любой странице: redesign-tones, dialogs, embed
   ================================================================ */

.td-wrap { position: relative; }

/* Input row */
.td-input { display: flex; align-items: center; gap: 0; margin-bottom: 8px; }
.td-input__logo { display: flex; align-items: center; justify-content: center; width: 54px; height: 50px; background: #2B3140; border-radius: 8px 0 0 8px; flex-shrink: 0; }
.td-input__logo svg { width: 24px; height: 28px; }
.td-input__field { flex: 1; height: 50px; border: 2px solid #2B3140; border-left: none; border-radius: 0 8px 8px 0; padding: 0 16px; font-family: 'Roboto', sans-serif; font-size: 1rem; color: #262626; outline: none; transition: border-color 0.2s; min-width: 0; box-sizing: border-box; }
.td-input__field:focus { border-color: #FFC000; }
.td-input__field::placeholder { color: #CED4DA; }
.td-input:focus-within .td-input__logo { background: #FFC000; }
.td-input:focus-within .td-input__logo svg path { fill: #2B3140; }
.td-input--hanzi:focus-within .td-input__logo { background: #CED4DA; }
.td-input--hanzi .td-input__logo { background: #CED4DA; }
.td-input--hanzi .td-input__field { border-color: #CED4DA; }

/* Word blocks (pinyin + hanzi) */
.td-words { display: flex; gap: 12px; justify-content: flex-start; margin-bottom: 20px; padding-left: 34px; flex-wrap: wrap; align-items: center; }

/* Warning */
.td-warning { padding: 8px 16px 8px 54px; margin-bottom: 8px; font-size: 0.875rem; color: #F62D51; }
.td-word { display: flex; flex-direction: column; align-items: center; cursor: pointer; padding: 6px 10px; border-radius: 12px; transition: all 0.2s; }
.td-word:hover { background: #2B3140; }
.td-word:hover .td-word__py { color: #fff; }
.td-word:hover .td-word__hz { color: #90A4AE; }
.td-word__py { font-size: 1.25rem; font-weight: 500; color: #262626; transition: color 0.2s; }
.td-word__hz { font-size: 1.5rem; color: #262626; transition: color 0.2s; }
.td-word--sandhi .td-word__py { color: #7460EE; }
.td-word--plain { cursor: default; pointer-events: none; }
.td-word--plain .td-word__py { color: #CED4DA; font-size: 1.25rem; }
.td-word--punct { cursor: default; pointer-events: none; }
.td-word--punct .td-word__py { color: #CED4DA; font-size: 1.25rem; }
.td-word--active { background: #FFF8E1; }

/* Chart container */
.td-chart { position: relative; min-height: 220px; }
.td-chart__axis { position: absolute; left: 0; top: 0; width: 34px; height: 100%; background: #fff; z-index: 2; }
.td-chart__scroll { overflow-x: auto; overflow-y: hidden; margin-left: 32px; padding-bottom: 8px; }
.td-chart__scroll svg { display: block; }
.td-chart__scroll::-webkit-scrollbar { height: 6px; }
.td-chart__scroll::-webkit-scrollbar-thumb { background: #DEE2E6; border-radius: 3px; }

/* Highlight */
.td-line-hl { stroke: #FFC000 !important; marker-end: url(#tdArrGold) !important; }
.td-text-hl { fill: #FFC000 !important; }

/* Side panel (instruction) */
.td-help { width: 50px; min-height: 50px; overflow: hidden; background: #2B3140; border-radius: 8px; flex-shrink: 0; cursor: pointer; transition: all 0.3s; align-self: flex-start; }
.td-help__icon { width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 20px; }
.td-help:hover { background: #EEEFF2; }
.td-help:hover .td-help__icon { color: #2B3140; }
.td-help.active { width: 340px; background: #EEEFF2; border-radius: 8px; cursor: default; overflow-y: auto; max-height: 80vh; }
.td-help.active .td-help__icon { display: none; }
.td-help__content { display: none; padding: 20px; }
.td-help.active .td-help__content { display: block; }
.td-help__header { height: 50px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.td-help__header h3 { font-size: 1.25rem; font-weight: 600; color: #2B3140; margin: 0; }
.td-help__close { font-size: 0.875rem; color: #90A4AE; cursor: pointer; }
.td-help__close:hover { color: #2B3140; }
.td-help p { font-size: 0.875rem; color: #6C757D; margin-bottom: 12px; line-height: 1.7; }
.td-help code { background: #F6F7F9; padding: 2px 8px; border-radius: 4px; font-weight: 600; color: #2B3140; }

/* Layout */
.td-layout { display: flex; gap: 8px; align-items: flex-start; }
.td-layout__main { flex: 1; min-width: 0; }

/* Embed mode - minimal */
.td-wrap--embed .td-input { display: none; }
.td-wrap--embed .td-help { display: none; }

/* Inline mode (inside bubble) */
.td-wrap--inline .td-chart__axis { background: transparent; }
.td-wrap--inline .td-words { padding-left: 34px; margin-bottom: 20px; }
.td-wrap--inline .td-word { padding: 4px 8px; border-radius: 8px; }
.td-wrap--inline .td-word__py { font-size: 1.25rem; }
.td-wrap--inline .td-word__hz { font-size: 1.5rem; }
