/* ===========================
   CSS Variables
   =========================== */
:root {
    --gold: #f0b90b;
    --bg: #0b0e11;
    --panel: #1e2329;
    --text: #eaecef;
    --sub: #848e9c;
    --success: #02c076;
    --err: #cf304a;
    --border: #363c4e;
}

/* ===========================
   Base Styles
   =========================== */
* {
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* ===========================
   Navigation
   =========================== */
.nav-top {
    background: #161a1e;
    border-bottom: 1px solid var(--border);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.nav-logo {
    font-weight: 800;
    color: var(--gold);
}

#bypass-trigger {
    cursor: default;
}

.nav-terminate {
    color: var(--sub);
    font-family: monospace;
    cursor: pointer;
    background: #222;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 9px;
    transition: background 0.2s;
}

.nav-terminate:hover {
    background: #333;
}

/* ===========================
   Main Container
   =========================== */
.wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 20px;
}

.portal-card {
    background: var(--panel);
    width: 100%;
    max-width: 500px;
    border-radius: 6px;
    padding: 40px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border);
    position: relative;
    min-height: auto;
    max-height: 95vh;
    overflow-y: auto;
}

/* ===========================
   Balance Badge
   =========================== */
.balance-badge {
    background: #111417;
    color: var(--gold);
    padding: 20px;
    border: 1px solid var(--gold);
    width: 100%;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 0 12px rgba(240,185,11,0.4);
    border-radius: 6px;
}

.balance-label {
    font-size: 10px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.balance-val {
    font-size: 28px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

/* ===========================
   Progress Steps
   =========================== */
.steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    font-size: 8px;
    color: var(--sub);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.steps span {
    transition: 0.3s;
    padding-bottom: 10px;
    border-bottom: 1px solid transparent;
}

.steps .active-step {
    font-weight: 700;
    color: var(--gold);
    border-bottom: 2px solid var(--gold);
}

/* ===========================
   Action Required Banner
   =========================== */
.action-required {
    text-align: center;
    font-size: 11px;
    margin-bottom: 15px;
    line-height: 1.5;
    color: var(--gold);
}

.saturation-pct {
    font-size: 9px;
    color: var(--gold);
    text-align: right;
    margin-bottom: 10px;
}

/* ===========================
   Document Box
   =========================== */
#t-box {
    height: 180px;
    overflow-y: scroll;
    background: #0b0e11;
    color: var(--sub);
    padding: 20px;
    font-size: 10px;
    border: 1px solid var(--border);
    line-height: 1.8;
    position: relative;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: auto !important;
    border-radius: 4px;
}

#t-box::-webkit-scrollbar {
    display: none;
}

.doc-header {
    text-align: center;
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
    margin-bottom: 40px;
}

.doc-subheader {
    font-size: 10px;
    color: #777;
}

/* ===========================
   Buttons
   =========================== */
.btn-main {
    background: var(--gold);
    color: #000;
    border: none;
    padding: 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.btn-main:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.5), 0 0 10px var(--gold);
    background: #d4a00a;
}

.btn-main:disabled {
    background: #2b3139;
    color: #474d57;
    cursor: not-allowed;
}

.button-container {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    gap: 10px;
}

/* ===========================
   Entropy Harvesting
   =========================== */
#harvest-zone {
    width: 100%;
    height: 180px;
    border: 1px dashed var(--gold);
    background: rgba(240, 185, 11, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: crosshair;
    position: relative;
    overflow: hidden;
    margin-top: 15px;
}

#entropy-bar-bg {
    width: 100%;
    height: 8px;
    background: #111417;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
    border: 1px solid var(--border);
}

#entropy-bar {
    width: 0%;
    height: 100%;
    background: var(--gold);
    transition: width 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 0 12px rgba(240,185,11,0.8);
}

/* ===========================
   Quiz Section
   =========================== */
.quiz-q {
    font-size: 12px;
    margin-bottom: 15px;
    color: var(--gold);
    font-weight: bold;
    text-transform: uppercase;
}

.option-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px;
    margin-bottom: 10px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.25s ease;
    border-radius: 4px;
}

.option-btn:hover {
    background: #2b3139;
    border-color: var(--gold);
}

/* ===========================
   Captcha Grid
   =========================== */
.captcha-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    background: #363c4e;
    padding: 4px;
    border-radius: 4px;
}

.captcha-tile {
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    position: relative;
    border: 2px solid transparent;
    transition: all 0.25s ease;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.captcha-tile:hover {
    opacity: 0.8;
}

.captcha-tile.selected {
    border-color: var(--gold);
    opacity: 0.6;
    box-shadow: 0 0 10px var(--gold), inset 0 0 2px rgba(0,0,0,0.5);
}

/* ===========================
   Loading Overlay
   =========================== */
#loading-overlay,
#loading-overlay2 {
    text-align: center;
    padding: 40px 20px;
    font-family: monospace;
    font-size: 10px;
    color: var(--gold);
    background: rgba(11,14,17,0.96);
    box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

/* TX Logs */
#tx-log {
    background: #14181d;
    border-radius: 6px;
    padding: 16px;
    color: var(--gold);
    font-size: 11px;
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 6px 18px rgba(0,0,0,0.7);
}

#tx-log div {
    transition: all 0.3s ease;
}

#tx-log div.new-log {
    animation: fadeInLog 0.4s ease;
}

@keyframes fadeInLog {
    0% { opacity: 0; transform: translateY(3px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ===========================
   Input Fields
   =========================== */
input {
    width: 100%;
    padding: 16px;
    background: #0b0e11;
    border: 1px solid var(--border);
    color: #fff;
    outline: none;
    margin-top: 10px;
    font-family: monospace;
    font-size: 13px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(240,185,11,0.6);
}

.char-count {
    font-size: 9px;
    text-align: right;
    color: var(--sub);
    margin-top: 5px;
}

/* ===========================
   Fail Popup
   =========================== */
#fail-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--err);
    color: #fff;
    padding: 20px;
    z-index: 100;
    font-size: 10px;
    font-weight: bold;
    text-align: center;
    border: 2px solid #fff;
    min-width: 320px;
    border-radius: 6px;
}

/* ===========================
   Footer Status
   =========================== */
.footer-status {
    position: fixed;
    bottom: 10px;
    right: 20px;
    font-size: 9px;
    color: var(--sub);
    font-family: monospace;
    display: flex;
    align-items: center;
}

.recording-dot {
    width: 6px;
    height: 6px;
    background: #ff4d4d;
    border-radius: 50%;
    margin-right: 8px;
    animation: jitter 0.3s infinite alternate, pulse 1s infinite;
}

@keyframes jitter {
    0% { transform: translate(0, 0); }
    50% { transform: translate(1px, -1px); }
    100% { transform: translate(-1px, 1px); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
    100% { transform: scale(1); opacity: 1; }
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 600px) {
    .portal-card {
        padding: 20px;
    }

    #t-box {
        height: 150px;
    }

    .nav-top {
        padding: 12px 20px;
        font-size: 10px;
    }

    .balance-val {
        font-size: 24px;
    }
}