/* Form Controls, Buttons, Tabs & Result Card */
        /* Mode Switcher Tabs */
        .mode-switcher-container {
            display: flex;
            justify-content: center;
            margin-bottom: 20px;
        }
        .mode-tabs {
            position: relative;
            display: inline-flex;
            max-width: 100%;
            background: rgba(18, 16, 15, 0.95);
            border: 1px solid var(--border);
            border-radius: 50px;
            padding: 4px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        }
        .mode-tab-slider {
            position: absolute;
            top: 4px;
            bottom: 4px;
            left: 0;
            border-radius: 50px;
            background: var(--primary-gradient);
            box-shadow: 0 4px 14px rgba(124, 58, 237, 0.45);
            transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), 
                        width 0.24s cubic-bezier(0.16, 1, 0.3, 1);
            z-index: 1;
            pointer-events: none;
            will-change: transform, width;
            transform: translate3d(0, 0, 0);
        }
        .mode-tab {
            position: relative;
            z-index: 2;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 7px 14px;
            border-radius: 50px;
            background: transparent !important;
            border: none;
            color: var(--text-sub);
            font-family: inherit;
            font-size: 12.5px;
            font-weight: 700;
            white-space: nowrap;
            flex-shrink: 0;
            cursor: pointer;
            transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
            user-select: none;
        }
        .mode-tab span {
            white-space: nowrap;
        }
        @media (hover: hover) and (pointer: fine) {
            .mode-tab:hover {
                color: #ffffff;
            }
        }
        .mode-tab.active {
            color: #ffffff;
            background: transparent !important;
            box-shadow: none !important;
        }
        .mode-tab svg {
            width: 15px;
            height: 15px;
            fill: currentColor;
            flex-shrink: 0;
        }

        /* Mode Stage & Hardware-Accelerated Sliding Content */
        .mode-stage {
            position: relative;
            display: grid;
            grid-template-columns: 100%;
            grid-template-rows: auto;
            width: 100%;
            z-index: 50;
        }
        .mode-stage:has(.places-dropdown.show),
        .mode-stage:has(.has-dropdown-open),
        .mode-stage.has-dropdown-open {
            z-index: 2001;
        }

        .mode-content {
            grid-column: 1 / 2;
            grid-row: 1 / 2;
            position: relative;
            width: 100%;
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transition: opacity 0.18s cubic-bezier(0.22, 1, 0.36, 1), 
                        transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
                        visibility 0s linear 0.22s;
            -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
        }

        .mode-content:not(.active) {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
        }
        .mode-content:not(.active),
        .mode-content:not(.active) * {
            pointer-events: none !important;
        }

        /* LTR Slide Offsets */
        #modeLinkContent {
            transform: translate3d(-16px, 0, 0);
        }
        #modeSearchContent {
            transform: translate3d(16px, 0, 0);
        }

        /* RTL Slide Offsets (Arabic Mode) */
        html[lang="ar"] #modeLinkContent,
        [dir="rtl"] #modeLinkContent {
            transform: translate3d(16px, 0, 0);
        }
        html[lang="ar"] #modeSearchContent,
        [dir="rtl"] #modeSearchContent {
            transform: translate3d(-16px, 0, 0);
        }

        /* Active State */
        .mode-content.active {
            opacity: 1;
            visibility: visible;
            pointer-events: auto;
            transform: translate3d(0, 0, 0) !important;
            transition: opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1), 
                        transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
                        visibility 0s linear 0s;
        }

        .mode-content:has(.places-dropdown.show),
        .mode-content.has-dropdown-open {
            z-index: 2001;
        }


        /* Input Controls Row */
        .input-row {
            display: flex;
            align-items: stretch;
            gap: 6px;
            margin-bottom: 0;
            width: 100%;
        }

        .input-box-wrapper {
            flex: 1;
            min-width: 0;
            height: 52px;
            background: rgba(18, 16, 15, 0.85);
            border: 1.5px solid var(--border);
            border-radius: var(--radius-input);
            display: flex;
            align-items: center;
            transition: all 0.25s ease;
            overflow: hidden;
            box-sizing: border-box;
        }
        .input-box-wrapper:focus-within {
            border-color: var(--primary);
            box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2);
            background: rgba(18, 16, 15, 0.98);
        }
        .url-input {
            width: 100%;
            min-width: 0;
            height: 100%;
            padding: 0 12px;
            background: transparent;
            border: none;
            outline: none;
            color: #ffffff;
            font-family: 'JetBrains Mono', monospace;
            font-size: 13px;
            font-weight: 500;
            direction: ltr;
            text-align: left;
            line-height: normal;
        }
        .url-input::placeholder {
            font-family: 'Inter', 'Cairo', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
            color: var(--text-muted);
            font-size: 11.5px;
            font-weight: 400;
            letter-spacing: -0.1px;
            text-overflow: ellipsis;
            white-space: nowrap;
            overflow: hidden;
            opacity: 0.85;
            line-height: normal;
        }
        html[lang="ar"] .url-input::placeholder {
            direction: rtl;
            text-align: right;
            font-family: 'Cairo', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
        }
        html[lang="en"] .url-input::placeholder {
            direction: ltr;
            text-align: left;
            font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
        }

        /* Tool Buttons (Trash & Paste) */
        .tool-btn {
            height: 52px;
            border-radius: var(--radius-input);
            font-family: inherit;
            font-size: 12.5px;
            font-weight: 700;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            flex-shrink: 0;
            transition: all 0.2s ease;
            border: 1.5px solid var(--border);
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
        .tool-btn:active {
            transform: scale(0.94);
        }

        /* Trash/Clear Button */
        .btn-trash {
            width: 42px;
            min-width: 42px;
            background: rgba(239, 68, 68, 0.1);
            border-color: rgba(239, 68, 68, 0.25);
            color: #f87171;
        }
        .btn-trash:active {
            background: rgba(239, 68, 68, 0.25);
        }
        .btn-trash svg {
            width: 18px;
            height: 18px;
            fill: currentColor;
            display: block;
        }

        /* Paste Button (Exclusive to Android Native APK) */
        .btn-paste {
            display: none;
            padding: 0 12px;
            background: rgba(139, 92, 246, 0.14);
            border: 1.5px solid rgba(139, 92, 246, 0.35);
            color: #c4b5fd;
            font-size: 12.5px;
            font-weight: 700;
            gap: 5px;
            line-height: 1;
        }
        body.is-native-app .btn-paste {
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }
        .btn-paste:active {
            background: rgba(139, 92, 246, 0.28);
        }
        .btn-paste svg {
            width: 16px;
            height: 16px;
            fill: currentColor;
            flex-shrink: 0;
            display: block;
        }
        .btn-paste span {
            display: inline-flex;
            align-items: center;
            line-height: 1;
        }

        /* Convert Button */
        .btn-convert {
            width: 100%;
            height: 52px;
            margin-top: 14px;
            background: var(--primary-gradient);
            border: none;
            border-radius: var(--radius-btn);
            color: #ffffff;
            font-family: inherit;
            font-size: 15px;
            font-weight: 800;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            box-shadow: 0 8px 24px -4px rgba(124, 58, 237, 0.45);
            transition: all 0.2s ease;
        }
        .btn-convert:active {
            transform: scale(0.98);
            filter: brightness(0.92);
        }
        .btn-convert:disabled {
            opacity: 0.7;
            cursor: wait;
        }
        .btn-convert svg {
            width: 18px;
            height: 18px;
            fill: currentColor;
        }
        
        .spinner {
            display: none;
            width: 18px;
            height: 18px;
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-top-color: #ffffff;
            border-radius: 50%;
            animation: spin 0.7s linear infinite;
        }
        @keyframes spin {
            to { transform: rotate(360deg); }
        }


        /* Result Section */
        .result-section {
            display: none;
            position: relative;
            z-index: 10;
        }
        .result-section.active {
            display: block;
            animation: resultCardSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
            will-change: transform, opacity;
        }
        @keyframes resultCardSlideUp {
            from { opacity: 0; transform: translate3d(0, 8px, 0); }
            to { opacity: 1; transform: translate3d(0, 0, 0); }
        }

        .result-label {
            font-size: 12px;
            font-weight: 700;
            color: var(--primary-light);
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .result-label svg {
            width: 15px;
            height: 15px;
            fill: var(--primary-light);
        }

        .result-link-box {
            background: rgba(18, 16, 15, 0.9);
            border: 1px solid var(--border);
            border-radius: var(--radius-input);
            padding: 14px 16px;
            margin-bottom: 16px;
            direction: ltr;
            text-align: left;
            word-break: break-all;
            font-family: 'JetBrains Mono', monospace;
            font-size: 12px;
            color: #ffffff;
            line-height: 1.6;
        }

        /* The 3 Action Buttons */
        .actions-stack {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        .btn-action {
            width: 100%;
            height: 48px;
            border-radius: var(--radius-btn);
            font-family: inherit;
            font-size: 14px;
            font-weight: 700;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: all 0.2s ease;
        }
        .btn-action:active {
            transform: scale(0.97);
        }
        .btn-action svg {
            width: 18px;
            height: 18px;
            fill: currentColor;
        }

        /* Button 1: Copy */
        .btn-copy {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border);
            color: #ffffff;
        }
        .btn-copy.copied {
            background: rgba(16, 185, 129, 0.2) !important;
            border-color: var(--success) !important;
            color: var(--success) !important;
        }

        /* Button 2: Open */
        .btn-open {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border);
            color: #ffffff;
        }

        /* Button 3: Share */
        .btn-share {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border);
            color: #ffffff;
        }

        /* Button 4: QR Code */
        .btn-qr {
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid var(--border);
            color: #ffffff;
        }

        /* Button 1 (Hero): Write to NFC (Exclusive to Android Native APK) */
        .btn-nfc {
            display: none;
            background: linear-gradient(135deg, rgba(124, 58, 237, 0.25) 0%, rgba(194, 65, 12, 0.35) 100%);
            border: 1.5px solid rgba(139, 92, 246, 0.6);
            color: #ffedd5;
            box-shadow: 0 4px 18px rgba(124, 58, 237, 0.25);
        }
        body.is-native-app .btn-nfc {
            display: flex;
        }
        .btn-nfc:active {
            box-shadow: 0 2px 10px rgba(124, 58, 237, 0.4);
        }

        /* Bottom Docked Rectangular GitHub Button (App Exclusive) */
        .bottom-github-dock {
            display: none !important;
        }
        body.is-native-app .bottom-github-dock {
            display: flex !important;
            position: relative;
            width: 100%;
            justify-content: center;
            margin: 0 0 20px 0;
            padding: 0;
            background: transparent;
            pointer-events: auto;
            z-index: 20;
            transition: opacity 0.2s ease, transform 0.2s ease;
        }
        body.is-native-app.keyboard-open .bottom-github-dock {
            display: none !important;
        }
        body.is-native-app.keyboard-open .bottom-github-dock * {
            pointer-events: none !important;
        }
        .fab-github {
            pointer-events: auto;
            width: 100%;
            max-width: 450px;
            height: 48px;
            padding: 0 18px;
            border-radius: var(--radius-btn);
            background: linear-gradient(135deg, rgba(34, 30, 28, 0.96) 0%, rgba(22, 19, 18, 0.98) 100%);
            border: 1px solid rgba(255, 255, 255, 0.14);
            color: #fafaf9;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            text-decoration: none;
            font-family: inherit;
            font-size: 13.5px;
            font-weight: 700;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
            transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
            cursor: pointer;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
        }
        .fab-github-logo {
            width: 20px;
            height: 20px;
            fill: currentColor;
            flex-shrink: 0;
            transition: transform 0.2s ease;
        }
        .fab-github-label {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .fab-github-ext {
            width: 15px;
            height: 15px;
            fill: var(--text-sub);
            flex-shrink: 0;
            opacity: 0.78;
            transition: transform 0.2s ease, opacity 0.2s ease, fill 0.2s ease;
        }
        @media (hover: hover) and (pointer: fine) {
            .fab-github:hover {
                transform: translate3d(0, -1px, 0);
                background: linear-gradient(135deg, rgba(44, 39, 36, 0.98) 0%, rgba(28, 25, 23, 0.99) 100%);
                border-color: rgba(167, 139, 250, 0.45);
                box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65), 0 0 18px rgba(139, 92, 246, 0.18);
            }
            .fab-github:hover .fab-github-ext {
                opacity: 1;
                fill: #c4b5fd;
                transform: translate3d(1px, -1px, 0);
            }
        }
        .fab-github:active {
            transform: scale3d(0.975, 0.975, 1);
            border-color: rgba(139, 92, 246, 0.5);
            background: rgba(20, 18, 16, 0.99);
        }

        /* Standalone NFC Card Action Tools */
        .card-tools-row {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
            margin-top: 14px;
            margin-bottom: 2px;
            width: 100%;
            transition: opacity 0.2s ease, transform 0.2s ease;
        }
        .btn-card-tool {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 6px;
            background: rgba(18, 16, 15, 0.88);
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 10px 8px;
            color: var(--text-sub);
            font-size: 11.5px;
            font-weight: 700;
            font-family: inherit;
            cursor: pointer;
            transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
            text-align: center;
            line-height: 1.25;
            min-height: 62px;
            user-select: none;
        }
        @media (hover: hover) and (pointer: fine) {
            .btn-card-tool:hover {
                background: rgba(124, 58, 237, 0.16);
                border-color: rgba(139, 92, 246, 0.45);
                color: #ffffff;
                transform: translate3d(0, -1px, 0);
            }
            .btn-card-tool:hover svg {
                fill: #ffffff;
                transform: scale3d(1.08, 1.08, 1);
            }
            .btn-card-tool.btn-tool-danger:hover {
                background: rgba(245, 39, 125, 0.14);
                border-color: rgba(245, 39, 125, 0.55);
                color: #ffffff;
            }
            .btn-card-tool.btn-tool-wifi:hover {
                background: rgba(245, 158, 11, 0.14);
                border-color: rgba(245, 158, 11, 0.55);
                color: #ffffff;
            }
            .btn-card-tool.btn-tool-wifi:hover svg {
                fill: #fbbf24;
            }
        }
        .btn-card-tool:active {
            background: rgba(124, 58, 237, 0.18);
            border-color: rgba(139, 92, 246, 0.5);
            color: #ffffff;
            transform: scale3d(0.95, 0.95, 1);
        }
        .btn-card-tool svg {
            width: 19px;
            height: 19px;
            fill: #a78bfa;
            transition: transform 0.18s ease, fill 0.18s ease;
            flex-shrink: 0;
        }
        .btn-card-tool.btn-tool-wifi {
            border-color: rgba(245, 158, 11, 0.28);
        }
        .btn-card-tool.btn-tool-wifi:active {
            background: rgba(245, 158, 11, 0.22);
            border-color: rgba(245, 158, 11, 0.65);
            color: #ffffff;
        }
        .btn-card-tool.btn-tool-wifi svg {
            fill: #f59e0b;
        }
        .btn-card-tool.btn-tool-danger {
            border-color: rgba(245, 39, 125, 0.25);
        }
        .btn-card-tool.btn-tool-danger:active {
            background: rgba(245, 39, 125, 0.16);
            border-color: rgba(245, 39, 125, 0.55);
            color: #ffffff;
        }
        .btn-card-tool.btn-tool-danger svg {
            fill: #F5277D;
        }
        .btn-card-tool.morph-active-btn {
            transform: scale3d(0.95, 0.95, 1) !important;
            opacity: 0.78 !important;
            transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s ease;
        }
