/* Base reset and variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #388e3c;
    --primary-hover: #2e7d32;
    --secondary-color: #2196F3;
    --secondary-hover: #0b7dda;
    --danger-color: #f44336;
    --danger-hover: #da190b;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --border-color: #ddd;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 600px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 24px 20px;
}

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

header h1 {
    font-size: 24px;
    font-weight: 600;
    flex: 1;
    text-align: center;
    margin-left: 80px; /* Balance the language selector width */
}

/* Language selector */
.language-selector {
    flex-shrink: 0;
}

#language-select {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: white;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

#language-select:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

#language-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

#language-select option {
    color: #333;
    background: white;
}

/* Main content */
main {
    padding: 24px 20px;
}

/* Warning message */
.warning {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 20px;
    text-align: center;
}

.warning p {
    margin: 4px 0;
    color: #856404;
}

.hidden {
    display: none;
}

/* Control section */
.control-section {
    text-align: center;
    margin-bottom: 24px;
}

/* Common button styles */
button {
    border: none;
    border-radius: var(--border-radius);
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow);
    min-width: 160px;
}

button:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

.btn-primary.recording {
    background-color: var(--danger-color);
}

.btn-primary.recording:hover {
    background-color: var(--danger-hover);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--secondary-hover);
}

.btn-icon {
    font-size: 20px;
}

/* Status display */
.status {
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-light);
    min-height: 20px;
}

/* Text section */
.text-section {
    margin-bottom: 24px;
}

.text-display {
    background-color: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-color);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.text-display:empty::before {
    content: '변환된 텍스트가 여기에 표시됩니다...';
    color: var(--text-light);
}

.text-display.has-text {
    color: var(--text-color);
}

/* Action section */
.action-section {
    text-align: center;
    position: relative;
}

/* Footer */
footer {
    background-color: var(--bg-color);
    padding: 16px 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.hint {
    font-size: 13px;
    color: var(--text-light);
    margin: 0;
}

.contact {
    font-size: 13px;
    color: var(--text-light);
    margin: 8px 0 0 0;
}

.contact a {
    color: var(--primary-color);
    text-decoration: none;
}

.contact a:hover {
    text-decoration: underline;
}

/* Tablet */
@media (min-width: 768px) {
    header h1 {
        font-size: 28px;
    }

    main {
        padding: 32px 28px;
    }

    button {
        font-size: 18px;
        padding: 16px 32px;
        min-width: 180px;
    }

    .btn-icon {
        font-size: 22px;
    }

    .text-display {
        font-size: 17px;
        min-height: 250px;
    }

    footer {
        padding: 20px;
    }

    .hint {
        font-size: 14px;
    }

    .contact {
        font-size: 14px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    body {
        padding: 40px;
    }

    header h1 {
        font-size: 32px;
    }

    main {
        padding: 40px 36px;
    }

    .text-display {
        font-size: 18px;
        min-height: 300px;
    }
}

/* Scrollbar customization (Webkit browsers) */
.text-display::-webkit-scrollbar {
    width: 8px;
}

.text-display::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.text-display::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.text-display::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile touch optimization */
@media (hover: none) and (pointer: coarse) {
    button {
        min-height: 48px; /* Minimum touch target size */
    }
}

/* History panel */
.history-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-panel.hidden {
    display: none;
}

.history-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.history-content {
    position: relative;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    z-index: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* History header */
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.history-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.btn-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: var(--transition);
    box-shadow: none;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* History body */
.history-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* History item */
.history-item {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    border-color: var(--secondary-color);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-date {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
}

.history-duration {
    font-size: 12px;
    color: var(--text-light);
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
}

.history-preview {
    font-size: 14px;
    color: var(--text-color);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-full-text {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-color);
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.history-item.expanded .history-preview {
    display: none;
}

.history-item.expanded .history-full-text {
    display: block;
}

/* Empty history */
.empty-history {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-history p:first-child {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-history p:last-child {
    font-size: 15px;
}

/* Action section button alignment */
.action-section {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.action-section button {
    flex: 1;
    min-width: 140px;
}

#history-count {
    font-size: 13px;
    opacity: 0.9;
}

/* History scrollbar */
.history-body::-webkit-scrollbar {
    width: 8px;
}

.history-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.history-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.history-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile history optimization */
@media (max-width: 767px) {
    .header-content {
        flex-direction: column;
        gap: 12px;
    }

    header h1 {
        margin-left: 0;
        font-size: 20px;
    }

    .language-selector {
        order: -1;
        align-self: flex-end;
    }

    .text-display {
        padding: 12px;
    }

    .history-content {
        width: 95%;
        max-height: 85vh;
    }

    .history-header {
        padding: 16px 20px;
    }

    .history-header h2 {
        font-size: 18px;
    }

    .history-body {
        padding: 16px 20px;
    }

    .action-section button {
        min-width: 120px;
        font-size: 14px;
        padding: 12px 16px;
    }

    .btn-icon {
        font-size: 18px;
    }

    #history-count {
        font-size: 12px;
    }
}

/* Model download confirmation modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.modal-body {
    padding: 24px;
    color: var(--text-color);
}

.modal-body p {
    margin: 0 0 16px 0;
    line-height: 1.6;
}

.modal-info-list {
    list-style: none;
    padding: 0;
    margin: 16px 0;
    background: var(--bg-color);
    border-radius: 8px;
    padding: 16px;
}

.modal-info-list li {
    padding: 8px 0;
    line-height: 1.6;
}

.modal-info-list li:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.modal-question {
    margin-top: 20px !important;
    font-weight: 600;
    font-size: 16px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-modal {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-cancel:hover {
    background: var(--bg-color);
}

.btn-confirm {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Mobile modal */
@media (max-width: 767px) {
    .modal-content {
        width: 95%;
        max-width: none;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px;
    }

    .modal-header h2 {
        font-size: 18px;
    }

    .modal-body {
        font-size: 14px;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .btn-modal {
        width: 100%;
    }
}

/* Snackbar */
#snackbar-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.snackbar {
    background-color: #323232;
    color: white;
    padding: 14px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(20px);
    animation: snackbarSlideIn 0.3s ease forwards, snackbarFadeOut 0.3s ease 2.7s forwards;
    pointer-events: auto;
}

/* Progress snackbar (does not auto-dismiss) */
.snackbar-progress {
    animation: snackbarSlideIn 0.3s ease forwards;
    background-color: #2196F3;
}

@keyframes snackbarSlideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes snackbarFadeOut {
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* Mobile snackbar */
@media (max-width: 767px) {
    #snackbar-container {
        bottom: 16px;
        left: 16px;
        right: 16px;
        transform: none;
    }

    .snackbar {
        width: 100%;
        max-width: calc(100vw - 32px);
        padding: 12px 20px;
        font-size: 13px;
    }
}

/* Service Navigation (TTS ↔ STT link) */
.service-nav {
    margin-top: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.service-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}

.service-link:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.service-icon {
    font-size: 18px;
}

/* Tab buttons */
.tab-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: auto;
    box-shadow: none;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--text-color);
    background-color: rgba(0, 0, 0, 0.02);
    transform: none;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-icon {
    font-size: 18px;
}

.tab-text {
    font-size: 14px;
}

/* Tab content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* File upload section */
.file-upload-section {
    text-align: center;
    margin-bottom: 24px;
}

.file-input-wrapper {
    margin-bottom: 16px;
}

.file-input {
    display: none;
}

.file-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background-color: var(--bg-color);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 32px 24px;
    cursor: pointer;
    transition: var(--transition);
    min-width: 280px;
}

.file-label:hover {
    border-color: var(--primary-color);
    background-color: rgba(76, 175, 80, 0.05);
}

.file-icon {
    font-size: 32px;
}

.file-label-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-color);
}

/* File info */
.file-info {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 16px;
}

.file-info p {
    margin: 4px 0;
    font-size: 14px;
}

.file-name {
    font-weight: 500;
    color: var(--text-color);
}

.file-duration {
    color: var(--text-light);
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--bg-color);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 16px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
}

/* Tab responsive */
@media (max-width: 767px) {
    .tab-btn {
        padding: 10px 12px;
        font-size: 13px;
    }

    .tab-icon {
        font-size: 16px;
    }

    .tab-text {
        font-size: 12px;
    }

    .file-label {
        padding: 24px 20px;
        min-width: auto;
        width: 100%;
    }

    .file-icon {
        font-size: 28px;
    }

    .file-label-text {
        font-size: 14px;
    }
}

/* ==========================================
   SEO Content Sections
   ========================================== */

.seo-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
}

.seo-section h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: center;
    color: var(--text-color);
}

/* Features Section */
.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.feature-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.feature-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.feature-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.feature-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.feature-card p {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.6;
    margin: 0;
}

/* Comparison Section */
.comparison-section {
    text-align: center;
}

.comparison-intro {
    color: var(--text-light);
    margin-bottom: 24px;
    font-size: 15px;
}

.comparison-table-wrapper {
    overflow-x: auto;
    margin: 0 -16px;
    padding: 0 16px;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    min-width: 500px;
}

.comparison-table th,
.comparison-table td {
    padding: 16px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.comparison-table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.comparison-table td {
    font-size: 14px;
    color: var(--text-color);
}

.comparison-table tbody tr:last-child td {
    border-bottom: none;
}

.comparison-table tbody tr:hover {
    background: rgba(76, 175, 80, 0.05);
}

.comparison-table .highlight-row {
    background: rgba(76, 175, 80, 0.1);
}

.comparison-table .highlight-row:hover {
    background: rgba(76, 175, 80, 0.15);
}

.comparison-table .free-price {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 16px;
}

/* How to Use Section */
.steps-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.steps-list li {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.step-number {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.step-content h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--text-color);
}

.step-content p {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.6;
    margin: 0;
}

/* FAQ Section */
.faq-list {
    max-width: 600px;
    margin: 0 auto;
}

.faq-item {
    margin-bottom: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.faq-item summary {
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 500;
    font-size: 15px;
    color: var(--text-color);
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 20px;
    color: var(--primary-color);
    transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-item summary:hover {
    color: var(--primary-color);
}

.faq-item p {
    padding: 0 20px 16px;
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.7;
    margin: 0;
}

/* Use Cases Section */
.use-cases-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.use-case-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    text-align: center;
}

.use-case-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.use-case-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.use-case-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.use-case-card p {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.6;
    margin: 0;
}

/* SEO Sections Responsive */
@media (max-width: 767px) {
    .seo-section {
        margin-top: 32px;
        padding-top: 24px;
    }

    .seo-section h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .feature-card {
        padding: 20px;
    }

    .feature-icon {
        font-size: 28px;
    }

    .feature-card h3 {
        font-size: 15px;
    }

    .feature-card p {
        font-size: 13px;
    }

    .steps-list li {
        padding: 16px;
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .step-content h3 {
        font-size: 15px;
    }

    .step-content p {
        font-size: 13px;
    }

    .faq-item summary {
        padding: 14px 16px;
        font-size: 14px;
    }

    .faq-item p {
        padding: 0 16px 14px;
        font-size: 13px;
    }

    .use-cases-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .use-case-card {
        padding: 16px 12px;
    }

    .use-case-icon {
        font-size: 28px;
        margin-bottom: 8px;
    }

    .use-case-card h3 {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .use-case-card p {
        font-size: 12px;
        line-height: 1.5;
    }
}

/* Subtitle in header */
.subtitle {
    font-size: 14px;
    font-weight: 400;
    opacity: 0.9;
    margin-top: 8px;
    text-align: center;
}

@media (max-width: 767px) {
    .subtitle {
        font-size: 12px;
        margin-top: 6px;
    }
}

/* On-Device STT Benefits Section */
.on-device-section {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.05), rgba(33, 150, 243, 0.05));
    border-radius: var(--border-radius);
    padding: 32px 24px;
    margin-top: 48px;
    border: 1px solid rgba(76, 175, 80, 0.2);
}

.on-device-section h2 {
    color: var(--primary-color);
}

.section-intro {
    text-align: center;
    color: var(--text-light);
    font-size: 15px;
    margin-bottom: 24px;
    line-height: 1.6;
}

.on-device-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.on-device-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    text-align: center;
}

.on-device-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.on-device-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.on-device-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.on-device-card p {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.6;
    margin: 0;
}

@media (max-width: 767px) {
    .on-device-section {
        padding: 24px 16px;
        margin-top: 32px;
    }

    .section-intro {
        font-size: 13px;
        margin-bottom: 20px;
    }

    .on-device-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .on-device-card {
        padding: 20px;
    }

    .on-device-icon {
        font-size: 32px;
    }

    .on-device-card h3 {
        font-size: 15px;
    }

    .on-device-card p {
        font-size: 12px;
    }
}

/* Section Navigation */
.section-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.section-nav a {
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-light);
    text-decoration: none;
    border-radius: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.section-nav a:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: rgba(76, 175, 80, 0.1);
}

@media (max-width: 480px) {
    .section-nav {
        gap: 6px;
        padding: 10px 12px;
    }

    .section-nav a {
        padding: 5px 10px;
        font-size: 12px;
    }
}

/* ==========================================
   TTS (Text-to-Speech) Section
   ========================================== */

.tts-section {
    text-align: center;
    margin-bottom: 24px;
}

/* TTS Input */
.tts-input-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.tts-input {
    width: 100%;
    min-height: 150px;
    max-height: 300px;
    padding: 16px;
    font-size: 16px;
    line-height: 1.6;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--bg-color);
    color: var(--text-color);
    resize: vertical;
    font-family: inherit;
    transition: var(--transition);
}

.tts-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.tts-input::placeholder {
    color: var(--text-light);
}

.tts-char-count {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 12px;
    color: var(--text-light);
    background: var(--bg-color);
    padding: 2px 6px;
    border-radius: 4px;
}

/* TTS Settings */
.tts-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.tts-setting-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tts-setting-row label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    min-width: 40px;
}

.tts-select {
    padding: 8px 32px 8px 12px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: var(--transition);
}

.tts-select:hover {
    border-color: var(--primary-color);
}

.tts-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

/* TTS Controls */
.tts-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 20px;
}

.tts-controls button {
    min-width: 140px;
}

/* TTS Progress */
.tts-progress-container {
    margin-bottom: 20px;
    min-height: 50px; /* Prevent layout shift */
    contain: layout;
}

.tts-progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--bg-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.tts-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
}

/* TTS Audio Container */
.tts-audio-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    min-height: 120px; /* Prevent layout shift */
    contain: layout;
}

.tts-audio-container audio {
    width: 100%;
    max-width: 400px;
}

#tts-download-btn {
    min-width: 160px;
}

/* TTS Responsive */
@media (max-width: 767px) {
    .tts-input {
        min-height: 120px;
        padding: 12px;
        font-size: 15px;
    }

    .tts-settings {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }

    .tts-setting-row {
        width: 100%;
        justify-content: space-between;
    }

    .tts-select {
        flex: 1;
        max-width: 200px;
    }

    .tts-controls {
        flex-direction: column;
        gap: 10px;
    }

    .tts-controls button {
        width: 100%;
        min-width: auto;
    }

    .tts-audio-container {
        padding: 16px;
    }

    #tts-download-btn {
        width: 100%;
        min-width: auto;
    }
}

/* TTS Playing State */
#tts-play-btn.playing {
    background-color: var(--danger-color);
}

#tts-play-btn.playing:hover {
    background-color: var(--danger-hover);
}

/* ==================== Blog Styles ==================== */

.blog-container {
    max-width: 800px;
}

.blog-home-link {
    color: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
    transition: var(--transition);
}

.blog-home-link:hover {
    opacity: 1;
}

.blog-container header h1 {
    margin-left: 0;
}

.blog-content {
    padding: 32px 24px;
}

.blog-intro {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
}

.blog-intro h2 {
    font-size: 28px;
    color: var(--text-color);
    margin-bottom: 16px;
}

.blog-intro p {
    font-size: 18px;
    color: var(--text-light);
    line-height: 1.8;
}

.blog-section {
    margin-bottom: 48px;
}

.blog-section h2 {
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color);
}

.blog-section h3 {
    font-size: 20px;
    color: var(--text-color);
    margin: 32px 0 20px;
}

.blog-section p {
    font-size: 16px;
    color: var(--text-light);
    line-height: 1.8;
    margin-bottom: 16px;
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.feature-card {
    background: var(--bg-color);
    border-radius: var(--border-radius);
    padding: 24px;
    transition: var(--transition);
}

.feature-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.feature-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.feature-card h4 {
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 0;
}

/* Advantage List */
.advantage-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.advantage-item {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.advantage-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.advantage-item strong {
    display: block;
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 4px;
}

.advantage-item p {
    font-size: 14px;
    color: var(--text-light);
    margin: 0;
}

/* Blog CTA Section */
.blog-cta {
    text-align: center;
    padding: 40px 24px;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(33, 150, 243, 0.1));
    border-radius: var(--border-radius);
    margin-top: 48px;
}

.blog-cta h2 {
    font-size: 24px;
    color: var(--text-color);
    margin-bottom: 16px;
}

.blog-cta p {
    font-size: 16px;
    color: var(--text-light);
    margin-bottom: 24px;
}

.cta-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.cta-btn {
    text-decoration: none;
    padding: 14px 32px;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.cta-btn.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.cta-btn.btn-primary:hover {
    background-color: var(--primary-hover);
}

.cta-btn.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.cta-btn.btn-secondary:hover {
    background-color: var(--secondary-hover);
}

/* Blog Footer */
.blog-footer {
    text-align: center;
    padding: 20px;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
}

.blog-footer p {
    font-size: 14px;
    color: var(--text-light);
    margin: 0;
}

/* Blog Responsive */
@media (max-width: 600px) {
    .blog-content {
        padding: 24px 16px;
    }

    .blog-intro h2 {
        font-size: 24px;
    }

    .blog-intro p {
        font-size: 16px;
    }

    .blog-section h2 {
        font-size: 20px;
    }

    .blog-section h3 {
        font-size: 18px;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .advantage-item {
        flex-direction: column;
        text-align: center;
    }

    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }

    .cta-btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
}

/* ==================== Translation Page ==================== */

.translate-section {
    text-align: center;
    margin-bottom: 24px;
}

.translate-direction-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.direction-btn {
    padding: 10px 20px;
    border-radius: 20px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    min-width: auto;
    box-shadow: none;
    color: var(--text-color);
}

.direction-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: none;
}

.direction-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.direction-btn.active:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: white;
}

.swap-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    min-width: auto;
    box-shadow: none;
    color: var(--text-light);
    transition: var(--transition);
}

.swap-btn:hover {
    color: var(--primary-color);
    transform: rotate(180deg);
    box-shadow: none;
}

.translate-display-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.translate-panel {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    min-height: 120px;
    position: relative;
}

.translate-panel-label {
    position: absolute;
    top: -10px;
    left: 12px;
    background: var(--card-bg);
    padding: 0 8px;
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
}

.translate-panel.source {
    border-color: var(--primary-color);
}

.translate-panel.target {
    border-color: var(--secondary-color);
}

.translate-text-display {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-color);
    white-space: pre-wrap;
    word-wrap: break-word;
    min-height: 80px;
    max-height: 200px;
    overflow-y: auto;
}

.translate-text-display:empty::before {
    color: var(--text-light);
    font-style: italic;
}

.translate-panel.source .translate-text-display:empty::before {
    content: attr(data-placeholder);
}

.translate-panel.target .translate-text-display:empty::before {
    content: attr(data-placeholder);
}

.translate-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
}

.translate-controls button {
    min-width: 200px;
}

/* Translation page responsive */
@media (max-width: 767px) {
    .translate-direction-selector {
        gap: 8px;
    }

    .direction-btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .swap-btn {
        font-size: 18px;
        padding: 6px;
    }

    .translate-panel {
        padding: 12px;
        min-height: 100px;
    }

    .translate-text-display {
        font-size: 15px;
        min-height: 60px;
        max-height: 150px;
    }

    .translate-controls button {
        width: 100%;
        min-width: auto;
    }
}

/* Translation text scrollbar */
.translate-text-display::-webkit-scrollbar {
    width: 6px;
}

.translate-text-display::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.translate-text-display::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.translate-text-display::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* ==================== Site Footer Links ==================== */

.site-footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 24px 20px;
    margin-top: 32px;
}

.footer-links {
    max-width: 800px;
    margin: 0 auto;
}

.footer-links h3 {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 12px;
    font-weight: 500;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
}

.footer-nav a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.footer-nav a:hover {
    background: var(--primary-color);
    color: white;
}

.footer-nav .current {
    background: var(--primary-color);
    color: white;
    pointer-events: none;
}

.footer-copyright {
    text-align: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-light);
}

@media (max-width: 600px) {
    .footer-nav {
        flex-direction: column;
        align-items: center;
    }

    .footer-nav a {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
}
