:root {
    --bg-body: #09090b;
    --bg-surface: #121216;
    --bg-card: rgba(18, 18, 22, 0.95);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-prominent: rgba(255, 255, 255, 0.18);
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent-orange: #f97316;
    --accent-orange-hover: #ea580c;
    --accent-orange-glow: rgba(249, 115, 22, 0.3);
    --btn-fn-bg: rgba(255, 255, 255, 0.08);
    --btn-fn-hover: rgba(255, 255, 255, 0.15);
    --btn-num-bg: rgba(255, 255, 255, 0.04);
    --btn-num-hover: rgba(255, 255, 255, 0.1);
    --btn-op-bg: #27272a;
    --btn-op-hover: #3f3f46;
    --btn-equals-bg: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    --radius-btn: 999px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

html {
    height: 100%;
    height: 100dvh;
    width: 100%;
    background-color: var(--bg-body);
    overscroll-behavior: none;
}

body {
    height: 100%;
    height: 100dvh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: stretch;
    background: radial-gradient(circle at 50% 0%, #1c1917 0%, #09090b 70%, #000000 100%);
    position: fixed;
    inset: 0;
    padding-top: max(env(safe-area-inset-top, 0px), 8px);
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 10px);
    padding-left: max(env(safe-area-inset-left, 0px), 10px);
    padding-right: max(env(safe-area-inset-right, 0px), 10px);
    overflow: hidden;
    touch-action: manipulation;
    overscroll-behavior: none;
}

/* Ambient Glow Background Effect */
.ambient-glow {
    position: absolute;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 400px;
    background: radial-gradient(circle, rgba(249, 115, 22, 0.14) 0%, rgba(99, 102, 241, 0.04) 55%, transparent 70%);
    filter: blur(70px);
    pointer-events: none;
    z-index: 0;
}

/* ================= FULL APP WRAPPER ================= */
.app-container {
    width: 100%;
    max-width: 500px;
    height: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
    background: transparent;
    min-height: 0;
}

/* ================= STANDARDIZED TEXT2 BRAND FLOATING ROUNDED HEADER ================= */
.app-header {
    width: 100%;
    margin: 2px 0 8px;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 25;
    flex-shrink: 0;
    background: rgba(18, 18, 22, 0.78);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.header-brand-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Back Button [ ← ]: 38x38px (mobile 34x34px), border-radius 12px, border 1.5px */
.btn-back {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.22);
    color: #ffffff;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.btn-back svg {
    transition: transform 0.2s ease;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateX(-2px);
}

.btn-back:active {
    transform: scale(0.92);
}

/* Logo Card & Brand Name */
.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.brand-link:hover {
    opacity: 0.92;
}

/* Logo Card [ 🔲 ]: White rounded card with 11px radius, 40x40px */
.brand-logo-card {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    padding: 2.5px;
    box-sizing: border-box;
    transition: transform 0.2s ease;
}

.brand-link:hover .brand-logo-card {
    transform: scale(1.05);
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
    display: block;
}

/* Brand Name: Text2 | Calculator */
.brand-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
    white-space: nowrap;
}

.brand-name {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 800;
    font-size: 19px;
    color: #ffffff;
    letter-spacing: -0.02em;
    line-height: 1;
}

.brand-divider {
    font-size: 15px;
    font-weight: 300;
    color: #52525b;
    user-select: none;
}

.brand-app {
    font-size: 15px;
    font-weight: 600;
    color: #d4d4d8;
    letter-spacing: -0.01em;
    line-height: 1;
}

/* Header Right Controls */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
}

.header-btn:active {
    transform: scale(0.92);
}

.header-btn.active {
    background: rgba(249, 115, 22, 0.18);
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}

.history-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 99px;
    background: var(--accent-orange);
    color: #000000;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.history-badge.show {
    opacity: 1;
    transform: scale(1);
}

/* ================= FULL SCREEN CALCULATOR DISPLAY & KEYPAD ================= */
.calculator-view {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0 0 2px;
    min-height: 0;
    position: relative;
    overflow: hidden;
    gap: 8px;
}

/* Clean & Elegant Screen Display Area */
.calc-screen {
    flex: 1 1 0;
    min-height: 85px;
    padding: 16px 18px 10px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    position: relative;
    background: rgba(18, 18, 22, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    margin-bottom: 2px;
    box-shadow: inset 0 2px 8px rgba(255, 255, 255, 0.02), 0 8px 24px rgba(0, 0, 0, 0.4);
    cursor: pointer;
}

.calc-expression {
    font-family: 'JetBrains Mono', monospace;
    font-size: 17px;
    font-weight: 500;
    color: var(--text-muted);
    min-height: 24px;
    word-break: break-all;
    text-align: right;
    line-height: 1.3;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.calc-expression::-webkit-scrollbar {
    display: none;
}

.calc-result-wrap {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    overflow: hidden;
}

.calc-result {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(38px, 6vh, 54px);
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.03em;
    line-height: 1.1;
    white-space: nowrap;
    text-align: right;
    cursor: pointer;
    transition: font-size 0.15s ease, color 0.15s ease;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}

.calc-result::-webkit-scrollbar {
    display: none;
}

/* Scientific Tray (Expandable) */
.scientific-tray {
    display: none;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 8px 10px;
    background: rgba(18, 18, 22, 0.8);
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    flex-shrink: 0;
    animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.scientific-tray.open {
    display: grid;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.btn-sci {
    padding: 8px 4px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-sci:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-sci:active {
    transform: scale(0.92);
}

/* ================= FULL HEIGHT KEYPAD GRID WITH GPU ACCELERATION ================= */
.calc-keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 10px;
    flex: 2.4 1 0;
    width: 100%;
    min-height: 0;
    contain: layout paint;
}

.calc-btn {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: var(--radius-btn);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
    transition: transform 0.2s cubic-bezier(0.34, 1.6, 0.64, 1), box-shadow 0.2s ease, background-color 0.15s ease, border-color 0.15s ease;
    outline: none;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    will-change: transform;
    touch-action: manipulation;
    -webkit-user-select: none;
}

/* Press States with Instant Snappy Reaction & Spring Return */
.calc-btn.btn-pressed,
.calc-btn:active {
    transform: translate3d(0, 0, 0) scale3d(0.91, 0.91, 1) !important;
    transition: transform 0.05s ease-out !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5), inset 0 2px 6px rgba(0, 0, 0, 0.35) !important;
}

.btn-operator.btn-pressed,
.btn-operator:active {
    box-shadow: 0 0 24px rgba(249, 115, 22, 0.5), inset 0 2px 6px rgba(0, 0, 0, 0.35) !important;
}

.btn-equals.btn-pressed,
.btn-equals:active {
    box-shadow: 0 0 32px rgba(249, 115, 22, 0.7), inset 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

/* GPU-Accelerated Dynamic Localized Ripple Wave */
.ripple-wave {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.15) 50%, transparent 75%);
    pointer-events: none;
    transform: translate3d(-50%, -50%, 0) scale3d(0, 0, 1);
    animation: ripple-expand 0.42s cubic-bezier(0.1, 0.85, 0.25, 1) forwards;
    will-change: transform, opacity;
}

@keyframes ripple-expand {
    0% {
        transform: translate3d(-50%, -50%, 0) scale3d(0, 0, 1);
        opacity: 1;
    }
    100% {
        transform: translate3d(-50%, -50%, 0) scale3d(3.2, 3.2, 1);
        opacity: 0;
    }
}

/* Number pop animation for screen */
.calc-result.num-pop {
    animation: numPop 0.14s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes numPop {
    0% {
        transform: translate3d(0, 0, 0) scale3d(0.97, 0.97, 1);
        filter: brightness(1.25);
    }
    100% {
        transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
        filter: brightness(1);
    }
}

/* Pure SVG Glyph & Button Text Container */
.svg-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    width: 24px;
    height: 24px;
    transform: translate3d(0, 0, 0);
    transition: transform 0.15s ease;
}

.svg-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.btn-text {
    font-family: 'JetBrains Mono', 'Plus Jakarta Sans', monospace;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    user-select: none;
}

.btn-clear .btn-text {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 19px;
    font-weight: 800;
}

/* Number Keys: 0 - 9 */
.btn-number {
    background: var(--btn-num-bg);
    border-color: rgba(255, 255, 255, 0.05);
    color: #f4f4f5;
}

.btn-number:hover {
    background: var(--btn-num-hover);
    border-color: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

/* Function Keys: AC, ⌫, % */
.btn-function {
    background: var(--btn-fn-bg);
    border-color: rgba(255, 255, 255, 0.08);
    color: #e4e4e7;
}

.btn-function:hover {
    background: var(--btn-fn-hover);
    border-color: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.btn-clear {
    color: #fb7185;
}

.btn-clear:hover {
    background: rgba(244, 63, 94, 0.15);
    border-color: rgba(244, 63, 94, 0.3);
    color: #fda4af;
}

/* Operator Keys: ÷, ×, −, + */
.btn-operator {
    background: var(--btn-op-bg);
    border-color: rgba(255, 255, 255, 0.08);
    color: #fb923c;
}

.btn-operator:hover {
    background: var(--btn-op-hover);
    border-color: rgba(249, 115, 22, 0.45);
    color: #fed7aa;
}

.btn-operator.op-active {
    background: #f97316;
    color: #ffffff;
    box-shadow: 0 0 22px var(--accent-orange-glow);
    border-color: #ffedd5;
}

/* Modifiers: ± & decimal . */
.btn-modifier {
    background: var(--btn-num-bg);
    border-color: rgba(255, 255, 255, 0.05);
    color: #e4e4e7;
}

.btn-modifier:hover {
    background: var(--btn-num-hover);
    border-color: rgba(255, 255, 255, 0.14);
}

/* Equals Key: = */
.btn-equals {
    background: var(--btn-equals-bg);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: 0 4px 18px var(--accent-orange-glow);
}

.btn-equals:hover {
    background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
    box-shadow: 0 6px 24px rgba(249, 115, 22, 0.55);
}

/* ================= HISTORY DRAWER PANEL ================= */
.history-panel {
    position: absolute;
    inset: 0;
    background: rgba(14, 14, 18, 0.98);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    z-index: 50;
    display: flex;
    flex-direction: column;
    padding: 16px 18px;
    transform: translateY(24px) scale(0.96);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.22s ease, visibility 0.22s ease;
    border-radius: 24px;
    margin: 8px;
    border: 1px solid var(--border-prominent);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
}

.history-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 12px;
}

.history-title {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.btn-history-clear {
    font-size: 12px;
    font-weight: 600;
    color: #fb7185;
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.2);
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-history-clear:hover {
    background: rgba(244, 63, 94, 0.2);
}

.btn-history-close {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 2px;
}

.history-list::-webkit-scrollbar {
    width: 4px;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.history-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.15s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateX(-2px);
}

.history-item-exp {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-muted);
    word-break: break-all;
}

.history-item-res {
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    text-align: right;
}

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 10px;
    font-size: 13px;
}

/* ================= TOAST NOTIFICATION ================= */
.toast {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(24, 24, 28, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 100;
}

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

/* ================= UPDATE NOTIFICATION PROMPT ================= */
.update-prompt {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    background: rgba(20, 20, 26, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1.5px solid rgba(251, 146, 60, 0.4);
    color: #ffffff;
    padding: 10px 12px 10px 16px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 25px rgba(251, 146, 60, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 110;
    max-width: calc(100vw - 28px);
}

.update-prompt.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.update-prompt-text {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #f4f4f5;
}

.update-prompt-btn {
    background: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
    color: #ffffff;
    border: none;
    padding: 7px 15px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.4);
    transition: transform 0.15s ease, opacity 0.15s ease;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.update-prompt-btn:hover {
    transform: scale(1.04);
}

.update-prompt-btn:active {
    transform: scale(0.96);
}

.update-prompt-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.update-prompt-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* ================= IOS PWA INSTALLATION HELPER BANNER ================= */
.ios-pwa-banner {
    position: fixed;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(140px);
    background: rgba(20, 20, 26, 0.96);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 12px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.75), 0 0 25px rgba(249, 115, 22, 0.15);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 115;
    width: calc(100vw - 24px);
    max-width: 420px;
}

.ios-pwa-banner.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.ios-pwa-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #ffffff;
    padding: 3px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.ios-pwa-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.ios-pwa-content {
    flex: 1;
    line-height: 1.4;
    color: #d4d4d8;
}

.ios-pwa-title {
    font-weight: 700;
    color: #ffffff;
    font-size: 13px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ios-pwa-highlight {
    color: #fb923c;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.ios-pwa-close {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 99px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.ios-pwa-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
}

/* ================= MULTI-DEVICE RESPONSIVE DESIGN ================= */

/* Small Phones & Low-Height Viewports (e.g., iPhone SE, Mini, Landscape) */
@media (max-height: 660px) {
    body {
        padding-top: max(env(safe-area-inset-top, 0px), 4px);
        padding-bottom: max(env(safe-area-inset-bottom, 0px), 6px);
        padding-left: max(env(safe-area-inset-left, 0px), 6px);
        padding-right: max(env(safe-area-inset-right, 0px), 6px);
    }

    .app-header {
        margin: 0 0 4px;
        padding: 4px 10px;
        border-radius: 14px;
    }

    .btn-back {
        width: 30px;
        height: 30px;
        border-radius: 8px;
    }

    .brand-logo-card {
        width: 30px;
        height: 30px;
        border-radius: 7px;
        padding: 2px;
    }

    .brand-name {
        font-size: 15px;
    }

    .brand-app {
        font-size: 12.5px;
    }

    .header-btn {
        width: 30px;
        height: 30px;
        border-radius: 8px;
    }

    .calculator-view {
        gap: 4px;
    }

    .calc-screen {
        padding: 8px 12px 6px;
        min-height: 65px;
        border-radius: 16px;
    }

    .calc-expression {
        font-size: 14px;
        min-height: 18px;
    }

    .calc-result {
        font-size: clamp(26px, 7vw, 36px);
    }

    .scientific-tray {
        gap: 4px;
        padding: 5px 6px;
        border-radius: 12px;
    }

    .btn-sci {
        padding: 5px 2px;
        font-size: 11px;
    }

    .calc-keypad {
        gap: 6px;
    }

    .btn-text {
        font-size: clamp(18px, 4.5vw, 24px);
    }

    .svg-icon {
        width: 18px;
        height: 18px;
    }
}

/* Tablets, iPads & Desktop (min-width: 600px) */
@media (min-width: 600px) {
    body {
        padding: 20px;
        background: radial-gradient(circle at 50% 20%, #1e1b18 0%, #0c0a09 60%, #000000 100%);
    }

    .app-container {
        max-width: 440px;
        height: min(92dvh, 780px);
        margin: auto;
        background: rgba(14, 14, 18, 0.78);
        backdrop-filter: blur(32px);
        -webkit-backdrop-filter: blur(32px);
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 36px;
        box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.85), 0 0 50px rgba(249, 115, 22, 0.08), inset 0 1px 1px rgba(255, 255, 255, 0.12);
        padding: 14px 12px;
        justify-content: space-between;
    }

    .app-header {
        width: 100%;
        margin: 0 0 10px 0;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 22px;
    }

    .calculator-view {
        height: calc(100% - 64px);
        gap: 10px;
    }

    .calc-screen {
        border-radius: 24px;
        background: rgba(255, 255, 255, 0.03);
    }

    .calc-keypad {
        gap: 10px;
    }

    .calc-btn:hover {
        filter: brightness(1.1);
        border-color: rgba(255, 255, 255, 0.18);
    }
}

