/* ==========================================================================
   TAMAN BERTEMAN — PORTAL V7
   - Clean sunlit aesthetic hero (no telemetry clutter above H1)
   - Symmetrical Edition IP Dock + Standalone Discord & Store Action Row
   - Tidy 2x2 Perks Showcase ("Apa Serunya Bermain di Taman Berteman?")
   - Bulletproof CSS Grid Slot Auth Slider (ZERO OTP squish bug!)
   ========================================================================== */

.portal-flow {
    position: relative;
    z-index: 2;
}

/* Minecraft Altitude Rail */
.altitude-hud {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    color: var(--ink-muted);
    transition: color 500ms var(--ease);
}

.alt-readout {
    display: grid;
    gap: 2px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-align: right;
}

.alt-y { font-weight: 700; font-size: 0.74rem; color: var(--ink); }

.alt-track {
    position: relative;
    width: 3px;
    height: 116px;
    border-radius: 3px;
    background: var(--line-strong);
}

.alt-thumb {
    position: absolute;
    left: -3px;
    top: 0;
    width: 9px;
    height: 9px;
    border-radius: 2px;
    background: var(--accent-bright);
    transition: top 120ms linear;
}

/* ==========================================================================
   CHAPTER 01 · AESTHETIC HERO + PROMINENT 13x13 MINECRAFT ISLAND
   ========================================================================== */
.portal-hero {
    min-height: 100svh;
    padding: calc(var(--nav-h) + 28px) 0 48px;
    display: flex;
    align-items: center;
}

.hero-stage {
    display: grid;
    grid-template-columns: minmax(0, 0.96fr) minmax(0, 1.04fr);
    gap: 32px;
    align-items: center;
}

.hero-copy {
    display: grid;
    gap: 20px;
    max-width: 520px;
    position: relative;
}

.hero-copy h1 {
    font-size: clamp(2.6rem, 5.0vw, 4.25rem);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -0.045em;
    color: var(--ink);
    text-shadow: 0 2px 24px rgba(198, 224, 245, 0.72);
}

:root[data-theme="sunset"] .hero-copy h1 {
    text-shadow: 0 2px 24px rgba(247, 224, 198, 0.78);
}

:root[data-theme="night"] .hero-copy h1 {
    text-shadow: 0 4px 28px rgba(8, 10, 14, 0.65);
}

.hero-copy h1 span { color: var(--accent); }

.hero-lead {
    font-size: clamp(0.96rem, 1.25vw, 1.04rem);
    color: var(--ink);
    opacity: 0.84;
    max-width: 44ch;
    line-height: 1.65;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--line);
}

/* Symmetrical Standalone Discord + Store Row */
.hero-actions-row {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
    gap: 10px;
    align-items: stretch;
}

.btn-discord-hero {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 13px 18px;
    border-radius: 13px;
    background: #4e5bc4;
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 8px 20px rgba(24, 30, 74, 0.16), inset 0 -2px 0 rgba(0, 0, 0, 0.18);
    transition: transform 240ms var(--ease), background 240ms var(--ease), box-shadow 240ms var(--ease);
}

.btn-discord-hero:hover {
    background: #424eb2;
    transform: translateY(-2px);
}

:root[data-theme="sunset"] .btn-discord-hero {
    background: #2e241d;
    border-color: rgba(255, 236, 214, 0.16);
    box-shadow: 0 8px 20px rgba(32, 20, 12, 0.18);
}
:root[data-theme="sunset"] .btn-discord-hero:hover { background: #3f3127; }

:root[data-theme="night"] .btn-discord-hero {
    background: #232834;
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34);
}
:root[data-theme="night"] .btn-discord-hero:hover { background: #2d3342; border-color: var(--accent); }

.btn-hero-store {
    padding: 13px 16px;
    border-radius: 13px;
    font-size: 0.88rem;
}

.hero-viewport-open {
    min-height: 460px;
    pointer-events: none;
}

/* ==========================================================================
   CHAPTER 02 · APA SERUNYA BERMAIN DI TAMAN BERTEMAN? (SYMMETRICAL 2x2 GRID)
   ========================================================================== */
.portal-world {
    padding: clamp(72px, 11vh, 130px) 0;
}

.world-split {
    display: grid;
    grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
    gap: 36px;
    align-items: center;
}

.world-editorial {
    display: grid;
    gap: 24px;
}

.chapter-coord {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 8px;
}

.chapter-coord--emerald { color: #4ade80; }

.chapter-head h2,
.bridge-head h2 {
    font-size: clamp(1.85rem, 3.2vw, 2.6rem);
    font-weight: 800;
    line-height: 1.09;
    letter-spacing: -0.035em;
    color: var(--ink);
    text-shadow: 0 2px 22px rgba(198, 224, 245, 0.82);
}

:root[data-theme="sunset"] .chapter-head h2 {
    text-shadow: 0 2px 22px rgba(247, 224, 198, 0.80);
}

:root[data-theme="night"] .chapter-head h2 {
    text-shadow: 0 4px 26px rgba(8, 10, 14, 0.65);
}

.perks-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.perk-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px 21px;
    border-radius: var(--radius-lg);
    background: var(--surface-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-soft);
    transition: transform 280ms var(--ease), border-color 280ms var(--ease), background 500ms var(--ease);
}

.perk-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
}

.perk-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.perk-num {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--accent);
    padding-bottom: 3px;
    border-bottom: 2px solid var(--accent);
}

.perk-tag {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--accent-soft);
    color: var(--accent);
}

.perk-card h3 {
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink);
    line-height: 1.25;
}

.perk-card p {
    font-size: 0.85rem;
    color: var(--ink-muted);
    line-height: 1.62;
}

.rules-strip {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: var(--surface-strong);
    backdrop-filter: blur(16px);
    border: 1px solid var(--line);
    font-size: 0.84rem;
    color: var(--ink-muted);
}

.rules-strip strong { color: var(--ink); }

.rules-tag {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--accent-soft);
    color: var(--accent);
}

.world-viewport-open {
    min-height: 440px;
    pointer-events: none;
}

/* ==========================================================================
   CHAPTER 03 · 3D LUSH CAVERNS & LIVE SERVER BRIDGE
   ========================================================================== */
.portal-bridge {
    padding: clamp(72px, 10vh, 120px) 0 clamp(68px, 9vh, 100px);
}

.bridge-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    background: rgba(11, 18, 16, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.bridge-head h2 { color: #ffffff; text-shadow: none; }

.btn-cavern-ghost {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.bridge-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.95fr);
    gap: 18px;
    align-items: start;
}

.bridge-console {
    background: var(--console-bg);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: grid;
    color: #eef5f0;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.console-head {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.console-title {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 0.92rem;
    color: #ffffff;
}

.console-cube {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: #22c55e;
}

.feed-badge {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5d0;
    white-space: nowrap;
    flex-shrink: 0;
}

.feed-badge.is-live {
    background: rgba(34, 197, 94, 0.18);
    color: #4ade80;
}

/* Chat Stream — ZERO WHITE SCROLLBAR */
.chat-stream {
    height: 368px;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.chat-stream::-webkit-scrollbar { display: none; width: 0; height: 0; }

.chat-msg-row {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.chat-avatar {
    border-radius: 6px;
    image-rendering: pixelated;
    flex-shrink: 0;
}

.chat-msg-content { min-width: 0; flex: 1; }

.chat-msg-header {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.chat-sender { font-weight: 700; font-size: 0.85rem; color: #ffffff; }

.chat-tag {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.1);
    color: #d1ddd7;
}
.chat-tag.discord { background: rgba(99, 102, 241, 0.28); color: #c7d2fe; }
.chat-tag.game { background: rgba(34, 197, 94, 0.22); color: #86efac; }
.chat-tag.web { background: rgba(14, 165, 233, 0.24); color: #bae6fd; }
.chat-tag.bot { background: rgba(245, 158, 11, 0.22); color: #fde68a; }

.chat-time {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: rgba(235, 244, 239, 0.44);
}

.chat-text { font-size: 0.86rem; color: #dde8e2; word-break: break-word; }

.empty-state {
    margin: auto;
    text-align: center;
    padding: 28px 16px;
    color: rgba(235, 244, 239, 0.62);
    display: grid;
    gap: 6px;
    justify-items: center;
}
.empty-state strong { color: #ffffff; font-size: 0.9rem; }
.empty-state p { font-size: 0.8rem; max-width: 32ch; }

/* BULLETPROOF GRID-SLOT AUTH SLIDER (Password Server <-> Kode OTP /webcode) */
.console-composer {
    padding: 16px 20px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(6, 10, 9, 0.55);
    display: grid;
    gap: 12px;
    min-width: 0;
}

.chat-auth-wrap {
    width: 100%;
    min-width: 0;
}

.auth-tabs {
    position: relative;
    display: inline-grid;
    grid-template-columns: repeat(2, 1fr);
    padding: 4px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.11);
    margin-bottom: 12px;
    width: min(350px, 100%);
}

.auth-pill-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc((100% - 8px) / 2);
    height: calc(100% - 8px);
    border-radius: 7px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: transform 400ms var(--ease);
    pointer-events: none;
}

.chat-auth-wrap[data-auth-mode="otp"] .auth-pill-indicator {
    transform: translateX(100%);
}

.auth-tab {
    position: relative;
    z-index: 1;
    border: 0;
    background: transparent;
    color: rgba(235, 244, 239, 0.74);
    padding: 8px 12px;
    border-radius: 7px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: color 300ms var(--ease);
}

.auth-tab.active {
    color: #0e1613;
}

/* Stacked Grid Slot — mathematically impossible to squish inputs! */
.auth-slider {
    display: grid;
    grid-template-areas: "slot";
    width: 100%;
    overflow: hidden;
    padding: 1px;
}

.auth-slide {
    grid-area: slot;
    width: 100%;
    min-width: 0;
    opacity: 0;
    pointer-events: none;
    transition: transform 420ms var(--ease), opacity 320ms var(--ease);
}

.auth-slide[data-auth-slide="password"] {
    transform: translateX(-28px);
}

.auth-slide[data-auth-slide="otp"] {
    transform: translateX(28px);
}

.auth-slide.is-active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.auth-form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 8px;
    width: 100%;
}

.chat-send-form { display: grid; gap: 8px; }
.chat-user-bar { display: flex; align-items: center; justify-content: space-between; font-size: 0.82rem; }
.chat-user-ident { display: inline-flex; align-items: center; gap: 8px; }
.chat-user-ident img { border-radius: 5px; }
.chat-logout { border: 0; background: transparent; color: #fca5a5; font-size: 0.76rem; font-weight: 700; cursor: pointer; }
.chat-send-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }

.console-input {
    width: 100%;
    min-width: 0;
    padding: 11px 13px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: var(--console-input-bg);
    color: #ffffff;
    font-size: 0.85rem;
    transition: border-color 220ms var(--ease), background 220ms var(--ease);
}

.console-input::placeholder { color: rgba(235, 244, 239, 0.45); }
.console-input:focus { outline: none; border-color: #4ade80; background: rgba(255, 255, 255, 0.10); }

/* Keep dark background even on Chrome/Edge autofill */
.console-input:-webkit-autofill,
.console-input:-webkit-autofill:hover,
.console-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #ffffff;
    -webkit-box-shadow: 0 0 0 1000px #151e1c inset;
    box-shadow: 0 0 0 1000px #151e1c inset;
    border-color: rgba(74, 222, 128, 0.45);
    transition: background-color 9999s ease-in-out 0s;
}

.btn-console-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 16px;
    border: 0;
    border-radius: 9px;
    background: #22c55e;
    color: #06180c;
    font-size: 0.84rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 200ms var(--ease), background 200ms var(--ease);
}
.btn-console-submit:hover { background: #4ade80; transform: translateY(-1px); }
.btn-console-submit:disabled { opacity: 0.55; cursor: not-allowed; }

.console-footnote { font-size: 0.76rem; color: rgba(235, 244, 239, 0.56); }
.console-footnote code { font-family: var(--font-mono); color: #86efac; }

/* Bridge Sidebar */
.bridge-side { display: grid; gap: 14px; }

.cavern-card {
    background: var(--console-bg);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: grid;
    gap: 12px;
    color: #eef5f0;
}

.cavern-card-head { display: flex; align-items: center; justify-content: space-between; font-size: 0.88rem; color: #ffffff; }
.cavern-pill { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 5px; background: rgba(34, 197, 94, 0.18); color: #86efac; }
.cavern-link, .cavern-mono { font-family: var(--font-mono); font-size: 0.7rem; color: #4ade80; font-weight: 600; }

.players-roster { max-height: 170px; overflow-y: auto; display: grid; gap: 8px; }
.player-roster-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 9px; background: rgba(255, 255, 255, 0.05); }
.player-info-meta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.player-head-img { border-radius: 5px; image-rendering: pixelated; }
.player-name-val { font-size: 0.84rem; font-weight: 700; color: #ffffff; }
.player-time-badge { font-size: 0.72rem; color: rgba(235, 244, 239, 0.56); }
.player-ping-badge { font-family: var(--font-mono); font-size: 0.7rem; color: #86efac; }

.goal-title { font-size: 0.92rem; font-weight: 700; color: #ffffff; }
.goal-numbers { font-family: var(--font-mono); font-size: 0.82rem; color: #86efac; font-weight: 600; }
.goal-bar-track { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.goal-bar-fill { height: 100%; background: #22c55e; transition: width 500ms var(--ease); }
.goal-meta { display: flex; align-items: center; justify-content: space-between; font-family: var(--font-mono); font-size: 0.72rem; color: rgba(235, 244, 239, 0.62); }

.event-dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.event-dl dt { font-family: var(--font-mono); font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(235, 244, 239, 0.48); margin-bottom: 2px; }
.event-dl dd { font-size: 0.82rem; font-weight: 700; color: #ffffff; }

@media (max-width: 1200px) { .altitude-hud { display: none; } }

@media (max-width: 960px) {
    .hero-stage, .world-split, .bridge-grid { grid-template-columns: minmax(0, 1fr); }
    .hero-viewport-open, .world-viewport-open { display: none; }
    .hero-copy { max-width: 100%; }
    .hero-lead, .perk-card, .rules-strip, .bridge-console, .cavern-card {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}

@media (max-width: 640px) {
    .portal-hero { min-height: auto; padding: calc(var(--nav-h) + 12px) 0 36px; }
    .hero-copy { gap: 16px; }
    .hero-copy h1 { font-size: clamp(2.15rem, 9.5vw, 2.85rem); }
    .hero-lead { font-size: 0.92rem; padding: 12px 14px; }
    .hero-actions-row, .perks-grid, .auth-form-row { grid-template-columns: minmax(0, 1fr); }
    .portal-world { padding: 36px 0; }
    .chapter-head h2, .bridge-head h2 { font-size: clamp(1.55rem, 7vw, 2.05rem); }
    .perk-card { padding: 16px 17px; }
    .portal-bridge { padding: 36px 0 32px; }
    .bridge-head { margin-bottom: 18px; gap: 12px; }
    .console-head { padding: 13px 14px; }
    .chat-stream { height: 290px; padding: 12px 14px; }
    .console-composer { padding: 14px; }
    .auth-tabs { width: 100%; }
    .auth-tab { font-size: 0.74rem; padding: 8px 6px; }
    .event-dl { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
}
