@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700;900&family=Rajdhani:wght@500;600;700&display=swap');

/* calculator.css */
:root{
    --bg:#050505;--border:#1a1a1a;--c-base:#00ff41;--c-std:#00d2ff; --glow-base: rgba(0, 255, 65, 0.2);
    --clr-1:#39ff14; --clr-2:#00ffff; --clr-3:#ff00ff; --clr-4:#ffff00; --clr-5:#ff3131; 
    --clr-6:#ff9900; --clr-7:#cc00ff; --clr-8:#0088ff; --clr-9:#ff007f; --clr-10:#bfff00; 
    --clr-11:#9900ff; --clr-12:#00ff66; --clr-13:#6666ff; --clr-14:#ff6600; --clr-15:#ff00cc; 
    --clr-16:#00ccff; --clr-17:#ccff00; --clr-18:#ff99ff; --clr-19:#ffcc99;
    --clr-20:#00ffaa; --clr-21:#ff00aa; 
    --c-tooltip-bg: rgba(0,0,0,0.9);
    --card-bg: rgba(10, 10, 10, 0.95);
    --card-blur: blur(10px);
    --card-shadow: 0 4px 15px rgba(0,0,0,0.8);
    --card-border-style: solid;
    --card-border-width: 1px;
    --input-glow: 0 0 10px var(--glow-base), inset 0 0 8px rgba(0,255,65,0.15);
    --header-glow: 0 0 15px;
}

/* ============================================================================
   ENHANCED THEME ENGINE - UNIQUE AESTHETICS PER THEME
   ============================================================================ */

/* CYBER MATRIX - Classic neon terminal aesthetic */
body.theme-cyber { 
    --c-base: #00ff41; 
    --c-std: #00d2ff; 
    --glow-base: rgba(0, 255, 65, 0.25);
    --card-bg: rgba(5, 15, 5, 0.92);
    --card-shadow: 0 4px 20px rgba(0, 255, 65, 0.15), 0 0 1px rgba(0, 255, 65, 0.3);
    --card-border-style: solid;
    --input-glow: 0 0 12px rgba(0, 255, 65, 0.4), inset 0 0 10px rgba(0, 255, 65, 0.1);
    --header-glow: 0 0 20px;
}
body.theme-cyber .card { border-color: rgba(0, 255, 65, 0.3); }
body.theme-cyber .sticky-container { box-shadow: 0 5px 30px rgba(0, 255, 65, 0.2), inset 0 1px 0 rgba(0, 255, 65, 0.1); }
body.theme-cyber .calc-input { border-color: var(--c-base); }

/* BLOOD MOON - Dark crimson with ember accents */
body.theme-blood { 
    --c-base: #ff1144; 
    --c-std: #ff6600; 
    --glow-base: rgba(255, 17, 68, 0.25); 
    --bg: #0a0000; 
    --border: #3a0a0a; 
    --c-forge: #ff5500; 
    --c-math: #cc0000;
    --card-bg: rgba(20, 5, 5, 0.94);
    --card-shadow: 0 4px 25px rgba(255, 17, 68, 0.2), 0 0 2px rgba(255, 100, 0, 0.3);
    --card-border-style: solid;
    --input-glow: 0 0 15px rgba(255, 17, 68, 0.35), inset 0 0 8px rgba(255, 50, 0, 0.15);
    --header-glow: 0 0 25px;
}
body.theme-blood .card { border-color: rgba(255, 17, 68, 0.35); background: linear-gradient(180deg, rgba(25, 5, 5, 0.95) 0%, rgba(10, 0, 0, 0.98) 100%); }
body.theme-blood .sticky-container { border-color: rgba(255, 68, 68, 0.3); box-shadow: 0 5px 35px rgba(255, 17, 68, 0.25); }
body.theme-blood .tool-tab.active { border-color: var(--c-std); box-shadow: 0 0 20px rgba(255, 100, 0, 0.3), inset 0 0 10px rgba(255, 100, 0, 0.1); }

/* DEEP ABYSS - Ocean depths with bioluminescence */
body.theme-abyss { 
    --c-base: #00ffff; 
    --c-std: #0077ff; 
    --glow-base: rgba(0, 255, 255, 0.2); 
    --bg: #000508; 
    --border: #001a33; 
    --c-forge: #00aaff; 
    --c-math: #0044cc;
    --card-bg: rgba(0, 10, 20, 0.94);
    --card-shadow: 0 4px 30px rgba(0, 150, 255, 0.15), 0 0 1px rgba(0, 255, 255, 0.2);
    --card-border-style: solid;
    --input-glow: 0 0 15px rgba(0, 255, 255, 0.3), inset 0 0 12px rgba(0, 150, 255, 0.1);
    --header-glow: 0 0 25px;
}
body.theme-abyss .card { border-color: rgba(0, 150, 255, 0.25); background: linear-gradient(180deg, rgba(0, 15, 30, 0.95) 0%, rgba(0, 5, 15, 0.98) 100%); }
body.theme-abyss .sticky-container { border-color: rgba(0, 200, 255, 0.25); box-shadow: 0 8px 40px rgba(0, 150, 255, 0.2); }
body.theme-abyss .cipher-box { border-color: rgba(0, 150, 255, 0.2); }

/* MIDNIGHT GOLD - Luxury dark with gilded accents */
body.theme-gold { 
    --c-base: #ffd700; 
    --c-std: #ffaa00; 
    --glow-base: rgba(255, 215, 0, 0.2); 
    --bg: #0a0800; 
    --border: #332b00; 
    --c-forge: #ffee88; 
    --c-math: #ff8800;
    --card-bg: rgba(15, 12, 5, 0.95);
    --card-shadow: 0 4px 25px rgba(255, 200, 0, 0.12), 0 1px 0 rgba(255, 215, 0, 0.15);
    --card-border-style: solid;
    --input-glow: 0 0 12px rgba(255, 215, 0, 0.3), inset 0 0 8px rgba(255, 180, 0, 0.1);
    --header-glow: 0 0 20px;
}
body.theme-gold .card { border-color: rgba(255, 200, 0, 0.3); border-width: 1px; background: linear-gradient(180deg, rgba(20, 15, 5, 0.95) 0%, rgba(8, 6, 0, 0.98) 100%); }
body.theme-gold .sticky-container { border-color: rgba(255, 215, 0, 0.35); box-shadow: 0 6px 30px rgba(255, 200, 0, 0.15); }
body.theme-gold .hero-title { text-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 2px 4px rgba(0,0,0,0.8); }

/* NEON SYNTH - Retrowave purple/magenta */
body.theme-synth { 
    --c-base: #ff00ff; 
    --c-std: #7700ff; 
    --glow-base: rgba(255, 0, 255, 0.25); 
    --bg: #08000a; 
    --border: #2a002a; 
    --c-forge: #ff00aa; 
    --c-math: #aa00ff;
    --card-bg: rgba(15, 5, 20, 0.94);
    --card-shadow: 0 4px 30px rgba(255, 0, 255, 0.15), 0 0 2px rgba(150, 0, 255, 0.3);
    --card-border-style: solid;
    --input-glow: 0 0 18px rgba(255, 0, 255, 0.35), inset 0 0 10px rgba(200, 0, 255, 0.12);
    --header-glow: 0 0 30px;
}
body.theme-synth .card { border-color: rgba(255, 0, 255, 0.3); background: linear-gradient(180deg, rgba(20, 5, 25, 0.95) 0%, rgba(8, 0, 12, 0.98) 100%); }
body.theme-synth .sticky-container { border-color: rgba(255, 0, 200, 0.35); box-shadow: 0 6px 35px rgba(255, 0, 255, 0.2), 0 0 1px rgba(255, 0, 255, 0.4); }
body.theme-synth .tool-tab.active { box-shadow: 0 0 25px rgba(150, 0, 255, 0.4), inset 0 0 12px rgba(150, 0, 255, 0.15); }

/* AMBER CRT - Retro terminal phosphor glow */
body.theme-amber { 
    --c-base: #ffb000; 
    --c-std: #ff8800; 
    --glow-base: rgba(255, 176, 0, 0.25); 
    --bg: #050300; 
    --border: #332200; 
    --c-forge: #ffcc00; 
    --c-math: #ff5500;
    --card-bg: rgba(12, 8, 2, 0.95);
    --card-shadow: 0 4px 20px rgba(255, 150, 0, 0.12), 0 0 1px rgba(255, 176, 0, 0.25);
    --card-border-style: solid;
    --input-glow: 0 0 14px rgba(255, 176, 0, 0.4), inset 0 0 10px rgba(255, 140, 0, 0.12);
    --header-glow: 0 0 18px;
}
body.theme-amber .card { border-color: rgba(255, 150, 0, 0.3); background: linear-gradient(180deg, rgba(18, 12, 4, 0.96) 0%, rgba(6, 4, 0, 0.98) 100%); }
body.theme-amber .sticky-container { border-color: rgba(255, 176, 0, 0.35); box-shadow: 0 5px 25px rgba(255, 150, 0, 0.18); }
body.theme-amber .calc-input { text-shadow: 0 0 8px rgba(255, 176, 0, 0.5); }

/* EMERALD - Rich forest greens */
body.theme-emerald { 
    --c-base: #00ff88; 
    --c-std: #00cc66; 
    --glow-base: rgba(0, 255, 136, 0.22); 
    --bg: #000a04; 
    --border: #003318; 
    --c-forge: #55ffaa; 
    --c-math: #00aa55;
    --card-bg: rgba(2, 15, 8, 0.94);
    --card-shadow: 0 4px 25px rgba(0, 200, 100, 0.12), 0 0 1px rgba(0, 255, 136, 0.2);
    --card-border-style: solid;
    --input-glow: 0 0 14px rgba(0, 255, 136, 0.35), inset 0 0 10px rgba(0, 200, 100, 0.1);
    --header-glow: 0 0 22px;
}
body.theme-emerald .card { border-color: rgba(0, 200, 100, 0.3); background: linear-gradient(180deg, rgba(5, 20, 12, 0.95) 0%, rgba(0, 8, 4, 0.98) 100%); }
body.theme-emerald .sticky-container { border-color: rgba(0, 255, 136, 0.3); box-shadow: 0 6px 30px rgba(0, 200, 100, 0.15); }

/* AMETHYST - Royal violet with golden accents */
body.theme-amethyst { 
    --c-base: #b800ff; 
    --c-std: #d4af37; 
    --glow-base: rgba(184, 0, 255, 0.22); 
    --bg: #06000a; 
    --border: #250035; 
    --c-forge: #cc66ff; 
    --c-math: #ffaa00;
    --card-bg: rgba(12, 5, 18, 0.94);
    --card-shadow: 0 4px 28px rgba(150, 0, 220, 0.15), 0 0 1px rgba(212, 175, 55, 0.2);
    --card-border-style: solid;
    --input-glow: 0 0 16px rgba(184, 0, 255, 0.35), inset 0 0 10px rgba(150, 0, 200, 0.1);
    --header-glow: 0 0 25px;
}
body.theme-amethyst .card { border-color: rgba(150, 0, 220, 0.3); background: linear-gradient(180deg, rgba(18, 8, 28, 0.95) 0%, rgba(6, 0, 10, 0.98) 100%); }
body.theme-amethyst .sticky-container { border-color: rgba(184, 0, 255, 0.35); box-shadow: 0 6px 35px rgba(150, 0, 220, 0.18); }
body.theme-amethyst .hero-title span { text-shadow: 0 0 15px rgba(212, 175, 55, 0.6); }

/* COBALT STRIKE - Deep electric blue */
body.theme-cobalt { 
    --c-base: #0088ff; 
    --c-std: #00ccff; 
    --glow-base: rgba(0, 136, 255, 0.22); 
    --bg: #000308; 
    --border: #001540; 
    --c-forge: #0066ff; 
    --c-math: #00aaff;
    --card-bg: rgba(2, 8, 18, 0.94);
    --card-shadow: 0 4px 28px rgba(0, 100, 220, 0.15), 0 0 1px rgba(0, 150, 255, 0.25);
    --card-border-style: solid;
    --input-glow: 0 0 15px rgba(0, 136, 255, 0.4), inset 0 0 10px rgba(0, 100, 200, 0.12);
    --header-glow: 0 0 22px;
}
body.theme-cobalt .card { border-color: rgba(0, 100, 200, 0.35); background: linear-gradient(180deg, rgba(4, 12, 28, 0.95) 0%, rgba(0, 4, 12, 0.98) 100%); }
body.theme-cobalt .sticky-container { border-color: rgba(0, 136, 255, 0.35); box-shadow: 0 6px 32px rgba(0, 100, 220, 0.2); }
body.theme-cobalt .tool-tab.active { box-shadow: 0 0 22px rgba(0, 150, 255, 0.35), inset 0 0 10px rgba(0, 150, 255, 0.12); }

/* CRIMSON VOID - Harsh blood red */
body.theme-crimson { 
    --c-base: #ff0033; 
    --c-std: #dd0000; 
    --glow-base: rgba(255, 0, 51, 0.25); 
    --bg: #080000; 
    --border: #330005; 
    --c-forge: #ff4444; 
    --c-math: #bb0000;
    --card-bg: rgba(18, 4, 4, 0.94);
    --card-shadow: 0 4px 28px rgba(200, 0, 30, 0.18), 0 0 2px rgba(255, 0, 50, 0.3);
    --card-border-style: solid;
    --input-glow: 0 0 18px rgba(255, 0, 51, 0.4), inset 0 0 12px rgba(200, 0, 30, 0.15);
    --header-glow: 0 0 28px;
}
body.theme-crimson .card { border-color: rgba(200, 0, 30, 0.4); background: linear-gradient(180deg, rgba(25, 5, 5, 0.95) 0%, rgba(10, 0, 0, 0.98) 100%); }
body.theme-crimson .sticky-container { border-color: rgba(255, 0, 50, 0.4); box-shadow: 0 6px 35px rgba(200, 0, 30, 0.25); }
body.theme-crimson .hero-title { text-shadow: 0 0 25px rgba(255, 0, 50, 0.7); }

/* FROST - Ice cold winter whites and pale blues */
body.theme-frost { 
    --c-base: #88ddff; 
    --c-std: #aaeeff; 
    --glow-base: rgba(136, 221, 255, 0.25); 
    --bg: #040608; 
    --border: #1a2a35; 
    --c-forge: #66ccff; 
    --c-math: #55bbee;
    --card-bg: rgba(8, 15, 20, 0.94);
    --card-shadow: 0 4px 30px rgba(136, 221, 255, 0.12), 0 0 2px rgba(170, 238, 255, 0.2);
    --card-border-style: solid;
    --input-glow: 0 0 20px rgba(136, 221, 255, 0.35), inset 0 0 12px rgba(136, 221, 255, 0.1);
    --header-glow: 0 0 30px;
}
body.theme-frost .card { border-color: rgba(136, 221, 255, 0.25); background: linear-gradient(180deg, rgba(10, 18, 25, 0.95) 0%, rgba(4, 8, 12, 0.98) 100%); }
body.theme-frost .sticky-container { border-color: rgba(136, 221, 255, 0.3); box-shadow: 0 6px 35px rgba(136, 221, 255, 0.15); }
body.theme-frost .hero-title { text-shadow: 0 0 25px rgba(170, 238, 255, 0.6); }
body.theme-frost .calc-input { text-shadow: 0 0 10px rgba(136, 221, 255, 0.5); }

/* SAKURA - Cherry blossom pink */
body.theme-sakura { 
    --c-base: #ff77aa; 
    --c-std: #ff99cc; 
    --glow-base: rgba(255, 119, 170, 0.25); 
    --bg: #0a0508; 
    --border: #3a1525; 
    --c-forge: #ff88bb; 
    --c-math: #ee5599;
    --card-bg: rgba(20, 8, 15, 0.94);
    --card-shadow: 0 4px 28px rgba(255, 119, 170, 0.15), 0 0 2px rgba(255, 153, 204, 0.25);
    --card-border-style: solid;
    --input-glow: 0 0 18px rgba(255, 119, 170, 0.4), inset 0 0 12px rgba(255, 119, 170, 0.12);
    --header-glow: 0 0 28px;
}
body.theme-sakura .card { border-color: rgba(255, 119, 170, 0.3); background: linear-gradient(180deg, rgba(25, 10, 18, 0.95) 0%, rgba(12, 4, 8, 0.98) 100%); }
body.theme-sakura .sticky-container { border-color: rgba(255, 119, 170, 0.35); box-shadow: 0 6px 32px rgba(255, 119, 170, 0.2); }
body.theme-sakura .hero-title { text-shadow: 0 0 25px rgba(255, 153, 204, 0.6); }

/* TOXIC - Radioactive neon green/yellow */
body.theme-toxic { 
    --c-base: #aaff00; 
    --c-std: #ccff33; 
    --glow-base: rgba(170, 255, 0, 0.3); 
    --bg: #050800; 
    --border: #1a2a00; 
    --c-forge: #88dd00; 
    --c-math: #66bb00;
    --card-bg: rgba(12, 18, 4, 0.94);
    --card-shadow: 0 4px 30px rgba(170, 255, 0, 0.15), 0 0 3px rgba(204, 255, 51, 0.3);
    --card-border-style: solid;
    --input-glow: 0 0 22px rgba(170, 255, 0, 0.45), inset 0 0 15px rgba(170, 255, 0, 0.15);
    --header-glow: 0 0 32px;
}
body.theme-toxic .card { border-color: rgba(170, 255, 0, 0.35); background: linear-gradient(180deg, rgba(15, 22, 5, 0.95) 0%, rgba(6, 10, 0, 0.98) 100%); }
body.theme-toxic .sticky-container { border-color: rgba(170, 255, 0, 0.4); box-shadow: 0 6px 35px rgba(170, 255, 0, 0.2); }
body.theme-toxic .hero-title { text-shadow: 0 0 30px rgba(170, 255, 0, 0.7); }
body.theme-toxic .calc-input { text-shadow: 0 0 12px rgba(170, 255, 0, 0.6); }

/* SLATE - Monochrome grayscale with silver accents */
body.theme-slate { 
    --c-base: #aabbcc; 
    --c-std: #99aabb; 
    --glow-base: rgba(170, 187, 204, 0.2); 
    --bg: #08080a; 
    --border: #252830; 
    --c-forge: #8899aa; 
    --c-math: #778899;
    --card-bg: rgba(15, 16, 20, 0.95);
    --card-shadow: 0 4px 25px rgba(170, 187, 204, 0.08), 0 0 1px rgba(170, 187, 204, 0.15);
    --card-border-style: solid;
    --input-glow: 0 0 15px rgba(170, 187, 204, 0.25), inset 0 0 10px rgba(170, 187, 204, 0.08);
    --header-glow: 0 0 20px;
}
body.theme-slate .card { border-color: rgba(170, 187, 204, 0.2); background: linear-gradient(180deg, rgba(18, 20, 25, 0.96) 0%, rgba(8, 9, 12, 0.98) 100%); }
body.theme-slate .sticky-container { border-color: rgba(170, 187, 204, 0.25); box-shadow: 0 6px 28px rgba(0, 0, 0, 0.4); }
body.theme-slate .hero-title { text-shadow: 0 0 20px rgba(170, 187, 204, 0.4); }

/* SUNSET - Warm coral orange to pink */
body.theme-sunset { 
    --c-base: #ff7744; 
    --c-std: #ff9966; 
    --glow-base: rgba(255, 119, 68, 0.25); 
    --bg: #0a0400; 
    --border: #3a1a08; 
    --c-forge: #ff8855; 
    --c-math: #ff6633;
    --card-bg: rgba(20, 10, 5, 0.94);
    --card-shadow: 0 4px 28px rgba(255, 119, 68, 0.15), 0 0 2px rgba(255, 153, 102, 0.25);
    --card-border-style: solid;
    --input-glow: 0 0 20px rgba(255, 119, 68, 0.4), inset 0 0 12px rgba(255, 119, 68, 0.12);
    --header-glow: 0 0 28px;
}
body.theme-sunset .card { border-color: rgba(255, 119, 68, 0.3); background: linear-gradient(180deg, rgba(25, 12, 6, 0.95) 0%, rgba(12, 5, 2, 0.98) 100%); }
body.theme-sunset .sticky-container { border-color: rgba(255, 119, 68, 0.35); box-shadow: 0 6px 32px rgba(255, 119, 68, 0.2); }
body.theme-sunset .hero-title { text-shadow: 0 0 25px rgba(255, 153, 102, 0.6); }

/* COPPER - Warm metallic bronze */
body.theme-copper { 
    --c-base: #cc7744; 
    --c-std: #dd9966; 
    --glow-base: rgba(204, 119, 68, 0.25); 
    --bg: #080604; 
    --border: #2a1a10; 
    --c-forge: #bb6633; 
    --c-math: #aa5522;
    --card-bg: rgba(18, 12, 8, 0.94);
    --card-shadow: 0 4px 25px rgba(204, 119, 68, 0.12), 0 0 2px rgba(221, 153, 102, 0.2);
    --card-border-style: solid;
    --input-glow: 0 0 18px rgba(204, 119, 68, 0.35), inset 0 0 10px rgba(204, 119, 68, 0.1);
    --header-glow: 0 0 25px;
}
body.theme-copper .card { border-color: rgba(204, 119, 68, 0.28); background: linear-gradient(180deg, rgba(22, 14, 10, 0.95) 0%, rgba(10, 6, 4, 0.98) 100%); }
body.theme-copper .sticky-container { border-color: rgba(204, 119, 68, 0.32); box-shadow: 0 6px 28px rgba(204, 119, 68, 0.15); }
body.theme-copper .hero-title { text-shadow: 0 0 22px rgba(221, 153, 102, 0.5); }
body.theme-copper .calc-input { text-shadow: 0 0 8px rgba(204, 119, 68, 0.4); }

/* ============================================================================
   VISUAL POLISH - ANIMATIONS & EFFECTS
   ============================================================================ */

/* Subtle pulsing glow for active elements */
@keyframes subtleGlow {
    0%, 100% { filter: drop-shadow(0 0 3px var(--glow-base)); }
    50% { filter: drop-shadow(0 0 8px var(--glow-base)) drop-shadow(0 0 15px var(--glow-base)); }
}

/* Smooth theme transition properties */
.card, .sticky-container, .calc-input, .tool-tab, .cipher-box, .hero-title, .hero-subtitle {
    transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease, text-shadow 0.4s ease;
}

/* ============================================================================
   BASE STYLES
   ============================================================================ */

*, *::before, *::after { box-sizing: border-box; }

html, body { 
    max-width: 100vw; 
    min-height: 100vh;
    overflow-x: hidden; 
    background: var(--bg) url('/static/grey1.jpg') no-repeat center center fixed;
    background-size: cover; 
    color: #fff; 
    font-family: 'Rajdhani', sans-serif; 
    margin: 0; 
    padding: 0; 
}

html.dark-mode, body.dark-mode { 
    background:
        radial-gradient(ellipse at center, color-mix(in srgb, var(--c-base) 4%, transparent) 0%, transparent 55%),
        radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.55) 100%),
        var(--bg) !important; 
    background-image:
        radial-gradient(ellipse at center, color-mix(in srgb, var(--c-base) 4%, transparent) 0%, transparent 55%),
        radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.55) 100%) !important;
    background-attachment: fixed, fixed !important;
    background-color: var(--bg) !important;
}

/* Ultra-subtle noise overlay (~3% opacity) - prevents color banding on dark gradients
   without being visually noticeable. Tiny inline SVG, no external request. */
html.dark-mode body.dark-mode::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.035;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/></svg>");
    background-size: 160px 160px;
    mix-blend-mode: overlay;
}

html:not(.dark-mode), body:not(.dark-mode) { 
    background: #fff url('/static/grey1.jpg') no-repeat center center fixed !important;
    background-size: cover !important; 
}

.container{width:95%; max-width:1400px; margin:15px auto; display: flex; flex-direction: column; align-items: center; overflow-x: hidden;}

.card{
    background: linear-gradient(180deg, color-mix(in srgb, var(--card-bg) 92%, var(--c-base) 8%) 0%, var(--card-bg) 100%);
    border: var(--card-border-width) var(--card-border-style) var(--border);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    width: 100%; 
    max-width: 100%; 
    min-width: 0; 
    box-sizing: border-box; 
    backdrop-filter: blur(12px) saturate(1.2); 
    position: relative; 
    z-index: 10; 
    overflow-x: hidden;
}

header { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; margin-bottom: 15px; position: relative; width: 100%; max-width: 800px; z-index: 100;}
.auth-nav { position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 8px; width: 100%; margin-bottom: 10px; z-index: 100;}

.auth-link, #themeToggleBtn { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    box-sizing: border-box; 
    height: 26px; 
    line-height: 1;
    color: var(--c-base); 
    text-decoration: none; 
    font-size: 0.8rem; 
    border: 1px solid var(--glow-base); 
    padding: 0 10px; 
    margin: 0;
    border-radius: 4px; 
    background: rgba(0,0,0,0.4); 
    font-family: 'Rajdhani', sans-serif; 
    font-weight: 800; 
    cursor: pointer;
    white-space: nowrap;
}
.auth-link:hover { color: #fff; box-shadow: 0 0 8px var(--glow-base); }

.hero-title { 
    font-family: 'Orbitron', sans-serif; 
    font-size: 3.2rem; 
    letter-spacing: 6px; 
    margin: 0;
    background: linear-gradient(180deg, #fff 20%, var(--c-base) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 15px var(--c-base)) drop-shadow(0 0 30px color-mix(in srgb, var(--c-base) 40%, transparent));
}
.hero-subtitle { 
    color: var(--c-std); 
    font-family: 'Orbitron', sans-serif; 
    font-size: 0.85rem; 
    font-weight: 800; 
    letter-spacing: 8px; 
    margin: 0; 
    text-transform: uppercase; 
    text-shadow: 0 0 10px var(--c-std), 0 2px 4px rgba(0,0,0,0.8); 
    display: inline-block; 
    border-bottom: 1px solid rgba(0,210,255,0.3); 
    padding-bottom: 8px;
}

.tool-tabs { display: flex; justify-content: center; gap: 10px; margin-bottom: 10px; width: 100%; max-width: 800px; }
.tool-tab { 
    background: linear-gradient(180deg, #151515 0%, #0a0a0a 100%); 
    border: 1px solid #333; 
    color: #888; 
    padding: 12px 10px; 
    font-family: 'Orbitron', sans-serif; 
    font-weight: bold; 
    font-size: 0.85rem; 
    cursor: pointer; 
    border-radius: 6px; 
    transition: all 0.25s ease; 
    flex: 1; 
    text-align: center; 
    max-width: 250px; 
    letter-spacing: 1px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.03);
}
.tool-tab.active { 
    border-color: var(--c-std); 
    color: var(--c-std); 
    box-shadow: 0 0 20px color-mix(in srgb, var(--c-std) 30%, transparent), inset 0 0 10px color-mix(in srgb, var(--c-std) 15%, transparent); 
    background: linear-gradient(180deg, #0a0a0a 0%, #000 100%);
    animation: subtleGlow 4s ease-in-out infinite;
}
.tool-tab:hover:not(.active) { border-color: #555; color: #fff; transform: translateY(-1px); }

.tab-content { display: none; width: 100%; flex-direction: column; align-items: center; }
.tab-content.active { display: flex; }

.main-flex { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 100%; }

.sticky-container { 
    background: linear-gradient(180deg, rgba(18,18,18,0.96) 0%, rgba(8,8,8,0.98) 100%); 
    border: 1px solid var(--border); 
    padding: 20px; 
    border-radius: 12px; 
    width: 100%; 
    max-width: 800px; 
    box-shadow: 0 8px 32px rgba(0,0,0,0.9), inset 0 1px 0 rgba(255,255,255,0.04); 
    margin-bottom: 20px; 
    position: sticky; 
    top: 10px; 
    z-index: 900; 
    backdrop-filter: blur(16px) saturate(1.3);
}

.configure-btn { display: block; width: 100%; text-align: center; margin-bottom: 8px; margin-top: 0; padding: 4px; min-height: 24px; line-height: 1; border: 1px dashed var(--c-std); border-radius: 6px; color: var(--c-std); font-family: 'Orbitron', sans-serif; font-size: 0.75rem; letter-spacing: 2px; cursor: pointer; background: transparent; transition: 0.2s; font-weight: bold;}
.configure-btn:hover { background: rgba(0, 210, 255, 0.1); box-shadow: 0 0 10px rgba(0, 210, 255, 0.3); color: #fff;}

.calc-input {
    background: linear-gradient(180deg, #000 0%, #050505 100%);
    border: 2px solid var(--c-base);
    color: #fff;
    padding: 15px 40px 15px 15px; 
    border-radius: 8px;
    outline: none;
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 2px;
    text-transform: uppercase;
    box-shadow: var(--input-glow), inset 0 2px 6px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
    caret-color: var(--c-base);
}
.calc-input:focus { 
    box-shadow: 0 0 20px var(--glow-base), 0 0 40px color-mix(in srgb, var(--glow-base) 50%, transparent), inset 0 0 12px var(--glow-base), inset 0 2px 6px rgba(0,0,0,0.5); 
}
.calc-input::placeholder { color: #444; font-family: 'Rajdhani', sans-serif; letter-spacing: 4px; font-weight: 800; text-transform: uppercase; }

#cipher-modal-area { display: none; flex-direction: column; align-items: center; margin-top: 15px; border-top: 1px solid #222; padding-top: 15px; width: 100%; }

input[type="text"]:not(#p), input[type="date"], input[type="search"], input[type="number"] { font-size: 16px; box-sizing: border-box; max-width: 100%; }
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none !important; margin: 0 !important; }
input[type="number"] { -moz-appearance: textfield !important; }

select { background: #000; border: 1px solid #333; color: var(--c-base); padding: 10px 12px; border-radius: 4px; outline: none; font-family: 'Rajdhani', sans-serif; font-weight: bold; width: 100%; margin-bottom: 10px; font-size: 16px; box-sizing: border-box; cursor: pointer; max-width: 100%; }
select option { background: #111; color: #fff; font-weight: bold; }

/* CUSTOM DROPDOWN - hides native <select> visually but keeps it in DOM for
   accessibility and existing JS reads. The visible button + menu mirror its state. */
.custom-dropdown {
    position: relative;
    width: 100%;
    margin-bottom: 8px;
}
.custom-dropdown select {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
    clip: rect(0 0 0 0);
}
.custom-dropdown-trigger {
    width: 100% !important;
    background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(8,8,8,0.95) 100%) !important;
    border: 1px solid color-mix(in srgb, var(--c-base) 35%, #2a2a2a) !important;
    color: var(--c-base) !important;
    padding: 10px 14px !important;
    border-radius: 5px !important;
    font-family: 'Orbitron', sans-serif !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    letter-spacing: 1px !important;
    cursor: pointer !important;
    text-align: left !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    transition: border-color 0.18s ease, box-shadow 0.18s ease !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 2px 6px rgba(0,0,0,0.4) !important;
    min-height: 42px !important;
}
.custom-dropdown-trigger:hover {
    border-color: var(--c-base) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 2px 10px color-mix(in srgb, var(--c-base) 25%, transparent) !important;
}
.custom-dropdown-label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.custom-dropdown-caret {
    flex: 0 0 auto;
    font-size: 0.85rem;
    opacity: 0.7;
    transition: transform 0.2s ease;
    line-height: 1;
}
.custom-dropdown.open .custom-dropdown-caret {
    transform: rotate(180deg);
}
.custom-dropdown.open .custom-dropdown-trigger {
    border-color: var(--c-base) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 0 12px color-mix(in srgb, var(--c-base) 40%, transparent) !important;
}
.custom-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(10,10,10,0.98) 0%, rgba(0,0,0,0.98) 100%);
    border: 1px solid color-mix(in srgb, var(--c-base) 35%, #2a2a2a);
    border-radius: 5px;
    margin: 0;
    padding: 4px;
    list-style: none;
    max-height: 320px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.7), 0 0 18px color-mix(in srgb, var(--c-base) 20%, transparent), inset 0 1px 0 rgba(255,255,255,0.04);
    display: none;
    backdrop-filter: blur(8px);
}
.custom-dropdown.open .custom-dropdown-menu {
    display: block;
    animation: customDropdownIn 0.15s ease-out;
}
@keyframes customDropdownIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.custom-dropdown-item {
    padding: 10px 12px;
    color: #ddd;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.12s ease, color 0.12s ease, padding-left 0.15s ease;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.custom-dropdown-item:hover {
    background: color-mix(in srgb, var(--c-base) 15%, transparent);
    color: var(--c-base);
    padding-left: 16px;
}
.custom-dropdown-item.selected {
    background: color-mix(in srgb, var(--c-base) 22%, transparent);
    color: var(--c-base);
    font-weight: 700;
}
.custom-dropdown-menu::-webkit-scrollbar { width: 6px; }
.custom-dropdown-menu::-webkit-scrollbar-track { background: transparent; }
.custom-dropdown-menu::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--c-base) 40%, #222);
    border-radius: 3px;
}

button{
    background: linear-gradient(180deg, var(--c-base) 0%, color-mix(in srgb, var(--c-base) 80%, #000) 100%);
    color: #000;
    border: none;
    padding: 10px;
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 800;
    letter-spacing: 1.5px;
    border-radius: 4px;
    font-size: 0.85rem;
    text-transform: uppercase;
    transition: all 0.2s ease;
    min-height: 40px;
    max-width: 100%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}
button:hover{
    background: linear-gradient(180deg, #fff 0%, #ddd 100%); 
    transform: translateY(-2px); 
    box-shadow: 0 0 15px var(--c-base), 0 6px 20px rgba(0,0,0,0.4); 
}
button:active{
    transform: translateY(0) scale(0.98);
    box-shadow: 0 0 8px var(--c-base), 0 2px 6px rgba(0,0,0,0.3);
    transition: transform 0.05s ease;
}

.exc-btn { background: var(--c-exc) !important; color: #000 !important; padding: 10px 18px; border: none; border-radius: 4px; font-size: 0.9rem;}
.exc-btn:hover { background: #fff !important; color: #000 !important; box-shadow: 0 0 10px var(--c-exc); }

.hollow-btn { 
    background: linear-gradient(180deg, rgba(20,20,20,0.9) 0%, rgba(5,5,5,0.95) 100%); 
    padding: 8px 15px; 
    border-radius: 4px; 
    font-family: 'Rajdhani', sans-serif; 
    font-size: 0.8rem; 
    font-weight: bold; 
    letter-spacing: 1px; 
    cursor: pointer; 
    text-transform: uppercase; 
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
}
.hollow-btn:active {
    transform: translateY(0) scale(0.97);
    transition: transform 0.05s ease;
}
.btn-cyan { 
    border: 1px solid var(--c-std); 
    color: var(--c-std); 
}
.btn-cyan:hover { 
    background: linear-gradient(180deg, rgba(0, 210, 255, 0.15) 0%, rgba(0, 150, 200, 0.1) 100%); 
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.4), 0 4px 12px rgba(0,0,0,0.4); 
    transform: translateY(-1px);
    border-color: var(--c-std);
}
.btn-green { 
    border: 1px solid var(--c-base); 
    color: var(--c-base); 
}
.btn-green:hover { 
    background: linear-gradient(180deg, rgba(0, 255, 65, 0.15) 0%, rgba(0, 200, 50, 0.1) 100%); 
    box-shadow: 0 0 12px var(--glow-base), 0 4px 12px rgba(0,0,0,0.4); 
    transform: translateY(-1px);
    border-color: var(--c-base);
}
.btn-purple { 
    border: 1px solid var(--c-forge); 
    color: var(--c-forge); 
}
.btn-purple:hover { 
    background: linear-gradient(180deg, rgba(184, 0, 255, 0.15) 0%, rgba(140, 0, 200, 0.1) 100%); 
    box-shadow: 0 0 12px rgba(184, 0, 255, 0.4), 0 4px 12px rgba(0,0,0,0.4); 
    transform: translateY(-1px);
    border-color: var(--c-forge);
}
.btn-yellow { 
    border: 1px solid var(--c-exc); 
    color: var(--c-exc); 
}
.btn-yellow:hover { 
    background: linear-gradient(180deg, rgba(255, 170, 0, 0.15) 0%, rgba(200, 130, 0, 0.1) 100%); 
    box-shadow: 0 0 12px rgba(255, 170, 0, 0.4), 0 4px 12px rgba(0,0,0,0.4); 
    transform: translateY(-1px);
    border-color: var(--c-exc);
}

.calc-grid{display:grid; grid-template-columns: repeat(auto-fit, minmax(85px, 1fr)); gap:3px; width: 100%; max-width: 100%; margin-bottom: 10px;}

#wb { margin-bottom: 12px; }

.calc-grid:empty, #wb:empty { display: none !important; margin-bottom: 0 !important; }

.cipher-box{
    border: 1px solid #222;
    background: linear-gradient(180deg, rgba(30,30,30,0.95) 0%, rgba(8,8,8,0.95) 100%);
    padding: 8px 4px 6px;
    text-align: center;
    border-radius: 4px;
    cursor: pointer; 
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 2px 6px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 58px;
}
.cipher-box:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 4px 12px rgba(0,0,0,0.6), 0 0 10px currentColor;
    border-color: currentColor;
}
/* Cipher name label (top) */
.cipher-box small{
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.6rem; 
    font-weight: 700; 
    display: block; 
    line-height: 1.15;
    opacity: 0.9;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: auto;
    min-height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Cipher value number (bottom) */
.cipher-box strong{
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.5rem; 
    font-weight: 700; 
    display: block; 
    text-shadow: 0 0 12px currentColor, 0 2px 4px rgba(0,0,0,0.8); 
    letter-spacing: 2px;
    line-height: 1;
}

#filter-box { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.cipher-group-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 8px; width: 100%; }

.filter-lbl {
    font-size: 0.75rem; 
    font-weight: 800; 
    display: inline-flex; 
    align-items: center; 
    justify-content: center;
    cursor: pointer; 
    padding: 4px 10px; 
    border-radius: 4px; 
    background: rgba(10, 10, 10, 0.5); 
    border: 1px solid rgba(255,255,255,0.08); 
    opacity: 0.4; 
    white-space: nowrap; 
    touch-action: manipulation;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    user-select: none;
}
.filter-lbl:hover { opacity: 0.8; transform: translateY(-1px); }
.filter-lbl.active-cipher {
    opacity: 1; 
    border-color: currentColor; 
    background: linear-gradient(180deg, rgba(25,25,25,0.9) 0%, rgba(0,0,0,1) 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 0 8px currentColor;
    animation: subtleGlow 4s ease-in-out infinite;
}

.word-pill { background: rgba(0,0,0,0.9); border: 1px solid var(--c-base); padding: 10px 8px; border-radius: 8px; text-align: center; width: 100%; max-width: 100%; box-sizing: border-box; overflow-wrap: break-word; overflow: hidden;}
.cipher-header { 
    font-size: 1.2rem; 
    letter-spacing: 2px; 
    margin-bottom: 8px; 
    text-transform: uppercase; 
    font-weight: 900; 
    color: var(--c-base); 
    font-family: 'Orbitron', sans-serif; 
    text-shadow: 0 0 10px var(--glow-base), 0 0 20px color-mix(in srgb, var(--glow-base) 50%, transparent), 0 2px 4px rgba(0,0,0,0.8);
}

.gematrinator-word { 
    display: flex !important; 
    flex-wrap: nowrap !important; 
    justify-content: flex-start !important; 
    width: max-content !important;
    max-width: 100% !important;
    margin: 4px auto !important; 
    border: 1px solid #333; 
    background: #111; 
    border-radius: 6px; 
    overflow-x: auto; 
    box-shadow: 0 4px 8px rgba(0,0,0,0.5); 
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(to right, transparent 0%, black 2%, black 98%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 2%, black 98%, transparent 100%);
}
.gematrinator-word::-webkit-scrollbar { height: 3px; }
.gematrinator-word::-webkit-scrollbar-thumb { background: var(--c-base); border-radius: 3px; }

.g-char-col { display: flex !important; flex-direction: column; align-items: center; border-right: 1px solid #333; flex: 0 0 auto !important; } 
.g-char-col:last-child { border-right: none; }

.g-char-top { padding: 4px 6px; font-size: 1.35rem; font-family: Arial, Helvetica, sans-serif; font-weight: bold; text-align: center; border-bottom: 1px solid #333; background: #111; color: #fff; line-height: 1.2;}
.g-char-bot { padding: 2px 4px; font-size: 0.75rem; font-family: 'Orbitron', sans-serif; font-weight: bold; text-align: center; line-height: 1.2;}

.alpha-key-container { display:flex; flex-wrap:wrap; justify-content:center; gap:2px; margin-top:10px; padding-top:8px; border-top:1px solid rgba(255,255,255,0.05); }
.alpha-key-box { display:flex; flex-direction:column; align-items:center; background:rgba(0,0,0,0.6); border:1px solid #333; border-radius:3px; min-width:20px; box-shadow:0 2px 4px rgba(0,0,0,0.5); }
.alpha-key-char { background:#111; color:#aaa; width:100%; font-size:0.6rem; font-weight:900; padding:2px 0; border-bottom:1px solid #333; }
.alpha-key-val { width:100%; font-size:0.75rem; font-weight:bold; padding:2px 0; }

.custom-table { width:100%; border-collapse:collapse; text-align:center; font-size: 0.85rem; }
.custom-table th { 
    background: linear-gradient(180deg, #151515 0%, #0a0a0a 100%); 
    color: var(--c-std); 
    padding: 10px 8px; 
    border: 1px solid #222; 
    text-transform: uppercase; 
    white-space: nowrap; 
    font-size: 0.75rem; 
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 0 8px color-mix(in srgb, var(--c-std) 40%, transparent);
}
.custom-table td { 
    padding: 8px 6px; 
    border: 1px solid rgba(255,255,255,0.06); 
    background: rgba(0,0,0,0.2); 
    white-space: nowrap; 
    transition: background 0.15s ease;
    font-weight: 600;
}
.custom-table tbody tr { transition: background 0.15s ease; }
.custom-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.custom-table tbody tr:hover td { background: rgba(var(--c-base), 0.05); border-color: rgba(255,255,255,0.1); }

/* First column (phrase) styling */
.custom-table td:first-child {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    text-align: left;
    padding-left: 12px;
}

/* ============================================================================
   COLLECTION CONTAINERS
   ============================================================================ */

/* Temp collection & collection builder shared header style */
.collection-header,
#tempTableContainer > div:first-child,
#matches > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: linear-gradient(180deg, rgba(20,20,20,0.95) 0%, rgba(10,10,10,0.98) 100%);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    gap: 10px;
    flex-wrap: wrap;
}

/* Header titles */
.collection-header h3,
#tempTableContainer h3,
#matches > div:first-child h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin: 0;
    padding: 0;
    border: none;
}

/* Collection table wrapper */
#tempTableContainer > div:last-child,
.collection-table-wrap {
    padding: 8px;
    background: rgba(0,0,0,0.3);
}

/* Collection builder section */
#tab-coll .card {
    padding: 0;
    overflow: hidden;
}
#tab-coll .card > div:first-child {
    padding: 12px 16px;
    margin: 0;
    background: linear-gradient(180deg, rgba(20,20,20,0.95) 0%, rgba(10,10,10,0.98) 100%);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* Collection builder content area */
#tab-coll .card > *:not(:first-child) {
    padding-left: 16px;
    padding-right: 16px;
}
#tab-coll .card > div:last-child {
    padding-bottom: 16px;
}

/* Collection action buttons row */
#tab-coll .mobile-wrap {
    margin-top: 10px;
}
#tab-coll .mobile-wrap:first-of-type {
    margin-top: 16px;
}

/* Collection builder action buttons */
#tab-coll .mobile-wrap button {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 10px 12px;
    min-height: 42px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
}
#tab-coll .mobile-wrap button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.15);
}
#tab-coll .mobile-wrap button:active {
    transform: translateY(0) scale(0.98);
}

/* NEW [+] button - green */
#tab-coll button[onclick*="showNewCollectionInput"] {
    background: linear-gradient(180deg, #00cc66 0%, #009944 100%);
    color: #000;
}
#tab-coll button[onclick*="showNewCollectionInput"]:hover {
    background: linear-gradient(180deg, #00dd77 0%, #00aa55 100%);
    box-shadow: 0 4px 15px rgba(0,204,102,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* EXPORT button - blue */
#tab-coll button[onclick*="export"] {
    background: linear-gradient(180deg, #0088ff 0%, #0066cc 100%);
    color: #fff;
}
#tab-coll button[onclick*="export"]:hover {
    background: linear-gradient(180deg, #0099ff 0%, #0077dd 100%);
    box-shadow: 0 4px 15px rgba(0,136,255,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* DELETE button - dark red */
#tab-coll button[onclick*="delete"] {
    background: linear-gradient(180deg, #662222 0%, #441111 100%);
    color: #ff6666;
    border: 1px solid #883333;
}
#tab-coll button[onclick*="delete"]:hover {
    background: linear-gradient(180deg, #772222 0%, #551515 100%);
    color: #ff8888;
    box-shadow: 0 4px 15px rgba(102,34,34,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
}

/* ADD ENTRY button - green accent */
#tab-coll button[onclick*="addManual"] {
    background: linear-gradient(180deg, #00aa55 0%, #008844 100%);
    color: #fff;
}
#tab-coll button[onclick*="addManual"]:hover {
    background: linear-gradient(180deg, #00bb66 0%, #009955 100%);
    box-shadow: 0 4px 15px rgba(0,170,85,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* Collection select dropdown */
#tableSelect,
#calcTableSelect {
    display: block;
    width: calc(100% - 32px);
    margin: 0 auto 8px auto;
    background: linear-gradient(180deg, #111 0%, #0a0a0a 100%);
    border: 1px solid #333;
    color: var(--c-std);
    padding: 10px 14px;
    border-radius: 6px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}
#tableSelect:hover,
#calcTableSelect:hover {
    border-color: var(--c-std);
    box-shadow: 0 0 10px color-mix(in srgb, var(--c-std) 30%, transparent);
}
#tableSelect:focus,
#calcTableSelect:focus {
    outline: none;
    border-color: var(--c-std);
}

/* ============================================================================
   CALCULATOR ACTION BUTTONS (BASE 4, TOGGLE ALL, HIDE CIPHERS)
   ============================================================================ */
#actionButtonsWrap .hollow-btn,
#cipher-modal-area .hollow-btn {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 8px 12px;
    min-height: 32px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.08);
    background: linear-gradient(180deg, rgba(25,25,25,0.95) 0%, rgba(10,10,10,0.98) 100%);
}
#actionButtonsWrap .hollow-btn:hover,
#cipher-modal-area .hollow-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
}
#actionButtonsWrap .hollow-btn:active,
#cipher-modal-area .hollow-btn:active {
    transform: translateY(0) scale(0.98);
}

/* btn-cyan style (BASE 4, etc.) */
#actionButtonsWrap .btn-cyan,
#cipher-modal-area .btn-cyan {
    border: 1px solid var(--c-std);
    color: var(--c-std);
}
#actionButtonsWrap .btn-cyan:hover,
#cipher-modal-area .btn-cyan:hover {
    background: linear-gradient(180deg, rgba(0, 210, 255, 0.15) 0%, rgba(0, 150, 200, 0.1) 100%);
    border-color: var(--c-std);
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

/* btn-purple style (TOGGLE ALL) */
#actionButtonsWrap .btn-purple,
#cipher-modal-area .btn-purple {
    border: 1px solid var(--c-forge);
    color: var(--c-forge);
}
#actionButtonsWrap .btn-purple:hover,
#cipher-modal-area .btn-purple:hover {
    background: linear-gradient(180deg, rgba(184, 0, 255, 0.15) 0%, rgba(140, 0, 200, 0.1) 100%);
    border-color: var(--c-forge);
    box-shadow: 0 4px 15px rgba(184, 0, 255, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

/* btn-green style (HIDE CIPHERS when active) */
#actionButtonsWrap .btn-green,
#cipher-modal-area .btn-green {
    border: 1px solid var(--c-base);
    color: var(--c-base);
}
#actionButtonsWrap .btn-green:hover,
#cipher-modal-area .btn-green:hover {
    background: linear-gradient(180deg, rgba(0, 255, 65, 0.15) 0%, rgba(0, 200, 50, 0.1) 100%);
    border-color: var(--c-base);
    box-shadow: 0 4px 15px rgba(0, 255, 65, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

/* Collection input fields */
#manualEntry,
#tableFilter {
    background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, rgba(5,5,5,0.95) 100%);
    border: 1px solid #333;
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#manualEntry:focus,
#tableFilter:focus {
    outline: none;
    border-color: var(--c-base);
    box-shadow: 0 0 12px var(--glow-base);
}
#manualEntry::placeholder,
#tableFilter::placeholder {
    color: #555;
    font-weight: 600;
}

/* Cipher filter area in collections */
#coll-cipher-area {
    background: linear-gradient(180deg, rgba(0,0,0,0.75) 0%, rgba(5,5,5,0.85) 100%);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 6px;
    padding: 5px 12px 10px 12px;
    margin: 10px 0 0 0;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 2px 8px rgba(0,0,0,0.4);
}
#coll-cipher-area .mobile-wrap {
    margin-bottom: 8px !important;
    gap: 6px !important;
}
#coll-cipher-area #coll-filter-box {
    gap: 4px;
}
#coll-cipher-area .cipher-group-row {
    gap: 4px 6px;
}

/* Clear/delete buttons in headers */
#tempTableContainer span[onclick*="clear"],
.collection-clear-btn {
    color: #ff4444;
    font-weight: 900;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s ease;
    background: rgba(255,68,68,0.1);
    border: 1px solid rgba(255,68,68,0.2);
}
#tempTableContainer span[onclick*="clear"]:hover,
.collection-clear-btn:hover {
    color: #fff;
    background: rgba(255,68,68,0.2);
    border-color: #ff4444;
    box-shadow: 0 0 10px rgba(255,68,68,0.3);
}

.blur-val { 
    filter: blur(6px); 
    opacity: 0.4; 
    user-select: none; 
}

.del-btn { color: #ff3131; cursor: pointer; font-weight: 900; font-size: 1.1rem; padding: 0 5px; transition: 0.2s; touch-action: manipulation;}
.del-btn:hover { color: #fff; text-shadow: 0 0 8px #ff3131; }

/* TEMP button on match rows - hidden unless a temp collection is active */
.match-temp-btn { display: none !important; }
body.temp-active .match-temp-btn { display: inline-block !important; }
.match-temp-btn:hover { background: rgba(255, 170, 0, 0.1); border-color: var(--c-exc, #ffaa00) !important; box-shadow: 0 2px 8px rgba(255, 170, 0, 0.3); }

/* Position-jump input on collection rows (temp + saved) */
.pos-jump {
    width: 34px;
    height: 22px;
    background: rgba(0, 0, 0, 0.75);
    color: var(--c-std);
    border: 1px solid #333;
    border-radius: 3px;
    padding: 1px 3px;
    margin: 0 2px 0 4px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    outline: none;
    vertical-align: middle;
    -moz-appearance: textfield;
}
.pos-jump:focus {
    border-color: var(--c-std);
    box-shadow: 0 0 6px rgba(0, 210, 255, 0.4);
    color: #fff;
}
.pos-jump::-webkit-outer-spin-button,
.pos-jump::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Eye toggle that hides/shows the pos-jump inputs */
.pos-jump-toggle {
    display: inline-block;
    cursor: pointer;
    margin-left: 4px;
    font-size: 0.85rem;
    opacity: 0.6;
    transition: opacity 0.15s ease, transform 0.15s ease;
    user-select: none;
    vertical-align: middle;
    line-height: 1;
}
.pos-jump-toggle:hover {
    opacity: 1;
    transform: scale(1.15);
}

/* When hidden, collapse the pos-jump input so row spacing tightens */
body.pos-jump-hidden .pos-jump {
    display: none !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

/* Saved Time Calculator entry hover polish */
.timecalc-entry:hover {
    border-color: color-mix(in srgb, var(--c-base) 50%, #2a2a2a) !important;
    box-shadow: 0 0 8px color-mix(in srgb, var(--c-base) 18%, transparent);
}

/* Let the ACT column shrink back to its natural width (no forced min-width
   from the now-hidden input) */
body.pos-jump-hidden #tempTableHead th:first-child,
body.pos-jump-hidden #tableHead th:first-child,
body.pos-jump-hidden #tempTableContainer table tbody td:first-child,
body.pos-jump-hidden #tableBody td:first-child {
    white-space: nowrap;
    width: 1%;
}

#ct {
    display: none; position: fixed; background: var(--c-tooltip-bg); border: 1px solid #333; 
    color: #fff; padding: 12px; border-radius: 6px; z-index: 9999; font-family: 'Rajdhani', sans-serif; 
    font-size: 0.9rem; pointer-events: none; white-space: nowrap; box-shadow: 0 0 15px rgba(0,255,65,0.3);
    backdrop-filter: blur(5px);
}

.hide-defs .def-text { display: none !important; }

/* ============================================================================
   MATCH ROW - DATABASE RESULTS
   ============================================================================ */
.match-row { 
    display: flex; 
    flex-direction: row; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid rgba(255,255,255,0.06); 
    padding: 12px 8px; 
    transition: background 0.15s ease;
    margin: 0;
}
.match-row:hover {
    background: rgba(255,255,255,0.02);
}
.match-row:last-child {
    border-bottom: none;
}

/* Phrase name - the main emphasis */
.match-phrase-wrap { 
    display: flex; 
    align-items: baseline; 
    flex: 1; 
    flex-wrap: wrap; 
    gap: 6px 10px; 
}
.match-phrase-wrap > span:first-child,
.match-phrase-wrap > strong:first-child {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Category tag (PLACE for guests) - subtle inline badge */
.match-phrase-wrap .cat-tag,
.match-phrase-wrap > span:nth-child(2):not(.def-text) {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #555;
    padding: 1px 5px;
    background: transparent;
    border-radius: 2px;
    border: 1px solid #333;
    vertical-align: middle;
    margin-left: 2px;
}

/* Definition text */
.def-text {
    font-size: 0.8rem;
    font-style: italic;
    color: #888;
    margin-left: 4px;
}

.phrase-def-container { 
    display: flex; 
    align-items: baseline; 
    flex-wrap: wrap; 
    gap: 6px;
}

/* Admin action buttons row */
.admin-controls-wrap { 
    display: inline-flex; 
    gap: 6px; 
    align-items: center; 
    margin: 6px 0 4px 0;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.04);
    width: 100%;
}
.admin-controls-wrap span {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
}
.admin-controls-wrap span:hover {
    transform: translateY(-1px);
}
/* EDIT button */
.admin-controls-wrap span:nth-child(1) {
    color: #aaa;
    border-color: #444;
}
.admin-controls-wrap span:nth-child(1):hover {
    color: #fff;
    border-color: #666;
    box-shadow: 0 2px 8px rgba(255,255,255,0.1);
}
/* DEL button */
.admin-controls-wrap span:nth-child(2) {
    color: #ff4444;
    border-color: rgba(255,68,68,0.3);
}
.admin-controls-wrap span:nth-child(2):hover {
    background: rgba(255,68,68,0.1);
    border-color: #ff4444;
    box-shadow: 0 2px 8px rgba(255,68,68,0.3);
}
/* SAVE button */
.admin-controls-wrap span:nth-child(3) {
    color: var(--c-std);
    border-color: rgba(0,210,255,0.3);
}
.admin-controls-wrap span:nth-child(3):hover {
    background: rgba(0,210,255,0.1);
    border-color: var(--c-std);
    box-shadow: 0 2px 8px rgba(0,210,255,0.3);
}
/* PLACE button - very subtle */
.admin-controls-wrap span:nth-child(4) {
    color: #555;
    border-color: #2a2a2a;
    font-size: 0.65rem;
    padding: 3px 8px;
    opacity: 0.7;
}
.admin-controls-wrap span:nth-child(4):hover {
    color: #888;
    border-color: #444;
    opacity: 1;
}

/* Cipher values display */
.match-ciphers-wrap { 
    display: flex; 
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 3px 10px; 
    flex: 0 0 auto;
    margin-left: 12px;
    font-family: 'Rajdhani', sans-serif;
}
.match-ciphers-wrap span {
    font-size: 0.8rem;
    font-weight: 600;
}
/* Cipher label */
.match-ciphers-wrap .cipher-label,
.match-ciphers-wrap span:nth-child(odd) {
    color: #555;
    font-size: 0.65rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
/* Cipher value - inherits color from inline style */
.match-ciphers-wrap span:nth-child(even) {
    font-weight: 800;
    font-size: 0.95rem;
    text-shadow: 0 0 8px currentColor;
}

#toast-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: #111;
    border: 1px solid #333;
    border-left: 4px solid var(--c-math);
    color: #fff;
    padding: 12px 20px;
    border-radius: 4px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.95rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 250px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.8);
    animation: slideIn 0.3s ease-out forwards;
    transition: opacity 0.3s ease;
}
@keyframes slideIn {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.toast-undo-btn {
    color: var(--c-std);
    cursor: pointer;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: 0.2s;
    padding: 4px 8px;
    background: rgba(0, 210, 255, 0.1);
    border-radius: 4px;
    border: 1px solid rgba(0, 210, 255, 0.3);
}
.toast-undo-btn:hover {
    background: var(--c-std);
    color: #000;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
}

@media (max-width: 768px) {
    header { display: flex; flex-direction: column; align-items: center; margin-bottom: 10px; width: 100%; }
    
    .auth-nav { position: relative; top: auto; right: auto; margin-bottom: 12px; justify-content: center; width: 100%; flex-wrap: wrap; gap: 6px; padding: 0 5px; align-items: center;}
    .auth-link { font-size: clamp(0.55rem, 2.5vw, 0.7rem); padding: 0 8px; letter-spacing: 0px; height: 26px; }
    
    .hero-title { font-size: 7vw; letter-spacing: 2px; white-space: nowrap; width: 100%; text-align: center; }
    .hero-subtitle { font-size: 0.6rem; letter-spacing: 4px; }
    
    .tool-tabs { gap: 4px; padding: 0 5px; }
    .tool-tab { padding: 8px 4px; font-size: 0.7rem; }
    
    .sticky-container { padding: 12px 10px; margin-bottom: 10px; border-radius: 8px;}
    
    .configure-btn { padding: 2px; font-size: 0.65rem; margin-bottom: 6px; margin-top: 0; min-height: 20px;}

    .calc-input { font-size: 1.3rem; padding: 12px 35px 12px 10px; }
    
    .mobile-wrap { flex-wrap: wrap !important; gap: 6px !important; justify-content: center; min-width: 0 !important; width: 100% !important; }
    .mobile-wrap > * { width: 100% !important; max-width: 100% !important; }
    #ct { font-size: 0.75rem; padding: 8px; max-width: 95vw; white-space: normal; word-break: break-word; }
    
    #actionButtonsWrap { margin-bottom: 10px !important; gap: 4px !important; flex-wrap: nowrap !important; }
    .hollow-btn { padding: 6px 2px; font-size: clamp(0.5rem, 2.2vw, 0.65rem); flex: 1; letter-spacing: 0; border-width: 1px;}

    .calc-grid { grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap:2px; }
    .cipher-box { padding: 6px 2px 4px; min-height: 52px; }
    .cipher-box strong { font-size: 1.25rem; letter-spacing: 1px; }
    .cipher-box small { font-size: 0.5rem; letter-spacing: 0; min-height: 20px; }
    
    #filter-box { gap: 5px !important; width: 100%; }
    .cipher-group-row { gap: 4px; width: 100%; justify-content: center; }
    
    #filter-box .cipher-group-row:first-child { 
        flex-wrap: nowrap; 
        justify-content: space-between; 
    }
    #filter-box .cipher-group-row:first-child .filter-lbl {
        flex: 1; 
        padding: 4px 0; 
        font-size: clamp(0.45rem, 2.3vw, 0.65rem); 
        letter-spacing: -0.2px; 
        border-radius: 3px;
        text-align: center;
    }
    
    .filter-lbl { 
        padding: 3px 5px; 
        font-size: 0.55rem; 
        letter-spacing: 0; 
        border-width: 1px; 
        border-radius: 3px; 
    }
    
    .word-pill { padding: 8px 5px; }
    .cipher-header { font-size: 1rem; margin-bottom: 6px; }
    
    .g-char-top { padding: 2px 4px; font-size: 1.15rem; font-family: Arial, Helvetica, sans-serif; font-weight: bold; line-height: 1.1; }
    .g-char-bot { padding: 1px 3px; font-size: 0.65rem; font-family: 'Orbitron', sans-serif; line-height: 1.1; }
    
    .alpha-key-container { gap: 2px; margin-top: 8px; padding-top: 6px; }
    .alpha-key-box { min-width: 18px; padding: 1px;} 
    .alpha-key-char { font-size: 0.5rem; padding: 1px 0; }
    .alpha-key-val { font-size: 0.6rem; padding: 1px 0; }

    .match-row { flex-direction: column; align-items: flex-start; padding: 10px 6px; gap: 4px; }
    .match-phrase-wrap { width: 100%; }
    .match-phrase-wrap > span:first-child,
    .match-phrase-wrap > strong:first-child { font-size: 1.05rem; }
    
    .match-ciphers-wrap { margin-left: 0; margin-top: 4px; width: 100%; justify-content: flex-start; gap: 3px 8px; }
    .match-ciphers-wrap span:nth-child(even) { font-size: 0.85rem; }
    
    .admin-controls-wrap { margin: 6px 0 0 0; padding-top: 6px; gap: 4px; }
    .admin-controls-wrap span { font-size: 0.65rem; padding: 3px 8px; }

    #toast-container { left: 5%; width: 90%; bottom: 15px; }
    .toast { width: 100%; }
}