* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

body {
    background: linear-gradient(
        180deg,
        #b8d1e0 0%,
        #94b3cc 25%,
        #80a4bf 38%,
        #5a8ca6 43%,
        #59889f 55%,
        #c2b9a0 65%,
        #d1c8a6 70%,
        #d9ceab 80%,
        #ccbf9e 100%
    );
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: env(safe-area-inset-top, 20px) 16px env(safe-area-inset-bottom, 20px);
    overflow-y: auto;
}

/* Header */
.header {
    text-align: center;
    padding-top: 10px;
}

.title {
    font-size: 2.2rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* Mode Switch */
.mode-switch {
    display: flex;
    margin: 12px 0 0;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(0,0,0,0.2);
    width: 100%;
    max-width: 340px;
}

.mode-btn {
    flex: 1;
    border: none;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.7);
    padding: 10px 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.mode-btn.active[data-mode="humanToSeal"] {
    background: #3478f6;
    color: white;
}

.mode-btn.active[data-mode="sealToHuman"] {
    background: #f5922a;
    color: white;
}

.mode-emoji {
    font-size: 1.3rem;
}

.mode-label {
    font-size: 0.65rem;
    font-weight: 600;
}

/* Language Switch */
.lang-switch {
    display: flex;
    margin-top: 8px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0,0,0,0.15);
    max-width: 260px;
}

.lang-btn {
    flex: 1;
    border: none;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.7);
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn.active {
    background: #f5922a;
    color: white;
}

/* Emoji */
.emoji {
    font-size: 5rem;
    margin: auto 0 0;
    padding-top: 16px;
    transition: transform 0.3s;
}

.emoji.pulse {
    animation: pulse 0.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.15); }
}

/* Status */
.status {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 6px rgba(0,0,0,0.3);
    text-align: center;
    padding: 8px 20px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Result Card */
.result-card {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 14px 18px;
    margin: 8px 0;
    width: 100%;
    max-width: 340px;
    text-align: center;
}

.result-text {
    font-size: 0.95rem;
    color: #1a1a1a;
    line-height: 1.4;
}

.result-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: rgba(0,0,0,0.5);
}

.replay-btn {
    border: none;
    background: none;
    color: #f5922a;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 8px;
}

.replay-btn:active {
    opacity: 0.5;
}

/* Record Button */
.record-area {
    margin: auto 0 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
}

.record-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: none;
    background: #3478f6;
    box-shadow: 0 4px 20px rgba(52,120,246,0.4);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.record-btn.seal-mode {
    background: #f5922a;
    box-shadow: 0 4px 20px rgba(245,146,42,0.4);
}

.record-btn.recording {
    background: #e53e3e !important;
    box-shadow: 0 4px 30px rgba(229,62,62,0.5) !important;
    transform: scale(1.1);
}

.record-btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.record-icon {
    font-size: 2.8rem;
}

.record-hint {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
}

/* Debug */
.debug {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.4);
    text-align: center;
    padding: 4px;
    max-width: 340px;
    word-break: break-all;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-card {
    animation: fadeIn 0.3s ease-out;
}

/* Privacy Link */
.privacy-link {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
    text-decoration: none;
    padding: 8px;
    margin-top: 4px;
}

.privacy-link:hover {
    color: rgba(255,255,255,0.7);
}

/* Consent Banner */
.consent-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    animation: fadeIn 0.3s ease-out;
}

.consent-overlay.hidden {
    display: none;
}

.consent-banner {
    background: #fff;
    border-radius: 20px;
    padding: 24px 20px;
    max-width: 400px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 -4px 40px rgba(0,0,0,0.2);
    animation: slideUp 0.4s ease-out;
}

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

.consent-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.consent-emoji {
    font-size: 2rem;
}

.consent-header h2 {
    font-size: 1.2rem;
    color: #1a1a1a;
}

.consent-intro {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 16px;
    line-height: 1.5;
}

.consent-item {
    margin-bottom: 12px;
}

.consent-toggle {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f5f5f7;
    transition: background 0.2s;
}

.consent-toggle:hover {
    background: #eee;
}

.consent-toggle input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    flex-shrink: 0;
    width: 44px;
    height: 26px;
    background: #ccc;
    border-radius: 13px;
    position: relative;
    transition: background 0.2s;
    margin-top: 2px;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.consent-toggle input:checked + .toggle-slider {
    background: #34c759;
}

.consent-toggle input:checked + .toggle-slider::after {
    transform: translateX(18px);
}

.toggle-text {
    flex: 1;
}

.toggle-text strong {
    display: block;
    font-size: 0.9rem;
    color: #1a1a1a;
    margin-bottom: 2px;
}

.toggle-text small {
    display: block;
    font-size: 0.75rem;
    color: #888;
    line-height: 1.4;
}

.consent-note {
    font-size: 0.75rem;
    color: #888;
    margin: 16px 0;
    line-height: 1.5;
}

.consent-note a {
    color: #3478f6;
    text-decoration: none;
}

.consent-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.consent-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.consent-btn:active {
    opacity: 0.7;
}

.consent-btn-all {
    background: #3478f6;
    color: white;
}

.consent-btn-selected {
    background: #f0f0f0;
    color: #333;
}
