/* ===== BBOTTL.com - Frutiger Aero Bottled Universe ===== */

:root {
    --sky-start: #E0F7FA;
    --sky-mid: #B2EBF2;
    --sky-end: #00ACC1;
    --bottle-glass: #80DEEA;
    --deep-water: #004D61;
    --accent-coral: #FF6E40;
    --glow-lime: #B2FF59;
    --text-primary: #1A2B3C;
    --text-secondary: #607D8B;
    --frost: rgba(255, 255, 255, 0.25);
    --frost-strong: rgba(255, 255, 255, 0.45);
    --frost-line: rgba(255, 255, 255, 0.6);
    --shadow-soft: 0 10px 40px rgba(0, 77, 97, 0.18);
    --shadow-glow: 0 0 60px rgba(178, 255, 89, 0.25);

    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-fluid: cubic-bezier(0.4, 0.0, 0.2, 1);
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    background: var(--sky-start);
    position: relative;
    user-select: none;
}

/* ===== Background gradient cycle ===== */
.bg-gradient {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: linear-gradient(135deg, #E0F7FA, #B2EBF2, #80DEEA, #B2EBF2, #E0F7FA);
    background-size: 400% 400%;
    animation: skyFlow 60s ease-in-out infinite;
}

@keyframes skyFlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ===== Floating gradient orbs ===== */
.orbs { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.55;
    will-change: transform;
}

.orb-1 {
    width: 480px; height: 480px;
    background: radial-gradient(circle, #FF6E40 0%, transparent 70%);
    top: -120px; left: -80px;
    animation: drift1 28s ease-in-out infinite;
}

.orb-2 {
    width: 420px; height: 420px;
    background: radial-gradient(circle, #B2FF59 0%, transparent 70%);
    bottom: -100px; right: -60px;
    animation: drift2 34s ease-in-out infinite;
}

.orb-3 {
    width: 360px; height: 360px;
    background: radial-gradient(circle, #00ACC1 0%, transparent 70%);
    top: 40%; left: 45%;
    animation: drift3 24s ease-in-out infinite;
}

@keyframes drift1 {
    0%, 100% { transform: translate3d(0,0,0) scale(1); }
    33% { transform: translate3d(120px, 80px, 0) scale(1.1); }
    66% { transform: translate3d(60px, 200px, 0) scale(0.95); }
}
@keyframes drift2 {
    0%, 100% { transform: translate3d(0,0,0) scale(1); }
    50% { transform: translate3d(-160px, -120px, 0) scale(1.15); }
}
@keyframes drift3 {
    0%, 100% { transform: translate3d(-50%, -50%, 0) scale(1); }
    50% { transform: translate3d(-30%, -65%, 0) scale(1.2); }
}

/* ===== Bubble canvas ===== */
#bubbles {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

/* ===== Dashboard grid ===== */
.dashboard {
    position: relative;
    z-index: 3;
    width: 100vw;
    height: 100vh;
    display: grid;
    grid-template-columns: 1fr 2.4fr 1.4fr 1fr;
    grid-template-rows: auto 1fr 1fr auto;
    gap: 18px;
    padding: 28px 28px 110px 28px;
}

.hero-title {
    grid-column: 1 / -1;
    grid-row: 1;
    text-align: center;
    padding: 8px 0 4px;
    pointer-events: none;
}

.kinetic {
    font-family: 'Rubik', sans-serif;
    font-weight: 700;
    font-size: clamp(4rem, 10vw, 8rem);
    line-height: 0.9;
    letter-spacing: -0.02em;
    background: linear-gradient(180deg, #00ACC1 0%, #004D61 70%, #FF6E40 120%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow: 0 6px 32px rgba(0, 172, 193, 0.28);
    pointer-events: auto;
}

.letter {
    display: inline-block;
    transform: translateY(120%);
    opacity: 0;
    transition: transform 0.5s var(--ease-spring);
    will-change: transform;
}

.letter.in {
    animation: letterRise 1.2s var(--ease-spring) forwards;
}

.letter.in.float {
    animation: letterFloat 4.5s ease-in-out infinite;
}

@keyframes letterRise {
    0% { transform: translateY(120%); opacity: 0; }
    70% { transform: translateY(-8%); opacity: 1; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes letterFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-6px) rotate(0.6deg); }
}

.kinetic .letter:hover {
    animation: letterWobble 0.8s var(--ease-spring);
}

@keyframes letterWobble {
    0% { transform: translateY(0) rotate(0); }
    25% { transform: translateY(-10px) rotate(-6deg) scale(1.1); }
    60% { transform: translateY(2px) rotate(4deg) scale(0.97); }
    100% { transform: translateY(0) rotate(0); }
}

.subtitle {
    font-family: 'Space Mono', monospace;
    font-size: 0.95rem;
    color: var(--deep-water);
    margin-top: 4px;
    min-height: 1.4em;
    letter-spacing: 0.04em;
}

.subtitle::after {
    content: '▌';
    color: var(--accent-coral);
    margin-left: 2px;
    animation: caret 0.9s steps(1) infinite;
}

@keyframes caret {
    50% { opacity: 0; }
}

/* ===== Panels (frosted glass) ===== */
.panel {
    position: relative;
    background: var(--frost);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--frost-line);
    border-radius: 28px;
    box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255,255,255,0.6);
    padding: 18px 20px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    transition: transform 0.9s var(--ease-spring), opacity 0.9s var(--ease-fluid);
}

.panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.45), transparent);
    pointer-events: none;
    border-radius: 28px 28px 0 0;
}

.panel.in {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.panel-left  { grid-column: 1; grid-row: 2 / 4; }
.panel-bottle{ grid-column: 2; grid-row: 2 / 4; border-radius: 48px; padding: 22px 28px; }
.panel-bottle::before { border-radius: 48px 48px 0 0; }
.panel-level { grid-column: 3; grid-row: 2; }
.panel-ring  { grid-column: 3; grid-row: 3; }
.panel-right { grid-column: 4; grid-row: 2 / 4; }

.panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: var(--deep-water);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 14px;
    position: relative;
    z-index: 2;
}

.dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #B2FF59, #00ACC1);
    box-shadow: 0 0 12px rgba(178, 255, 89, 0.7);
    will-change: transform;
    transition: transform 0.45s var(--ease-spring);
}

.panel-label { flex: 1; font-weight: 700; }
.panel-meta { color: var(--text-secondary); font-weight: 400; }

/* ===== Ticker panels ===== */
.panel-ticker .ticker-track {
    position: relative;
    height: calc(100% - 32px);
    overflow: hidden;
    mask-image: linear-gradient(180deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
}

.ticker-track {
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: tickerScroll 22s linear infinite;
}

#tickerRight { animation-duration: 28s; animation-direction: reverse; }

.ticker-item {
    font-family: 'Space Mono', monospace;
    font-size: 0.82rem;
    color: var(--deep-water);
    padding: 8px 10px;
    background: rgba(255,255,255,0.35);
    border: 1px solid rgba(255,255,255,0.55);
    border-radius: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

@keyframes tickerScroll {
    0%   { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

/* ===== Center bottle / story panel ===== */
.panel-bottle {
    background: linear-gradient(160deg, rgba(255,255,255,0.32), rgba(128, 222, 234, 0.22));
    box-shadow: var(--shadow-soft), var(--shadow-glow), inset 0 1px 0 rgba(255,255,255,0.7);
}

.story-stage {
    position: relative;
    height: calc(100% - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.story {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 30px;
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    transition: opacity 0.8s var(--ease-fluid), transform 0.8s var(--ease-spring);
    pointer-events: none;
}

.story-active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.story h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(1.5rem, 2.6vw, 2.4rem);
    color: var(--deep-water);
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.story p {
    max-width: 380px;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.55;
}

.ill {
    width: clamp(120px, 18vw, 180px);
    height: auto;
    margin-bottom: 14px;
    fill: none;
    stroke: var(--deep-water);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.story-active .ill .draw {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: drawIn 1.6s var(--ease-fluid) forwards;
}

@keyframes drawIn {
    to { stroke-dashoffset: 0; }
}

.story-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.sd {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: rgba(0, 77, 97, 0.25);
    border: none;
    cursor: pointer;
    transition: all 0.35s var(--ease-spring);
}

.sd.on {
    width: 28px;
    border-radius: 6px;
    background: linear-gradient(90deg, #00ACC1, #B2FF59);
}

/* ===== Liquid level panel ===== */
.level-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: calc(100% - 32px);
    justify-content: center;
}

.level-row {
    display: grid;
    grid-template-columns: 18px 1fr 48px;
    align-items: center;
    gap: 10px;
}

.lr-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: var(--deep-water);
    font-weight: 700;
}

.level-bar {
    height: 14px;
    background: rgba(255,255,255,0.45);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.6);
    position: relative;
}

.level-bar .fill {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #00ACC1 0%, #B2FF59 70%, #FF6E40 100%);
    border-radius: 8px;
    box-shadow: 0 0 14px rgba(178, 255, 89, 0.6);
    transition: width 2.4s var(--ease-fluid);
    position: relative;
}

.level-bar .fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.55), transparent);
    border-radius: 8px 8px 0 0;
}

.panel-level.fill-go .fill {
    width: var(--target);
}

.lr-val {
    font-family: 'Space Mono', monospace;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-align: right;
}

/* ===== Ring panel ===== */
.ring-wrap {
    position: relative;
    height: calc(100% - 32px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ring {
    width: clamp(110px, 12vw, 160px);
    height: clamp(110px, 12vw, 160px);
    transform: rotate(-90deg);
}

.ring-track {
    fill: none;
    stroke: rgba(255,255,255,0.5);
    stroke-width: 8;
}

.ring-fill {
    fill: none;
    stroke: url(#ringGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 314;
    stroke-dashoffset: 314;
    transition: stroke-dashoffset 0.1s linear;
    filter: drop-shadow(0 0 6px rgba(178, 255, 89, 0.6));
}

/* fallback: stroke without gradient if SVG def missing */
.ring-fill { stroke: #00ACC1; }

.ring-readout {
    position: absolute;
    text-align: center;
}

.ring-pct {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--deep-water);
}

.ring-cap {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.16em;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ===== Wave-form bottom ===== */
.wave-stack {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    pointer-events: none;
    z-index: 4;
}

.wave {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.wave-1 path { fill: rgba(0, 172, 193, 0.6); }
.wave-2 path { fill: rgba(128, 222, 234, 0.4); }
.wave-3 path { fill: rgba(178, 255, 89, 0.2); }

/* ===== Floating toolbar ===== */
.toolbar {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.35);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 999px;
    box-shadow: 0 12px 32px rgba(0, 77, 97, 0.25), inset 0 1px 0 rgba(255,255,255,0.7);
    z-index: 20;
    opacity: 0;
    transform: translate(-50%, 30px);
    transition: opacity 0.8s var(--ease-fluid), transform 0.8s var(--ease-spring);
}

.toolbar.in {
    opacity: 1;
    transform: translate(-50%, 0);
}

.tool {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(160deg, rgba(255,255,255,0.7), rgba(128,222,234,0.4));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s var(--ease-spring), box-shadow 0.3s ease;
    will-change: transform;
    position: relative;
}

.tool::before {
    content: '';
    position: absolute;
    top: 3px; left: 6px; right: 6px;
    height: 40%;
    background: linear-gradient(180deg, rgba(255,255,255,0.8), transparent);
    border-radius: 50%;
    pointer-events: none;
}

.tool svg {
    width: 22px; height: 22px;
    fill: none;
    stroke: var(--deep-water);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    position: relative;
    z-index: 1;
}

.tool:hover {
    box-shadow: 0 0 20px rgba(178, 255, 89, 0.6);
}

/* ===== Responsive: stack on small screens ===== */
@media (max-width: 900px) {
    .dashboard {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto auto auto;
        padding: 18px 14px 110px;
        gap: 12px;
        height: auto;
        min-height: 100vh;
    }
    html, body { overflow-y: auto; }
    .panel-left, .panel-bottle, .panel-level, .panel-ring, .panel-right {
        grid-column: 1; grid-row: auto;
        min-height: 200px;
    }
    .panel-bottle { min-height: 360px; }
}
