@import url('https://fonts.googleapis.com/css2?family=Syncopate:wght@400;700&family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
    --bg: #030303;
    --fg: #ffffff;
    --fg-muted: #666666;
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.2);
    --glass: rgba(5, 5, 5, 0.6);
    --glass-solid: rgba(12, 12, 12, 0.95);
    --glow: rgba(255, 255, 255, 0.12);

    /* Animation Timing */
    --ease-spring: cubic-bezier(0.4, 0, 0.1, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg);
    color: var(--fg);
    font-family: 'Space Grotesk', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Base Utility for Liquid Glass / Glow */
.interactable,
.interactable-island {
    position: relative;
    overflow: hidden;
}

.interactable::before,
.interactable-island::before {
    content: '';
    position: absolute;
    top: var(--y, 0px);
    left: var(--x, 0px);
    transform: translate(-50%, -50%);
    background: radial-gradient(circle closest-side, var(--glow), transparent);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 0;
}

.interactable::before {
    width: 600px;
    height: 600px;
}

.interactable-island::before {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle closest-side, rgba(255, 255, 255, 0.2), transparent);
}

.interactable:hover::before,
.interactable-island:hover::before {
    opacity: 1;
}

/* --- SUPERIOR DYNAMIC ISLAND --- */
.dynamic-island-wrapper {
    position: fixed;
    top: 32px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 1000;
    perspective: 1000px;
}

.dynamic-island {
    background: #000;
    border: 1px solid var(--border);
    height: 44px;
    min-width: 220px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.9),
        inset 0 1px 1px rgba(255, 255, 255, 0.1),
        0 0 0 1px rgba(0, 0, 0, 1);
    transition: width 0.6s var(--ease-spring),
        height 0.6s var(--ease-spring),
        border-radius 0.6s var(--ease-spring),
        border-color 0.3s var(--ease-spring);
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    transform-origin: top;
    will-change: width, height;
}

/* Hardware accelerated mask for pure black inner edge */
.dynamic-island::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: #000;
    z-index: 1;
    pointer-events: none;
}

.island-content {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2;
    /* Above the black mask, below interactions */
    width: max-content;
    pointer-events: none;
    /* Let island catch clicks */
}

/* Specific inner interaction elements */
.island-content * {
    pointer-events: auto;
}

.icon-small {
    width: 14px;
    height: 14px;
    color: var(--fg);
}

/* Status Ring Animation */
.status-ring {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.status-ring::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 1px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.8);
    animation: spin 2s linear infinite;
}

.ring-core {
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px #fff;
}

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

/* Dynamic Island State Logic via Layout */
.island-content.state-default,
.island-content.state-hover,
.island-content.state-expanded,
.island-content.state-success {
    opacity: 0;
    transform: scale(0.95) translateY(5px);
    transition: opacity 0.3s var(--ease-spring), transform 0.4s var(--ease-bounce);
    visibility: hidden;
}

/* State: Default */
.dynamic-island:not(:hover):not(.expanded):not(.success) .state-default {
    opacity: 1;
    transform: scale(1) translateY(0);
    visibility: visible;
    transition-delay: 0.1s;
}

/* State: Hover */
.dynamic-island:hover:not(.expanded):not(.success) {
    min-width: 240px;
    height: 48px;
    border-radius: 24px;
    border-color: var(--border-hover);
}

.dynamic-island:hover:not(.expanded):not(.success) .state-hover {
    opacity: 1;
    transform: scale(1) translateY(0);
    visibility: visible;
    transition-delay: 0.1s;
}

/* State: Expanded (Showing Auth Code) */
.dynamic-island.expanded {
    min-width: 320px;
    height: 80px;
    border-radius: 28px;
    border-color: var(--border-hover);
    background: var(--glass-solid);
    cursor: default;
}

.dynamic-island.expanded::after {
    background: var(--glass-solid);
    /* Match expanded background */
}

.dynamic-island.expanded .state-expanded {
    opacity: 1;
    transform: scale(1) translateY(0);
    visibility: visible;
    transition-delay: 0.2s;
    /* Give pill time to grow */
    width: 100%;
    padding: 0 24px;
    justify-content: space-between;
}

.hash-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.hash-label {
    font-size: 0.6rem;
    color: var(--fg-muted);
}

#vhash {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--fg);
    letter-spacing: 0.15em;
    user-select: all;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

/* State: Success (Copied) */
.dynamic-island.success {
    min-width: 200px;
    height: 48px;
    border-radius: 24px;
    background: #fff;
    color: #000;
    border-color: #fff;
}

.dynamic-island.success::after {
    background: #fff;
}

/* White fill mask */

.dynamic-island.success .icon-small {
    color: #000;
}

.dynamic-island.success .state-success {
    opacity: 1;
    transform: scale(1) translateY(0);
    visibility: visible;
    transition-delay: 0.1s;
    color: #000;
}


/* --- Background Systems --- */
.bg-elements {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: radial-gradient(circle at 50% 100%, #111 0%, #000 70%);
}

.grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    transform: perspective(600px) rotateX(70deg) translateY(-50px) translateZ(-250px);
    animation: gridFlow 20s linear infinite;
    transform-origin: top;
    opacity: 0.7;
}

@keyframes gridFlow {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 60px;
    }
}

.noise {
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.06;
    mix-blend-mode: overlay;
    z-index: 1;
}

.center-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0%, transparent 60%);
    pointer-events: none;
}

/* Refined liquid blobs for subtle darkness */
.liquid-shape {
    position: absolute;
    filter: blur(120px);
    background: #ffffff;
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    animation: drift 25s infinite alternate ease-in-out;
    mix-blend-mode: screen;
}

.shape-1 {
    width: 50vw;
    height: 50vw;
    top: -20%;
    left: -10%;
    opacity: 0.03;
}

.shape-2 {
    width: 40vw;
    height: 40vw;
    bottom: -10%;
    right: -10%;
    animation-delay: -10s;
    opacity: 0.02;
    background: #aaaaaa;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) rotate(0deg);
        border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    }

    50% {
        transform: translate(5%, 5%) rotate(180deg);
        border-radius: 70% 30% 50% 50% / 30% 30% 70% 70%;
    }

    100% {
        transform: translate(-5%, 10%) rotate(360deg);
        border-radius: 100% 60% 60% 100% / 100% 100% 60% 60%;
    }
}

/* --- Main Module --- */
.container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 640px;
    padding: 20px;
    perspective: 1500px;
    margin-top: 40px;
}

.glass-module {
    background: var(--glass);
    border: 1px solid var(--border);
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    border-radius: 20px;
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.9),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 0 20px rgba(255, 255, 255, 0.02);
    transform-style: preserve-3d;
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
    border-radius: 20px 20px 0 0;
    position: relative;
    z-index: 1;
}

.controls {
    display: flex;
    gap: 8px;
}

.controls .btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.controls .close {
    background: #333;
}

.controls .minimize {
    background: #222;
}

.controls .maximize {
    background: #111;
}

.version {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--fg-muted);
}

.content-wrapper {
    padding: 60px 40px;
    text-align: center;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.status-badge-large {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: 'Syncopate', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--fg-muted);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: 100px;
    margin-bottom: 30px;
}

.indicator.slow {
    width: 6px;
    height: 6px;
    background: #666;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.2);
    animation: slowPulse 3s infinite;
}

@keyframes slowPulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.2);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(255, 255, 255, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

.logo-text {
    font-family: 'Syncopate', sans-serif;
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    margin-bottom: 15px;
    color: var(--fg);
    text-transform: uppercase;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
}

.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #fff;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 #444;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(12px, 9999px, 59px, 0);
    }

    5% {
        clip: rect(65px, 9999px, 83px, 0);
    }

    10% {
        clip: rect(46px, 9999px, 33px, 0);
    }

    15% {
        clip: rect(29px, 9999px, 14px, 0);
    }

    20% {
        clip: rect(87px, 9999px, 7px, 0);
    }

    100% {
        clip: rect(12px, 9999px, 59px, 0);
    }
}

@keyframes glitch-anim2 {
    0% {
        clip: rect(82px, 9999px, 51px, 0);
    }

    5% {
        clip: rect(21px, 9999px, 96px, 0);
    }

    10% {
        clip: rect(42px, 9999px, 14px, 0);
    }

    15% {
        clip: rect(19px, 9999px, 64px, 0);
    }

    20% {
        clip: rect(63px, 9999px, 35px, 0);
    }

    100% {
        clip: rect(82px, 9999px, 51px, 0);
    }
}

.subtitle {
    color: var(--fg-muted);
    line-height: 1.6;
    margin-bottom: 40px;
    font-size: 1.1rem;
    max-width: 90%;
}

.countdown-display {
    font-family: 'Syncopate', sans-serif;
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 50px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 15px 0;
    width: 100%;
}

.action-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 320px;
}

.primary-btn {
    background: transparent;
    color: var(--fg);
    border: 1px solid var(--border);
    padding: 18px 40px;
    border-radius: 12px;
    font-family: 'Syncopate', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    cursor: pointer;
    width: 100%;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.primary-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #fff;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 1;
}

.primary-btn:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}

.primary-btn:hover {
    color: #000;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    border-color: #fff;
}

.primary-btn .btn-text {
    position: relative;
    z-index: 2;
}

.sub-hint {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #555;
    text-transform: uppercase;
}

@media (max-width: 600px) {
    .logo-text {
        font-size: 2.2rem;
    }

    .content-wrapper {
        padding: 40px 20px;
    }

    .countdown-display {
        font-size: 1.2rem;
    }

    .dynamic-island-wrapper {
        top: 20px;
        padding: 0 10px;
    }

    .dynamic-island.expanded {
        min-width: 100%;
    }
}