/* ============================================
   Prism Protocol — Quantum Terminal
   Professional Cyberpunk Calculator Styles
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'JetBrains Mono', monospace;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at 50% 0%, #0d172e 0%, #05070c 70%);
    color: #e2e8f0;
    padding: 20px;
}

/* Main Card */
.terminal-card {
    width: 100%;
    max-width: 380px;
    background: rgba(10, 14, 23, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 210, 255, 0.22);
    border-radius: 22px;
    padding: 24px;
    box-shadow: 
        0 0 40px rgba(0, 140, 255, 0.18),
        0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Header */
.terminal-header {
    margin-bottom: 20px;
}

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

.brand-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px #00d2ff);
}

.brand-text h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #ffffff;
}

.status-badge {
    font-size: 0.65rem;
    color: #00d2ff;
    letter-spacing: 1.2px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.pulse {
    width: 7px;
    height: 7px;
    background: #00d2ff;
    border-radius: 50%;
    box-shadow: 0 0 10px #00d2ff;
    animation: pulse 1.6s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

/* Mode Switcher */
.nav-modes {
    display: flex;
    gap: 5px;
    background: #090e18;
    padding: 5px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.mode-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: #64748b;
    padding: 8px 0;
    font-size: 0.72rem;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    color: #94a3b8;
}

.mode-btn.active {
    background: linear-gradient(135deg, #0051ff, #00a2ff);
    color: #ffffff;
    box-shadow: 0 0 14px rgba(0, 81, 255, 0.45);
}

/* Display */
.display-panel {
    background: #060911;
    border: 1px solid rgba(0, 210, 255, 0.12);
    border-radius: 14px;
    padding: 18px 20px;
    text-align: right;
    margin-bottom: 18px;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.history-line {
    font-size: 0.85rem;
    color: #64748b;
    min-height: 1.3rem;
    margin-bottom: 4px;
    word-break: break-all;
}

.main-line {
    font-size: 2.3rem;
    font-weight: 700;
    color: #00d2ff;
    text-shadow: 0 0 14px rgba(0, 210, 255, 0.35);
    overflow-x: auto;
    white-space: nowrap;
    letter-spacing: -0.5px;
}

/* Extra Grid (for SCI / PROG / DEFI) */
.extra-grid {
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.extra-grid .btn {
    height: 42px;
    font-size: 0.85rem;
}

/* Keypad */
.keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.btn {
    position: relative;
    overflow: hidden;
    height: 54px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: #101625;
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.btn:hover {
    background: #161e30;
    border-color: rgba(0, 210, 255, 0.2);
}

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

.btn-op {
    background: #0f223f;
    color: #00d2ff;
}

.btn-op:hover {
    background: #14305a;
}

.btn-action {
    background: #23121b;
    color: #ff3b69;
}

.btn-action:hover {
    background: #321828;
}

.btn-equal {
    grid-column: span 2;
    background: linear-gradient(135deg, #0051ff, #00d2ff);
    color: #ffffff;
    font-weight: 800;
    letter-spacing: 1px;
    border: none;
    box-shadow: 0 4px 18px rgba(0, 100, 255, 0.35);
}

.btn-equal:hover {
    filter: brightness(1.08);
    box-shadow: 0 6px 22px rgba(0, 100, 255, 0.45);
}


.btn-sci-op {
    background: #121a2e;
    color: #a5b4fc;
}

/* Responsive */
@media (max-width: 420px) {
    .terminal-card {
        padding: 18px;
        border-radius: 18px;
    }

    .main-line {
        font-size: 1.9rem;
    }

    .btn {
        height: 50px;
        font-size: 1.05rem;
    }
  }



/* ============================================
   Animations & ambient effects
   ============================================ */

body { overflow-x: hidden; }

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgba(0, 210, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 210, 255, 0.05) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
    animation: gridDrift 24s linear infinite;
}

@keyframes gridDrift {
    to { background-position: 42px 42px, 42px 42px; }
}

.bg-orbs { position: fixed; inset: 0; z-index: -2; overflow: hidden; }
.bg-orbs span {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    animation: orbFloat 16s ease-in-out infinite alternate;
}
.bg-orbs span:nth-child(1) { width: 360px; height: 360px; background: #0051ff; top: -80px; left: -60px; }
.bg-orbs span:nth-child(2) { width: 300px; height: 300px; background: #00d2ff; bottom: -90px; right: -40px; animation-delay: -5s; }
.bg-orbs span:nth-child(3) { width: 240px; height: 240px; background: #6c63ff; top: 45%; left: 55%; animation-delay: -10s; }

@keyframes orbFloat {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, 40px) scale(1.15); }
}

.terminal-card {
    position: relative;
    animation: cardIn 0.7s cubic-bezier(.2, .8, .2, 1) both;
}

/* animated neon border */
.terminal-card::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: conic-gradient(from var(--angle, 0deg), transparent 60%, #00d2ff, #6c63ff, transparent 90%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: borderSpin 6s linear infinite;
    pointer-events: none;
}

@property --angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

@keyframes borderSpin { to { --angle: 360deg; } }

@keyframes cardIn {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}

.brand-logo { animation: logoGlow 3s ease-in-out infinite; }
@keyframes logoGlow {
    0%, 100% { filter: drop-shadow(0 0 6px #00d2ff); }
    50%      { filter: drop-shadow(0 0 16px #6c63ff); }
}

.main-line { transition: font-size 0.15s ease; }
.main-line.flash { animation: resultFlash 0.45s ease; }
.main-line.is-error { color: #ff3b69; text-shadow: 0 0 14px rgba(255, 59, 105, 0.4); }

@keyframes resultFlash {
    0%   { opacity: 0.2; transform: translateY(6px); text-shadow: 0 0 30px #00d2ff; }
    100% { opacity: 1;   transform: none; }
}

.extra-grid.show { display: grid; }
.extra-grid.show > * { animation: popIn 0.3s ease both; }

@keyframes popIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.95); }
    to   { opacity: 1; transform: none; }
}

.ripple {
    position: absolute;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border-radius: 50%;
    background: rgba(0, 210, 255, 0.45);
    pointer-events: none;
    animation: ripple 0.5s ease-out forwards;
}

@keyframes ripple {
    to { transform: scale(14); opacity: 0; }
}

/* DeFi rate input */
.rate-field {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 0 8px;
    height: 42px;
    border-radius: 12px;
    background: #0a1120;
    border: 1px solid rgba(0, 210, 255, 0.2);
}
.rate-field span { font-size: 0.55rem; color: #64748b; letter-spacing: 1px; }
.rate-field input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #00d2ff;
    font-weight: 700;
    font-size: 0.9rem;
}

.terminal-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 18px;
    font-size: 0.65rem;
    color: #64748b;
}
.terminal-footer a { color: #00d2ff; text-decoration: none; }
.terminal-footer a:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
    *, *::before { animation: none !important; transition: none !important; }
}
