/* 텍스트 음성 변환 - 전용 스타일 (공통 스타일 위에 덧입힌다) */

/* ---------------------------------------------------------------- 레이아웃 */

.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 20px;
    min-height: 520px;
}

@media (max-width: 1024px) {
    .split-layout {
        grid-template-columns: 1fr;
        min-height: auto;
    }
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.right-column {
    display: flex;
    flex-direction: column;
}

.left-column .panel:first-child {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* ------------------------------------------------------------ 미지원 안내 */

.unsupported-notice {
    max-width: 720px;
    margin: 0 auto 24px;
    padding: 14px 20px;
    border-radius: 12px;
    background: #ffeae4;
    border: 1px solid #f3c4b6;
    color: #a2503c;
    font-size: 0.92rem;
    line-height: 1.6;
    text-align: center;
}

.unsupported-notice strong {
    display: block;
    margin-bottom: 4px;
}

/* -------------------------------------------------------------- 입력 패널 */

.char-count {
    margin-left: auto;
    font-size: 0.82rem;
    color: #a98b7d;
    font-variant-numeric: tabular-nums;
}

.char-count.is-full {
    color: #d1705a;
    font-weight: 600;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-sample {
    height: 34px;
    padding: 0 12px;
    border: 1px solid #f0dcd0;
    border-radius: 8px;
    background: #fffbf8;
    color: #a5745c;
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-sample:hover {
    background: #fdf0e6;
    border-color: #f0b49c;
}

.btn-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ffd6a5 0%, #ffb0a3 100%);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-icon:hover:not(:disabled) {
    opacity: 0.85;
}

.btn-icon:disabled {
    background: #e0e0e0;
    cursor: not-allowed;
}

.source-textarea {
    flex: 1;
    width: 100%;
    min-height: 220px;
    padding: 16px;
    border: 1px solid #f0dcd0;
    border-radius: 10px;
    background: #fffbf8;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #4a4038;
    resize: vertical;
    transition: border-color 0.2s;
}

.source-textarea:focus {
    outline: none;
    border-color: #f0b49c;
}

/* ---------------------------------------------------------------- 옵션 */

.options-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.option-row-checkbox {
    gap: 8px;
    font-size: 0.9rem;
    color: #6b5a50;
}

.option-row-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #f0a68c;
    cursor: pointer;
    flex-shrink: 0;
}

.option-row-checkbox label {
    cursor: pointer;
}

.option-label {
    min-width: 52px;
    font-size: 0.9rem;
    color: #6b5a50;
    font-weight: 500;
    flex-shrink: 0;
}

.option-select {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #f0dcd0;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
    color: #4a4038;
    cursor: pointer;
    transition: border-color 0.2s;
}

.option-select:hover:not(:disabled) {
    border-color: #f0b49c;
}

.option-select:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* 알림음 카드 */
.chime-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chime-panel .panel-header {
    margin-bottom: 0;
}

.btn-preview {
    height: 36px;
    padding: 0 14px;
    flex-shrink: 0;
    border: 1px solid #f0dcd0;
    border-radius: 8px;
    background: #fffbf8;
    color: #a5745c;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-preview:hover {
    background: #fdf0e6;
    border-color: #f0b49c;
}

.btn-preview:active {
    background: #f9e3d4;
}

/* 인터넷으로 합성되는 음성이 있다는 고지 */
.voice-notice {
    margin-top: -4px;
    font-size: 0.78rem;
    line-height: 1.5;
    color: #a3908a;
}

/* -------------------------------------------------------------- 슬라이더 */

.slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.option-range {
    flex: 1;
    min-width: 0;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #f6e2d6;
    border-radius: 2px;
    cursor: pointer;
}

.option-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffc78f 0%, #ff9f8e 100%);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.option-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffc78f 0%, #ff9f8e 100%);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.slider-value {
    min-width: 44px;
    text-align: right;
    font-size: 0.85rem;
    color: #8a7469;
    font-variant-numeric: tabular-nums;
}

.btn-reset {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border: none;
    border-radius: 6px;
    background: #fbf1ea;
    color: #b08a76;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-reset:hover {
    background: #f6e2d6;
}

/* ------------------------------------------------------------- 읽기 화면 */

.result-panel {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    min-height: 0;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.result-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4a4038;
}

.progress-label {
    font-size: 0.85rem;
    color: #a98b7d;
    font-variant-numeric: tabular-nums;
}

.result-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* display를 지정한 요소는 그 값이 hidden 속성을 이겨 버리므로 따로 눌러 준다. */
.result-placeholder[hidden],
.reader[hidden] {
    display: none;
}

.result-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #c0aaa0;
    text-align: center;
}

.result-placeholder-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.result-placeholder-text {
    font-size: 1rem;
    line-height: 1.6;
}

.reader {
    flex: 1;
    min-height: 260px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 16px;
    border: 1px solid #f0dcd0;
    border-radius: 10px;
    background: #fffbf8;
    font-size: 1rem;
    line-height: 1.9;
    color: #5a4c44;
    /* 원문의 줄바꿈과 들여쓰기를 그대로 살린다 */
    white-space: pre-wrap;
    word-break: break-word;
}

.sentence {
    border-radius: 5px;
    transition: background 0.15s;
}

.sentence[data-index] {
    cursor: pointer;
}

.sentence[data-index]:hover {
    background: #fdf0e6;
}

.sentence[data-index]:focus-visible {
    outline: 2px solid #f0b49c;
    outline-offset: 1px;
}

/* 지금 읽고 있는 문장 */
.sentence.is-speaking {
    background: #ffe3cc;
    box-shadow: 0 0 0 3px #ffe3cc;
    color: #7a4a2c;
    font-weight: 500;
}

.sentence-silent {
    cursor: default;
}

/* ------------------------------------------------------------- 재생 조작 */

.playback-section {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 100px;
}

/* 읽기와 정지를 겸하는 단추.
   두 상태가 한눈에 갈리도록 계열이 다른 색을 쓴다.
   멈춰 있을 때는 민트(가도 좋다), 읽는 중에는 산호빛(멈출 수 있다)이다. */
.btn-play {
    width: 68px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #9fdfc4 0%, #6fc9a8 100%);
    color: white;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(111, 201, 168, 0.45);
    transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}

.btn-play:hover:not(:disabled) {
    transform: scale(1.06);
    box-shadow: 0 8px 26px rgba(111, 201, 168, 0.55);
}

.btn-play:active:not(:disabled) {
    transform: scale(0.96);
}

/* 재생 아이콘은 삼각형이라 가운데보다 왼쪽으로 쏠려 보인다. 조금 밀어 준다. */
.btn-play .icon-play {
    margin-left: 4px;
}

/* 두 아이콘 중 지금 상태에 맞는 하나만 보인다. */
.btn-play .icon-stop {
    display: none;
}

.btn-play.is-playing .icon-play {
    display: none;
}

.btn-play.is-playing .icon-stop {
    display: block;
}

.btn-play.is-playing {
    background: linear-gradient(135deg, #ffa8a8 0%, #f07f7f 100%);
    box-shadow: 0 6px 20px rgba(240, 127, 127, 0.45);
}

.btn-play.is-playing:hover:not(:disabled) {
    box-shadow: 0 8px 26px rgba(240, 127, 127, 0.55);
}

.btn-play:disabled {
    background: #ddd;
    box-shadow: none;
    cursor: not-allowed;
}
