/**
 * GURBANI KHOJ - Premium iOS with Theme Toggle & Blur Orbs
 */

/* ═══════════════════════════════════════════════════════════════════════════════
   FONTS
   ═══════════════════════════════════════════════════════════════════════════════ */

@font-face {
    font-family: 'Raavi';
    src: local('Raavi'), local('Raavi Regular');
    font-display: swap;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   THEME VARIABLES
   ═══════════════════════════════════════════════════════════════════════════════ */

:root {
    /* Light Theme (Default) */
    --bg: #f8f6f2;
    --bg-soft: #ffffff;
    --surface: rgba(255, 255, 255, 0.75);
    --surface-solid: #ffffff;
    --text: #1a1a1a;
    --text-secondary: rgba(0, 0, 0, 0.55);
    --text-tertiary: rgba(0, 0, 0, 0.35);
    --accent: #007aff;
    --accent-light: rgba(0, 122, 255, 0.12);
    --gold: #b8860b;
    --gold-light: rgba(184, 134, 11, 0.15);
    --highlight: #fff3cd;
    --border: rgba(0, 0, 0, 0.08);
    --shadow: rgba(0, 0, 0, 0.08);
    --nav-bg: rgba(248, 246, 242, 0.85);
    --radius: 16px;
    --radius-lg: 28px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    /* Orb Colors - Light */
    --orb-1: rgba(255, 180, 100, 0.4);
    --orb-2: rgba(150, 200, 255, 0.35);
    --orb-3: rgba(255, 150, 180, 0.3);
    --orb-4: rgba(180, 255, 200, 0.25);

    /* Gurmukhi Font */
    --font-gurmukhi: 'Raavi', 'Noto Sans Gurmukhi', 'Mukta Mahee', sans-serif;

    /* ═══ EXTREME CLAYMORPHISM SHADOWS ═══ */
    /* Light Theme Clay */
    --clay-outer: 12px 12px 30px rgba(0, 0, 0, 0.12), 
                   -12px -12px 30px rgba(255, 255, 255, 0.95),
                   inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    --clay-inner: inset 4px 4px 8px rgba(0, 0, 0, 0.08), 
                  inset -4px -4px 8px rgba(255, 255, 255, 1);
    --clay-outer-sm: 6px 6px 16px rgba(0, 0, 0, 0.1), 
                      -6px -6px 16px rgba(255, 255, 255, 0.95);
    --clay-inner-sm: inset 3px 3px 6px rgba(0, 0, 0, 0.08), 
                      inset -3px -3px 6px rgba(255, 255, 255, 1);
    
    /* Color-accented clay shadows */
    --clay-gold: 0 12px 40px rgba(184, 134, 11, 0.25), 
                 0 4px 12px rgba(0, 0, 0, 0.1);
    --clay-blue: 0 12px 40px rgba(0, 122, 255, 0.25), 
                  0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg: #0a0a0f;
    --bg-soft: #1c1c1e;
    --surface: rgba(30, 30, 35, 0.8);
    --surface-solid: #1c1c1e;
    --text: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-tertiary: rgba(255, 255, 255, 0.4);
    --accent: #0a84ff;
    --accent-light: rgba(10, 132, 255, 0.15);
    --gold: #ffd60a;
    --gold-light: rgba(255, 214, 10, 0.15);
    --highlight: rgba(255, 214, 10, 0.2);
    --border: rgba(255, 255, 255, 0.1);
    --shadow: rgba(0, 0, 0, 0.3);
    --nav-bg: rgba(10, 10, 15, 0.85);

    /* Orb Colors - Dark */
    --orb-1: rgba(100, 80, 200, 0.35);
    --orb-2: rgba(50, 150, 200, 0.3);
    --orb-3: rgba(200, 80, 150, 0.25);
    --orb-4: rgba(80, 200, 150, 0.2);

    /* Dark Theme Clay */
    --clay-outer: 20px 20px 60px rgba(0, 0, 0, 0.6), 
                   -20px -20px 60px rgba(255, 255, 255, 0.05),
                   inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    --clay-inner: inset 6px 6px 12px rgba(0, 0, 0, 0.5), 
                  inset -6px -6px 12px rgba(255, 255, 255, 0.08);
    --clay-outer-sm: 10px 10px 30px rgba(0, 0, 0, 0.5), 
                      -10px -10px 30px rgba(255, 255, 255, 0.05);
    --clay-inner-sm: inset 4px 4px 8px rgba(0, 0, 0, 0.5), 
                      inset -4px -4px 8px rgba(255, 255, 255, 0.08);
}

/* Font Variants */
[data-font="raavi"] {
    --font-gurmukhi: 'Raavi', 'Noto Sans Gurmukhi', sans-serif;
}

[data-font="noto"] {
    --font-gurmukhi: 'Noto Sans Gurmukhi', 'Raavi', sans-serif;
}

[data-font="mukta"] {
    --font-gurmukhi: 'Mukta Mahee', 'Noto Sans Gurmukhi', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background 0.5s ease, color 0.3s ease;

    /* ── Mobile Scaling Lock ── */
    -webkit-text-size-adjust: 100% !important;
    -moz-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
    font-size: 16px !important; /* Lock base rem to 16px regardless of system setting */
    touch-action: manipulation; /* Prevents double-tap zoom */
}

/* ═══════════════════════════════════════════════════════════════════════════════
   iOS BLUR ORBS BACKGROUND
   ═══════════════════════════════════════════════════════════════════════════════ */

.orbs-container {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.8;
    animation: float 20s ease-in-out infinite;
    will-change: transform;
}

.orb-1 {
    width: 350px;
    height: 350px;
    background: var(--orb-1);
    top: -10%;
    left: -10%;
    animation-delay: 0s;
    animation-duration: 25s;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: var(--orb-2);
    top: 30%;
    right: -15%;
    animation-delay: -5s;
    animation-duration: 22s;
}

.orb-3 {
    width: 280px;
    height: 280px;
    background: var(--orb-3);
    bottom: 10%;
    left: 20%;
    animation-delay: -10s;
    animation-duration: 28s;
}

.orb-4 {
    width: 250px;
    height: 250px;
    background: var(--orb-4);
    bottom: -5%;
    right: 10%;
    animation-delay: -15s;
    animation-duration: 20s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(30px, -40px) scale(1.05);
    }

    50% {
        transform: translate(-20px, 20px) scale(0.95);
    }

    75% {
        transform: translate(40px, 30px) scale(1.02);
    }
}

/* Glass Effect */
.glass {
    background: var(--surface);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px var(--shadow);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════════════════════════════════════════════ */

.ios-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: calc(56px + var(--safe-top));
    padding-top: var(--safe-top);
    background: var(--nav-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 16px;
    padding-right: 16px;
    transition: background 0.3s ease;
}

.nav-back {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 17px;
    font-weight: 400;
    cursor: pointer;
    padding: 8px 0;
}

.nav-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

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

/* Theme Toggle */
.theme-toggle {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
    /* Claymorphism */
    box-shadow: var(--clay-outer-sm);
}

.theme-toggle:hover {
    box-shadow: var(--clay-blue), var(--clay-outer-sm);
    color: var(--accent);
}

.theme-toggle:active {
    box-shadow: var(--clay-inner-sm);
    transform: scale(0.95);
}

.theme-toggle .sun-icon {
    display: block;
}

.theme-toggle .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: block;
}

.nav-settings {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    /* Claymorphism */
    box-shadow: var(--clay-outer-sm);
    transition: all 0.2s ease;
}

.nav-settings:hover {
    box-shadow: var(--clay-blue), var(--clay-outer-sm);
    color: var(--accent);
}

.nav-settings:active {
    box-shadow: var(--clay-inner-sm);
    transform: scale(0.95);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════════════════════ */

.main-content {
    position: relative;
    z-index: 1;
    padding-top: calc(56px + var(--safe-top) + 20px);
    padding-bottom: calc(var(--safe-bottom) + 40px);
    padding-left: 16px;
    padding-right: 16px;
    min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SEARCH SECTION
   ═══════════════════════════════════════════════════════════════════════════════ */

.search-section {
    margin-bottom: 24px;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius);
    background: var(--bg);
    border: 1px solid var(--border);
    /* Extreme Claymorphism */
    box-shadow: var(--clay-outer);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.search-bar:focus-within {
    transform: scale(1.02);
    box-shadow: var(--clay-inner), 0 0 0 4px var(--accent-light);
    border-color: var(--accent);
}

.search-icon {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 18px;
    font-family: var(--font-gurmukhi);
}

.search-input::placeholder {
    color: var(--text-tertiary);
    font-family: 'Inter', sans-serif;
}

.search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--bg);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    /* Claymorphic orb */
    box-shadow: var(--clay-outer-sm);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.search-btn svg {
    width: 22px;
    height: 22px;
}

.search-btn:hover {
    box-shadow: var(--clay-blue), var(--clay-outer-sm);
    color: var(--accent);
}

.search-btn:active {
    box-shadow: var(--clay-inner-sm);
    transform: scale(0.95);
}

.clear-btn {
    display: none;
}

.search-input:not(:placeholder-shown)~.clear-btn {
    display: flex;
}

/* Mic Button */
.mic-btn {
    position: relative;
}

.mic-waves {
    position: absolute;
    display: none;
    gap: 3px;
}

.mic-btn.listening .mic-waves {
    display: flex;
}

.mic-btn.listening .mic-icon {
    display: none;
}

.mic-btn.listening {
    color: #ff3b30;
    background: rgba(255, 59, 48, 0.15);
    animation: micPulse 1.5s ease-in-out infinite;
}

@keyframes micPulse {

    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);
    }
}

.mic-waves span {
    width: 3px;
    height: 18px;
    background: #ff3b30;
    border-radius: 2px;
    animation: micWave 0.5s ease-in-out infinite;
}

.mic-waves span:nth-child(1) {
    animation-delay: 0s;
}

.mic-waves span:nth-child(2) {
    animation-delay: 0.1s;
}

.mic-waves span:nth-child(3) {
    animation-delay: 0.2s;
}

@keyframes micWave {

    0%,
    100% {
        transform: scaleY(0.3);
    }

    50% {
        transform: scaleY(1);
    }
}

/* Keyboard Button */
.gurmukhi-letter {
    font-family: var(--font-gurmukhi);
    font-size: 24px;
    font-weight: 500;
}

/* Voice Panel */
.voice-panel {
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    margin-top: 20px;
    border-radius: var(--radius-lg);
    text-align: center;
}

.voice-panel.active {
    display: flex;
    animation: fadeScaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fadeScaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.voice-visual {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.voice-ring {
    position: absolute;
    inset: 0;
    border: 3px solid var(--accent);
    border-radius: 50%;
    opacity: 0;
    animation: voiceRing 2s ease-out infinite;
}

.voice-ring:nth-child(1) {
    animation-delay: 0s;
}

.voice-ring:nth-child(2) {
    animation-delay: 0.6s;
}

.voice-ring:nth-child(3) {
    animation-delay: 1.2s;
}

@keyframes voiceRing {
    0% {
        transform: scale(0.5);
        opacity: 0.9;
    }

    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

.voice-mic {
    color: var(--accent);
}

.voice-status {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.voice-hint {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.voice-cancel {
    background: none;
    border: none;
    color: #ff3b30;
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    padding: 10px 20px;
}

/* Search Filters */
.search-filters {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.search-filters::-webkit-scrollbar {
    display: none;
}

.filter-pill {
    flex-shrink: 0;
    padding: 12px 22px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    /* Claymorphism */
    box-shadow: var(--clay-outer-sm);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.filter-pill:hover {
    box-shadow: var(--clay-blue), var(--clay-outer-sm);
    color: var(--accent);
}

.filter-pill.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: var(--clay-inner-sm), 0 4px 16px var(--accent-light);
}

.filter-pill:active {
    box-shadow: var(--clay-inner-sm);
    transform: scale(0.92);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   RESULTS
   ═══════════════════════════════════════════════════════════════════════════════ */

.results-view {
    display: none;
}

.results-view.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.results-header {
    margin-bottom: 16px;
}

.results-count {
    font-size: 13px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.result-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Extreme Claymorphism */
    box-shadow: var(--clay-outer);
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--clay-inner), 0 12px 40px var(--shadow);
}

.result-card:active {
    box-shadow: var(--clay-inner);
    transform: scale(0.98);
}

.result-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.result-ang {
    padding: 4px 12px;
    background: linear-gradient(135deg, var(--gold), #d4a03a);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    color: white;
    box-shadow: 0 2px 8px rgba(184, 134, 11, 0.3);
}

[data-theme="dark"] .result-ang {
    background: linear-gradient(135deg, #ffd60a, #ffb800);
    color: #000;
}

.result-raag {
    font-size: 13px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.result-gurmukhi {
    font-family: var(--font-gurmukhi);
    font-size: 21px;
    line-height: 1.7;
    margin-bottom: 10px;
    color: var(--text);
}

.result-translation {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.load-more {
    display: none;
    width: 100%;
    margin-top: 20px;
    padding: 16px;
    border-radius: var(--radius);
    color: var(--accent);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg);
    /* Claymorphism */
    box-shadow: var(--clay-outer-sm);
    transition: all 0.25s ease;
}

.load-more:hover {
    box-shadow: var(--clay-blue), var(--clay-outer-sm);
}

.load-more:active {
    box-shadow: var(--clay-inner-sm);
    transform: scale(0.98);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   DEVICE CONSISTENCY — Lock icon sizes across all devices
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Prevent font size scaling on different devices */
* {
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   STATES (Welcome, Loading, Empty)
   ═══════════════════════════════════════════════════════════════════════════════ */

.welcome-state,
.loading-state,
.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    text-align: center;
}

.welcome-state.active,
.loading-state.active,
.empty-state.active {
    display: flex;
    animation: fadeScaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fadeScaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Loader */
.loader {
    position: relative;
    width: 70px;
    height: 70px;
    margin-bottom: 24px;
}

.loader-ring {
    position: absolute;
    inset: 0;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.loader-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--gold);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Empty */
.empty-icon {
    font-size: 56px;
    margin-bottom: 20px;
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Welcome */
.welcome-icon {
    font-size: 72px;
    color: var(--gold);
    margin-bottom: 20px;
    filter: drop-shadow(0 8px 24px rgba(184, 134, 11, 0.35));
    animation: welcomePulse 3s ease-in-out infinite;
}

@keyframes welcomePulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 8px 24px rgba(184, 134, 11, 0.35));
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 12px 32px rgba(184, 134, 11, 0.5));
    }
}

.welcome-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.welcome-desc {
    font-size: 17px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.welcome-tips {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 320px;
}

/* Base viewport scaling lock — matches iPhone XR reference */
@media screen and (max-width: 480px) {
    :root {
        --icon-size-sm: 20px;
        --icon-size-md: 22px;
        --icon-size-lg: 24px;
        --btn-size-sm: 40px;
        --btn-size-md: 44px;
        --btn-size-lg: 48px;
    }
    
    .search-btn,
    .mic-btn,
    .clear-btn {
        width: 44px !important;
        height: 44px !important;
    }
    
    .search-btn svg,
    .mic-btn svg,
    .clear-btn svg {
        width: 22px !important;
        height: 22px !important;
    }
    
    .theme-toggle,
    .nav-settings {
        width: 44px !important;
        height: 44px !important;
    }
    
    .kb-key {
        min-width: 32px !important;
        height: 44px !important;
        font-size: 20px !important;
    }
    
    .control-btn {
        width: 48px !important;
        height: 48px !important;
    }
}

/* Tablet and larger — maintain same proportions */
@media screen and (min-width: 481px) and (max-width: 768px) {
    .search-btn,
    .mic-btn,
    .clear-btn,
    .theme-toggle,
    .nav-settings {
        width: 44px !important;
        height: 44px !important;
    }
}

.keyboard-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
}

.keyboard-overlay.active {
    display: block;
}

.keyboard-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.25s ease;
}

.keyboard-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-solid);
    border-radius: 28px 28px 0 0;
    padding: 14px 10px calc(12px + var(--safe-bottom));
    transform: translateY(100%);
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes slideUp {
    to {
        transform: translateY(0);
    }
}

.sheet-handle {
    width: 40px;
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    margin: 0 auto 14px;
}

.keyboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 14px;
    margin-bottom: 14px;
}

.keyboard-lang {
    font-family: var(--font-gurmukhi);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
}

.keyboard-done {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
}

.keyboard-preview {
    display: flex;
    align-items: center;
    min-height: 54px;
    padding: 12px 18px;
    margin: 0 10px 14px;
    background: var(--accent-light);
    border-radius: var(--radius);
    overflow-x: auto;
    border: 2px solid var(--accent);
}

.preview-text {
    font-family: var(--font-gurmukhi);
    font-size: 24px;
    color: var(--text);
    white-space: nowrap;
}

.preview-cursor {
    width: 2px;
    height: 28px;
    background: var(--accent);
    border-radius: 1px;
    animation: blink 1s step-end infinite;
    margin-left: 2px;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.keyboard-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kb-row {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.kb-key {
    min-width: 32px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-gurmukhi);
    font-size: 20px;
    cursor: pointer;
    /* Claymorphism */
    box-shadow: var(--clay-outer-sm);
    transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.kb-key:active {
    background: var(--accent);
    color: white;
    transform: scale(1.1) translateY(-4px);
    box-shadow: var(--clay-inner-sm), 0 6px 16px var(--accent-light);
}

.kb-row.matras .kb-key {
    min-width: 28px;
    height: 40px;
    font-size: 18px;
    background: var(--accent-light);
}

.kb-row.actions {
    margin-top: 6px;
}

.kb-row.actions .kb-key {
    flex: 1;
    max-width: none;
}

.kb-key.action {
    background: var(--surface);
    color: var(--text);
}

.kb-key.space {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.kb-key.search-action {
    background: var(--accent);
    color: white;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SETTINGS SHEET
   ═══════════════════════════════════════════════════════════════════════════════ */

.settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
}

.settings-overlay.active {
    display: block;
}

.settings-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.25s ease;
}

.settings-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-solid);
    border-radius: 28px 28px 0 0;
    padding: 14px 24px calc(24px + var(--safe-bottom));
    transform: translateY(100%);
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.settings-title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 28px;
}

.setting-group {
    margin-bottom: 28px;
}

.setting-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
}

.setting-options {
    display: flex;
    gap: 12px;
}

.setting-opt {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    /* Claymorphism */
    box-shadow: var(--clay-outer-sm);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.setting-opt.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: var(--clay-inner-sm), 0 4px 16px var(--shadow);
}

.setting-opt:active {
    box-shadow: var(--clay-inner-sm);
    transform: scale(0.95);
}

.bg-preview {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.bg-preview.default {
    background: linear-gradient(145deg, #f8f6f2, #efe9df);
}

[data-theme="dark"] .bg-preview.default {
    background: linear-gradient(145deg, #0a0a0f, #1c1c1e);
}

.bg-preview.paper {
    background: #f5f0e6;
}

[data-theme="dark"] .bg-preview.paper {
    background: #1a1815;
}

.bg-preview.marble {
    background: linear-gradient(135deg, #fdfbf9, #e8e0d5);
}

[data-theme="dark"] .bg-preview.marble {
    background: linear-gradient(135deg, #15151a, #0a0a0f);
}

.settings-done {
    width: 100%;
    padding: 18px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    /* Claymorphism */
    box-shadow: var(--clay-outer-sm), 0 8px 24px rgba(0, 122, 255, 0.25);
    transition: all 0.2s ease;
}

.settings-done:hover {
    box-shadow: var(--clay-inner-sm), 0 12px 32px rgba(0, 122, 255, 0.35);
}

.settings-done:active {
    box-shadow: var(--clay-inner-sm);
    transform: scale(0.98);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════════════════ */

.toast {
    position: fixed;
    bottom: calc(40px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 16px 28px;
    background: var(--text);
    border-radius: 28px;
    font-size: 15px;
    font-weight: 500;
    color: var(--bg);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 600;
    pointer-events: none;
    box-shadow: 0 8px 32px var(--shadow);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SEARCH HISTORY
   ═══════════════════════════════════════════════════════════════════════════════ */

.history-section {
    width: 100%;
    max-width: 360px;
    margin-top: 32px;
}

.history-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-title svg {
    opacity: 0.6;
}

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

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    font-family: var(--font-gurmukhi);
    color: var(--text);
    cursor: pointer;
    /* Claymorphism */
    box-shadow: var(--clay-outer-sm);
    transition: all 0.25s ease;
    text-align: left;
}

.history-item:hover {
    box-shadow: var(--clay-blue), var(--clay-outer-sm);
    transform: translateY(-2px);
}

.history-item:active {
    box-shadow: var(--clay-inner-sm);
    transform: scale(0.97);
}

.history-item svg {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.history-item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-remove {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    font-size: 18px;
    color: var(--text-tertiary);
    cursor: pointer;
    /* Claymorphism */
    box-shadow: var(--clay-outer-sm);
    transition: all 0.2s ease;
}

.history-remove:hover {
    background: #ff3b30;
    border-color: #ff3b30;
    color: white;
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

.history-remove:active {
    box-shadow: var(--clay-inner-sm);
    transform: scale(0.95);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   FAVORITES BUTTON
   ═══════════════════════════════════════════════════════════════════════════════ */

.result-fav {
    margin-left: auto;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 18px;
    cursor: pointer;
    border-radius: 50%;
    /* Claymorphic orb */
    box-shadow: var(--clay-outer-sm);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-fav:hover {
    box-shadow: var(--clay-gold), var(--clay-outer-sm);
}

.result-fav:active {
    box-shadow: var(--clay-inner-sm);
    transform: scale(0.9);
}

.result-fav.active {
    animation: heartPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes heartPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4);
    }

    100% {
        transform: scale(1);
    }
}