* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
    color: #1d1d1f;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

h1 .version {
    font-size: 0.7rem;
    font-weight: 500;
    color: #fff;
    background: linear-gradient(135deg, #007aff, #5856d6);
    padding: 3px 8px;
    border-radius: 20px;
}

h2 {
    display: none;
}

/* Tabs - Segmented Control Style */
.tabs {
    display: flex;
    background: #e8e8ed;
    padding: 3px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #333;
}

.tab-btn.active {
    background: #fff;
    color: #1d1d1f;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tab-content {
    display: none;
}

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

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

/* Card */
.card {
    background: #fff;
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.06);
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    background: #e8e8ed;
    color: #1d1d1f;
    transition: all 0.15s ease;
}

.btn:hover {
    background: #ddd;
    transform: scale(1.02);
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn.primary {
    background: linear-gradient(135deg, #007aff, #0055d4);
    color: #fff;
}

.btn.primary:hover {
    background: linear-gradient(135deg, #0066dd, #0044bb);
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.btn-group .btn {
    flex: 1;
    padding: 10px 14px;
    font-size: 0.85rem;
}

.translate-row {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.translate-row select {
    flex: 1;
}

/* Upload Area */
.upload-area {
    margin-bottom: 14px;
}

.upload-area input[type="file"] {
    display: none;
}

.file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 20px;
    border: 2px dashed #d1d1d6;
    border-radius: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #86868b;
    font-size: 0.9rem;
}

.file-label:hover {
    border-color: #007aff;
    background: rgba(0, 122, 255, 0.04);
    color: #007aff;
}

/* Status */
.status {
    padding: 12px 16px;
    border-radius: 12px;
    margin: 14px 0;
    background: #f5f5f7;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
}

.status.success {
    background: #d1f2eb;
    color: #0d7a5f;
}

.status.error {
    background: #fde8e8;
    color: #c53030;
}

.hidden {
    display: none !important;
}

/* Result */
.result {
    margin-top: 18px;
}

.result label {
    display: block;
    margin-bottom: 8px;
    color: #86868b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
}

/* Textarea */
textarea {
    width: 100%;
    min-height: 110px;
    padding: 14px;
    border: 1px solid #e8e8ed;
    border-radius: 12px;
    background: #fafafa;
    color: #1d1d1f;
    font-size: 0.95rem;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

textarea:focus {
    outline: none;
    border-color: #007aff;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

textarea::placeholder {
    color: #c7c7cc;
}

/* Select */
select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e8e8ed;
    border-radius: 12px;
    background: #fafafa;
    color: #1d1d1f;
    font-size: 0.9rem;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

select:focus {
    outline: none;
    border-color: #007aff;
    background-color: #fff;
}

/* Voice/Mic Select */
.voice-select, .mic-select {
    margin: 14px 0;
}

.voice-select label, .mic-select label {
    display: block;
    margin-bottom: 8px;
    color: #86868b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
}

/* Audio Player */
audio {
    width: 100%;
    height: 44px;
    margin: 10px 0;
    border-radius: 10px;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 18px 0;
    color: #c7c7cc;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e8e8ed;
}

.divider span {
    padding: 0 14px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* Record Button */
.btn.record {
    display: block;
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #34c759, #28a745);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
}

.btn.record:hover {
    background: linear-gradient(135deg, #2db84d, #22923d);
}

.btn.record.recording {
    background: linear-gradient(135deg, #ff3b30, #dc2626);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(255, 59, 48, 0); }
}

.recording-time {
    text-align: center;
    font-size: 2rem;
    font-weight: 300;
    margin-top: 14px;
    color: #ff3b30;
    font-variant-numeric: tabular-nums;
}

/* Label general */
label {
    display: block;
    margin-bottom: 8px;
    color: #86868b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
}

/* Shutdown Button */
.btn.shutdown {
    display: none;
}

/* PIN Overlay */
.pin-overlay {
    position: fixed;
    inset: 0;
    background: #f5f5f7;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pin-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.pin-box {
    text-align: center;
}

.pin-title {
    font-size: 0.9rem;
    color: #86868b;
    margin-bottom: 28px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.pin-dots {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 10px;
}

.pin-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #d1d1d6;
    background: transparent;
    transition: all 0.15s ease;
}

.pin-dot.filled {
    background: #007aff;
    border-color: #007aff;
}

.pin-dot.error {
    border-color: #ff3b30;
    background: #ff3b30;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

#pinInput {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pin-error {
    margin-top: 20px;
    color: #ff3b30;
    font-size: 0.9rem;
    font-weight: 500;
    min-height: 24px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d1d6;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #c7c7cc;
}

/* Mobile adjustments */
@media (max-width: 420px) {
    body {
        padding: 16px;
        align-items: flex-start;
        padding-top: 32px;
    }

    .card {
        padding: 20px;
    }

    .btn-group {
        flex-direction: column;
    }

    .translate-row {
        flex-direction: column;
    }
}
