/* ========================================
   ACTUARIAL - RETRO CRT TERMINAL STYLING
   ======================================== */

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

:root {
    --amber: #ffb000;
    --amber-dim: #cc8800;
    --amber-bright: #ffd700;
    --bg-black: #0a0a0a;
    --bg-dark: #111111;
    --green-ok: #00ff00;
    --red-error: #ff0000;
    --blue-info: #00aaff;
}

body {
    font-family: 'VT323', 'Courier New', monospace;
    font-size: 24px;
    line-height: 1.4;
    color: var(--amber);
    background-color: var(--bg-black);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   CRT EFFECTS
   ======================================== */

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    animation: scanline-flicker 0.1s linear infinite;
}

@keyframes scanline-flicker {
    0% { opacity: 0.95; }
    50% { opacity: 1; }
    100% { opacity: 0.95; }
}

.crt-container {
    position: relative;
    width: 90%;
    max-width: 1000px;
    min-height: 600px;
    background-color: var(--bg-dark);
    border: 3px solid var(--amber-dim);
    border-radius: 8px;
    padding: 20px;
    box-shadow:
        0 0 20px rgba(255, 176, 0, 0.3),
        inset 0 0 30px rgba(0, 0, 0, 0.5);
    text-shadow: 0 0 1px var(--amber);
}

.terminal-view {
    max-width: 1200px;
    min-height: 85vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   TERMINAL HEADER & FOOTER
   ======================================== */

.terminal-header {
    background-color: var(--bg-black);
    border: 2px solid var(--amber-dim);
    padding: 10px 20px;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 3px;
    margin-bottom: 20px;
    box-shadow: 0 0 10px rgba(255, 176, 0, 0.4);
}

.terminal-footer {
    background-color: var(--bg-black);
    border: 2px solid var(--amber-dim);
    padding: 8px 20px;
    text-align: center;
    font-size: 16px;
    margin-top: auto;
    opacity: 0.7;
}

.footer-text {
    letter-spacing: 2px;
}

/* ========================================
   BLINKING ELEMENTS
   ======================================== */

.blink {
    animation: blink-animation 1s steps(2, start) infinite;
}

@keyframes blink-animation {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.cursor {
    animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ========================================
   HOST PAGE
   ======================================== */

.host-content {
    padding: 20px;
    text-align: center;
}

.logo-box {
    border: 3px solid var(--amber-bright);
    padding: 40px 20px;
    margin: 20px auto 40px auto;
    max-width: 600px;
    background-color: rgba(255, 176, 0, 0.05);
}

.logo-title {
    font-size: 64px;
    font-weight: bold;
    letter-spacing: 12px;
    color: var(--amber-bright);
    text-shadow: 0 0 4px var(--amber-bright);
    margin-bottom: 15px;
    line-height: 1.2;
}

.logo-subtitle {
    font-size: 18px;
    color: var(--amber);
    letter-spacing: 3px;
    text-shadow: 0 0 2px var(--amber);
}

.ascii-art {
    color: var(--amber-bright);
    font-size: 16px;
    line-height: 1.2;
    margin-bottom: 30px;
    text-shadow: 0 0 4px var(--amber-bright);
}

.terminal-section {
    margin: 30px 0;
    padding: 20px;
    border: 1px solid var(--amber-dim);
    background-color: rgba(255, 176, 0, 0.05);
}

.section-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
    color: var(--amber-bright);
    letter-spacing: 2px;
}

.status-line {
    font-size: 20px;
    margin: 10px 0;
    letter-spacing: 1px;
}

.status-ok {
    color: var(--green-ok);
    text-shadow: 0 0 2px var(--green-ok);
}

.status-processing {
    color: var(--blue-info);
    text-shadow: 0 0 2px var(--blue-info);
}

.status-complete {
    color: var(--green-ok);
    text-shadow: 0 0 2px var(--green-ok);
    font-weight: bold;
}

.highlight {
    color: var(--amber-bright);
    font-weight: bold;
}

/* ========================================
   BUTTONS
   ======================================== */

.button-container {
    margin: 30px 0;
}

.crt-button {
    background-color: transparent;
    border: 2px solid var(--amber);
    color: var(--amber);
    font-family: 'VT323', 'Courier New', monospace;
    font-size: 26px;
    padding: 15px 40px;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.2s;
    text-shadow: 0 0 1px var(--amber);
    box-shadow: 0 0 10px rgba(255, 176, 0, 0.3);
}

.crt-button:hover:not(:disabled) {
    background-color: var(--amber);
    color: var(--bg-black);
    text-shadow: none;
    box-shadow: 0 0 20px rgba(255, 176, 0, 0.8);
}

.crt-button:active:not(:disabled) {
    transform: scale(0.98);
}

.crt-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.crt-button.small {
    font-size: 18px;
    padding: 10px 25px;
    margin: 5px;
}

.button-bracket {
    color: var(--amber-dim);
}

/* ========================================
   LOADING ANIMATION
   ======================================== */

.loading-container {
    margin: 20px 0;
    text-align: center;
}

.loading-text {
    font-size: 22px;
    color: var(--amber-bright);
    letter-spacing: 2px;
}

/* ========================================
   DASHBOARD
   ======================================== */

.dashboard-content {
    padding: 20px;
}

.invite-box {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.invite-input {
    flex: 1;
    background-color: var(--bg-black);
    border: 2px solid var(--amber-dim);
    color: var(--amber);
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 10px 15px;
    letter-spacing: 1px;
    text-shadow: 0 0 3px var(--amber);
}

.invite-input:focus {
    outline: none;
    border-color: var(--amber-bright);
    box-shadow: 0 0 10px rgba(255, 176, 0, 0.5);
}

.copy-button {
    background-color: transparent;
    border: 2px solid var(--amber);
    color: var(--amber);
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-button:hover {
    background-color: var(--amber);
    color: var(--bg-black);
}

.copy-button.success-flash {
    background-color: var(--green-ok);
    color: var(--bg-black);
    border-color: var(--green-ok);
}

.info-text {
    font-size: 18px;
    margin: 10px 0;
    opacity: 0.8;
}

.info-text.dim {
    opacity: 0.6;
}

.player-list {
    margin-top: 15px;
}

.player-item {
    border: 1px solid var(--amber-dim);
    padding: 15px;
    margin: 10px 0;
    background-color: rgba(255, 176, 0, 0.05);
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.player-name {
    font-size: 22px;
    font-weight: bold;
    color: var(--amber-bright);
}

.player-status {
    font-size: 18px;
}

.player-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.progress-bar {
    font-size: 16px;
    letter-spacing: 1px;
}

.progress-text {
    font-size: 18px;
    opacity: 0.8;
}

/* ========================================
   JOIN PAGE
   ======================================== */

.join-content {
    padding: 20px;
    text-align: center;
}

.join-banner {
    color: var(--amber-bright);
    font-size: 18px;
    margin-bottom: 30px;
    text-shadow: 0 0 5px var(--amber-bright);
}

.input-section {
    margin: 30px 0;
    text-align: left;
}

.input-label {
    display: block;
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--amber-bright);
}

.terminal-input {
    width: 100%;
    background-color: var(--bg-black);
    border: 2px solid var(--amber-dim);
    color: var(--amber);
    font-family: 'VT323', monospace;
    font-size: 24px;
    padding: 12px 15px;
    letter-spacing: 2px;
    text-shadow: 0 0 3px var(--amber);
    text-transform: uppercase;
}

.terminal-input:focus {
    outline: none;
    border-color: var(--amber-bright);
    box-shadow: 0 0 15px rgba(255, 176, 0, 0.5);
}

.error-message {
    color: var(--red-error);
    font-size: 20px;
    margin: 15px 0;
    padding: 10px;
    border: 2px solid var(--red-error);
    background-color: rgba(255, 0, 0, 0.1);
    text-shadow: 0 0 3px var(--red-error);
}

/* ========================================
   TERMINAL CHAT INTERFACE
   ======================================== */

.terminal-main {
    flex: 1 1 auto;
    max-height: calc(85vh - 220px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: var(--bg-black);
    border: 2px solid var(--amber-dim);
    margin-bottom: 15px;
    font-size: 19px;
    line-height: 1.5;
}

.chat-log::-webkit-scrollbar {
    width: 10px;
}

.chat-log::-webkit-scrollbar-track {
    background: var(--bg-black);
}

.chat-log::-webkit-scrollbar-thumb {
    background: var(--amber-dim);
}

.message {
    margin: 15px 0;
}

.system-message {
    color: var(--blue-info);
    margin: 20px 0;
    text-shadow: 0 0 3px var(--blue-info);
}

.system-message p {
    margin: 3px 0;
}

.system-label {
    color: var(--blue-info);
    font-weight: bold;
    text-shadow: 0 0 5px var(--blue-info);
}

.actuary-message {
    color: var(--amber);
    margin: 10px 0;
}

.actuary-label {
    color: var(--amber-bright);
    font-weight: bold;
}

.subject-message {
    color: var(--amber-dim);
    margin: 10px 0;
}

.subject-label {
    color: var(--amber);
    font-weight: bold;
}

.completion-message {
    color: var(--green-ok) !important;
    font-weight: bold;
    text-shadow: 0 0 8px var(--green-ok) !important;
    margin: 25px 0;
    font-size: 22px !important;
}

.completion-message p {
    color: var(--green-ok) !important;
    text-shadow: 0 0 8px var(--green-ok) !important;
}

.dim {
    opacity: 0.6;
}

.input-area {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: var(--bg-black);
    border: 2px solid var(--amber-dim);
}

.input-line {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 10px;
}

.prompt {
    font-size: 24px;
    color: var(--amber-bright);
    font-weight: bold;
}

.message-input {
    flex: 1;
    background-color: transparent;
    border: none;
    color: var(--amber);
    font-family: 'VT323', monospace;
    font-size: 24px;
    outline: none;
    letter-spacing: 1px;
    text-shadow: 0 0 1px var(--amber);
}

.processing-indicator {
    padding: 15px;
    text-align: center;
    background-color: var(--bg-black);
    border: 2px solid var(--amber-dim);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    body {
        font-size: 18px;
        padding: 10px;
    }

    .crt-container {
        width: 100%;
        max-width: 100%;
        padding: 10px;
        border-width: 2px;
        box-sizing: border-box;
    }

    .terminal-view {
        min-height: 90vh;
    }

    .terminal-main {
        max-width: 100%;
        overflow-x: hidden;
    }

    .terminal-header {
        font-size: 14px;
        padding: 8px 10px;
        letter-spacing: 1px;
        word-wrap: break-word;
    }

    .terminal-footer {
        font-size: 12px;
        padding: 6px 10px;
    }

    .footer-text {
        letter-spacing: 1px;
        font-size: 11px;
    }

    .logo-title {
        font-size: 36px;
        letter-spacing: 6px;
    }

    .logo-subtitle {
        font-size: 14px;
        letter-spacing: 2px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .logo-box {
        max-width: 100%;
        padding: 20px 10px;
        box-sizing: border-box;
    }

    .terminal-section {
        padding: 15px 10px;
        margin: 20px 0;
    }

    .section-title {
        font-size: 20px;
        letter-spacing: 1px;
    }

    .status-line {
        font-size: 16px;
        word-wrap: break-word;
    }

    .crt-button {
        font-size: 18px;
        padding: 12px 20px;
        letter-spacing: 1px;
    }

    .crt-button.small {
        font-size: 16px;
        padding: 10px 15px;
        margin: 3px;
        display: block;
        width: 100%;
    }

    .ascii-art {
        font-size: 10px;
    }

    .invite-box {
        flex-direction: column;
        gap: 10px;
    }

    .invite-input {
        font-size: 14px;
        padding: 8px 10px;
        width: 100%;
    }

    .terminal-input {
        font-size: 18px;
    }

    .player-item {
        padding: 10px;
    }

    .player-name {
        font-size: 18px;
    }

    .player-status {
        font-size: 15px;
    }

    .progress-bar {
        font-size: 12px;
    }

    .progress-text {
        font-size: 14px;
    }

    .chat-log {
        padding: 15px 10px;
        font-size: 20px;
    }

    .actuary-message, .subject-message {
        font-size: 21px;
    }

    .message-input {
        font-size: 22px;
    }

    .prompt {
        font-size: 26px;
    }

    .input-label {
        font-size: 18px;
    }

    .info-text {
        font-size: 16px;
    }

    .host-content,
    .dashboard-content,
    .join-content,
    .password-content {
        padding: 10px;
    }

    /* Prevent viewport breaking on banners */
    .join-banner, .access-banner {
        font-size: 10px;
        overflow-x: auto;
        max-width: 100%;
    }

    .join-banner pre, .access-banner pre {
        max-width: 100%;
        overflow-x: auto;
    }

    /* Ensure all content respects viewport */
    .terminal-section {
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    .status-line {
        max-width: 100%;
        overflow-wrap: break-word;
    }

    .input-section {
        max-width: 100%;
    }

    .terminal-input {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Password page specific */
    .password-input-wrapper {
        max-width: 100%;
        box-sizing: border-box;
    }

    .password-input {
        max-width: 100%;
        min-width: 0;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

/* ========================================
   PROGRESS INDICATOR (20 SQUARES)
   ======================================== */

.progress-indicator {
    margin-top: 20px;
    padding: 15px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.progress-squares {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.square {
    width: 18px;
    height: 18px;
    background-color: #222;
    border: 2px solid var(--amber-dim);
    transition: all 0.3s ease;
    box-shadow:
        0 0 3px rgba(255, 176, 0, 0.3),
        inset 0 0 5px rgba(0, 0, 0, 0.8);
}

.square.lit {
    background-color: var(--amber-bright);
    border-color: var(--amber-bright);
    box-shadow:
        0 0 8px var(--amber-bright),
        inset 0 0 3px rgba(255, 215, 0, 0.8);
    animation: glow-pulse 1.5s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        box-shadow:
            0 0 8px var(--amber-bright),
            inset 0 0 3px rgba(255, 215, 0, 0.8);
    }
    50% {
        box-shadow:
            0 0 12px var(--amber-bright),
            inset 0 0 5px rgba(255, 215, 0, 1);
    }
}

/* ========================================
   PDF DOWNLOAD LINK STYLING
   ======================================== */

.pdf-download-link,
.player-download-link {
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: bold;
    transition: color 0.2s ease;
    margin-left: 10px;
}

.pdf-download-link:hover,
.player-download-link:hover {
    color: var(--amber) !important;
    text-shadow: 0 0 4px var(--amber);
}

.pdf-download-link:visited,
.player-download-link:visited {
    color: #ffffff !important;
}

.pdf-download-link:active,
.player-download-link:active {
    color: #ffffff !important;
}
