/* ==========================================================
   Phase Field · GenieForge
   ========================================================== */

:root {
    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
            "Liberation Mono", "Courier New", monospace;
    --text: #e8e8e8;
    --muted: rgba(255, 255, 255, 0.70);
    --glass: rgba(8, 9, 12, 0.6);
    --glass-border: rgba(255, 255, 255, 0.10);
    --glass-hover: rgba(8, 9, 12, 0.82);
}


/* ---- Reset ---- */

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

body {
    background: #000;
    overflow: hidden;
    height: 100vh;
    color: var(--text);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}


/* ---- Canvas ---- */

#c {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: block;
    cursor: pointer;
    z-index: 0;
}


/* ---- Floating chrome (shared) ---- */

.chrome {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    justify-content: center;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.chrome-inner {
    pointer-events: auto;
    background: var(--glass);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.chrome-inner:hover {
    background: var(--glass-hover);
    border-color: rgba(255, 255, 255, 0.16);
}

.chrome.idle {
    opacity: 0.08;
}

.chrome.idle:hover {
    opacity: 1;
}


/* ---- Header ---- */

.header {
    top: 0;
    padding: 12px 16px;
}

.header .chrome-inner {
    border-radius: 0 0 14px 14px;
    padding: 10px 16px;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: space-between;
    width: min(560px, calc(100vw - 24px));
    border-top: none;
}

.gf-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    border-radius: 10px;
    padding: 4px 6px;
    margin: -4px -6px;
    transition: background 0.2s;
}

.gf-brand:hover {
    background: rgba(255, 255, 255, 0.08);
}

.gf-logo {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    object-fit: cover;
}

.gf-title {
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.01em;
}

.gf-subtitle {
    font-size: 11px;
    color: var(--muted);
    margin-top: 1px;
}

.header-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pill {
    font-size: 11px;
    color: var(--muted);
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    padding: 6px 10px;
    border-radius: 10px;
    font-family: var(--mono);
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.pill:hover {
    background: rgba(255, 255, 255, 0.10);
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.20);
}

.pill.active {
    background: rgba(255, 255, 255, 0.10);
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.18);
}


/* ---- Footer ---- */

.footer {
    bottom: 0;
    padding: 12px 16px;
}

.footer .chrome-inner {
    border-radius: 14px 14px 0 0;
    padding: 10px 20px;
    gap: 16px;
    border-bottom: none;
    font-size: 11px;
    font-family: var(--mono);
    color: var(--muted);
    flex-wrap: wrap;
    justify-content: center;
}

.footer a {
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.18);
    transition: color 0.2s, border-color 0.2s;
}

.footer a:hover {
    color: var(--text);
    border-bottom-color: rgba(255, 255, 255, 0.35);
}

.footer .sep {
    color: rgba(255, 255, 255, 0.15);
    user-select: none;
}


/* ---- Splash overlay ---- */

.splash {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    text-align: center;
    pointer-events: none;
    opacity: 1;
    transition: opacity 1.6s ease 2s;
}

.splash.faded {
    opacity: 0;
}

.splash h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.8);
}

.splash p {
    font-size: 12px;
    color: var(--muted);
    font-family: var(--mono);
    margin-top: 6px;
    text-shadow: 0 1px 14px rgba(0, 0, 0, 0.9);
}


/* ---- About panel ---- */

.about-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.about-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.about-panel {
    background: rgba(14, 16, 22, 0.92);
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 28px 28px 24px;
    max-width: 460px;
    width: calc(100vw - 40px);
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    position: relative;
    transform: translateY(12px) scale(0.97);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.about-overlay.open .about-panel {
    transform: translateY(0) scale(1);
}

.about-panel h2 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 14px;
    letter-spacing: -0.01em;
}

.about-panel p {
    font-size: 13px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.78);
    margin-bottom: 12px;
}

.about-panel p:last-of-type {
    margin-bottom: 0;
}

.about-panel .math {
    font-family: var(--mono);
    color: rgba(255, 200, 100, 0.9);
    font-size: 12px;
}

.about-panel .credit {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.6;
}

.about-panel .credit a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
}

.about-panel .credit a:hover {
    color: var(--text);
    border-bottom-color: rgba(255, 255, 255, 0.4);
}

.about-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.2s, color 0.2s;
}

.about-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
}


/* ---- Mobile ---- */

@media (max-width: 480px) {
    .header .chrome-inner { padding: 8px 12px; gap: 8px; }
    .pill { font-size: 10px; padding: 5px 8px; }
    .footer .chrome-inner { padding: 8px 14px; gap: 10px; font-size: 10px; }
    .splash h1 { font-size: 18px; }
    .about-panel { padding: 22px 20px 20px; }
    .about-panel h2 { font-size: 15px; }
}