/* ── Palette variables ──────────────────────────────────────── */
:root {
    --bg:            #020b03;
    --highlight:     rgb(199, 255, 219);
    --glow:          rgb(41, 242, 107);
    --muted:         rgb(79, 158, 94);
    --border:        rgb(28, 148, 61);
    --panel-bg:      rgba(2, 14, 4, 0.92);
    --panel-border:  rgba(28, 148, 61, 0.7);
    --input-bg:      rgba(4, 18, 6, 0.95);
    --btn-bg:        rgba(6, 22, 8, 0.9);
    --btn-hover-bg:  rgba(10, 32, 12, 0.95);
    --btn-active-bg: rgba(14, 44, 18, 1.0);
    --font:          'Courier New', monospace;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%; height: 100%;
    background: var(--bg);
    color: var(--glow);
    font-family: var(--font);
    font-size: 14px;
    overflow: hidden;
}

/* ── Matrix rain canvas ─────────────────────────────────────── */
#matrix-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ── Page wrapper ───────────────────────────────────────────── */
.page {
    position: relative;
    z-index: 1;
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Auth card (login / register) ───────────────────────────── */
.auth-card {
    width: 340px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    outline: 1px solid rgba(28, 148, 61, 0.12);
    outline-offset: -6px;
    box-shadow: 0 0 32px rgba(41, 242, 107, 0.05),
                0 0  8px rgba(41, 242, 107, 0.04) inset;
    padding: 28px 28px 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
}

/* Corner bracket decorations */
.auth-corner {
    position: absolute;
    width: 12px;
    height: 12px;
    opacity: 0.45;
}
.auth-corner.tl { top: 9px;    left: 9px;    border-top: 1px solid var(--glow); border-left:  1px solid var(--glow); }
.auth-corner.tr { top: 9px;    right: 9px;   border-top: 1px solid var(--glow); border-right: 1px solid var(--glow); }
.auth-corner.bl { bottom: 9px; left: 9px;    border-bottom: 1px solid var(--glow); border-left:  1px solid var(--glow); }
.auth-corner.br { bottom: 9px; right: 9px;   border-bottom: 1px solid var(--glow); border-right: 1px solid var(--glow); }

/* Brand block */
.auth-brand-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
}

.auth-logo {
    width: 52px;
    height: 52px;
    filter: drop-shadow(0 0 8px rgba(41, 242, 107, 0.35));
    margin-bottom: 2px;
}

.auth-card .brand {
    font-size: 22px;
    letter-spacing: 5px;
    color: var(--highlight);
    text-shadow: 0 0 14px rgba(41, 242, 107, 0.45);
    text-transform: lowercase;
}

/* Subtitle under brand */
.auth-subtitle {
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--muted);
    opacity: 0.7;
    text-transform: lowercase;
}

/* Gradient separator */
.auth-sep {
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(41, 242, 107, 0.5), transparent);
    margin: -4px -4px 0;
    flex-shrink: 0;
}

/* Bottom status bar */
.auth-status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    letter-spacing: 1px;
    color: rgba(79, 158, 94, 0.45);
    border-top: 1px solid rgba(28, 148, 61, 0.18);
    padding-top: 12px;
    margin-top: -4px;
}

.auth-status-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--glow);
    box-shadow: 0 0 5px rgba(41, 242, 107, 0.8);
    flex-shrink: 0;
    animation: auth-dot-pulse 2.5s ease-in-out infinite;
}

@keyframes auth-dot-pulse {
    0%, 100% { opacity: 1;   box-shadow: 0 0 5px rgba(41, 242, 107, 0.8); }
    50%       { opacity: 0.2; box-shadow: 0 0 2px rgba(41, 242, 107, 0.2); }
}

/* ── Dashboard layout ───────────────────────────────────────── */
.dashboard {
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    gap: 12px;
}

.top-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 14px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
}

.top-bar-logo {
    width: 26px;
    height: 26px;
    filter: drop-shadow(0 0 5px rgba(41, 242, 107, 0.3));
    flex-shrink: 0;
}

.top-bar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    letter-spacing: 3px;
    color: var(--highlight);
    text-shadow: 0 0 10px rgba(41, 242, 107, 0.35);
    flex: 1;
}

.top-bar .username {
    color: var(--muted);
    font-size: 12px;
}

.panels {
    display: flex;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

.panel {
    flex: 1;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}

.panel-title {
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--muted);
    text-transform: uppercase;
    border-bottom: 1px solid rgba(28, 148, 61, 0.3);
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.field-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.field-label {
    color: var(--muted);
    font-size: 12px;
    min-width: 80px;
    flex-shrink: 0;
}

.field-value {
    color: var(--highlight);
    font-size: 13px;
    text-align: right;
    word-break: break-all;
}

.plan-badge {
    display: inline-block;
    color: var(--glow);
    border: 1px solid var(--border);
    padding: 2px 8px;
    font-size: 11px;
    letter-spacing: 1px;
}

/* ── Form fields ────────────────────────────────────────────── */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--muted);
    text-transform: uppercase;
}

.field input {
    background: var(--input-bg);
    border: 1px solid var(--panel-border);
    color: var(--highlight);
    font-family: var(--font);
    font-size: 13px;
    padding: 8px 10px;
    outline: none;
    width: 100%;
    transition: border-color 0.15s;
}

.field input:focus {
    border-color: var(--glow);
    box-shadow: 0 0 6px rgba(41, 242, 107, 0.15);
}

.field input::placeholder {
    color: rgba(79, 158, 94, 0.5);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    background: var(--btn-bg);
    border: 1px solid var(--border);
    color: var(--glow);
    font-family: var(--font);
    font-size: 13px;
    letter-spacing: 2px;
    padding: 9px 16px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    width: 100%;
    text-align: center;
    text-transform: uppercase;
    text-decoration: none;
    display: block;
}

.btn:hover {
    background: var(--btn-hover-bg);
    border-color: var(--glow);
    color: var(--highlight);
}

.btn:active {
    background: var(--btn-active-bg);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-small {
    width: auto;
    padding: 6px 12px;
    font-size: 11px;
    display: inline-block;
}

/* ── Messages ───────────────────────────────────────────────── */
.msg {
    font-size: 12px;
    min-height: 18px;
    text-align: center;
}

.msg.error   { color: rgb(240, 90, 90); }
.msg.success { color: var(--glow); }

/* ── Links ──────────────────────────────────────────────────── */
a {
    color: var(--muted);
    text-decoration: none;
    font-size: 12px;
}

a:hover { color: var(--glow); }

.link-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
}

/* ── Announcement banner ────────────────────────────────────── */
.announcement {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: 12px;
    border: 1px solid;
    flex-shrink: 0;
}

.announcement.hidden { display: none; }

.announcement.type-info    { background: rgba(4, 30, 8, 0.95);  border-color: var(--border);       color: var(--highlight); }
.announcement.type-warning { background: rgba(30, 22, 2, 0.95); border-color: rgb(180, 130, 20);   color: rgb(255, 220, 80); }
.announcement.type-danger  { background: rgba(30, 4, 4, 0.95);  border-color: rgb(160, 40, 40);    color: rgb(255, 120, 120); }

.announcement-link {
    margin-left: 6px;
    text-decoration: underline;
    font-size: 12px;
    color: inherit;
    opacity: 0.85;
    flex-shrink: 0;
}

.announcement-link:hover { opacity: 1; }
.announcement-link.hidden { display: none; }

.announcement-dismiss {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    font-size: 12px;
    padding: 0 2px;
    flex-shrink: 0;
}

.announcement-dismiss:hover { opacity: 1; }

/* ── Key copy ───────────────────────────────────────────────── */
.key-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-copy {
    background: none;
    border: 1px solid rgba(28, 148, 61, 0.4);
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    padding: 1px 5px;
    line-height: 1;
    transition: color 0.12s, border-color 0.12s;
}

.btn-copy:hover { color: var(--glow); border-color: var(--glow); }

.key-copy-msg {
    font-size: 11px;
    color: var(--glow);
    text-align: right;
    min-height: 14px;
}

/* ── Days remaining bar ─────────────────────────────────────── */
.days-bar-container {
    height: 4px;
    background: rgba(28, 148, 61, 0.12);
    border: 1px solid rgba(28, 148, 61, 0.2);
    overflow: hidden;
}

.days-bar-fill {
    height: 100%;
    width: 0;
    transition: width 0.5s ease;
}

.days-bar-fill.good     { background: var(--glow);           box-shadow: 0 0 6px rgba(41,  242, 107, 0.4); }
.days-bar-fill.warn     { background: rgb(255, 200, 60);     box-shadow: 0 0 6px rgba(255, 200, 60,  0.4); }
.days-bar-fill.danger   { background: rgb(240, 80,  80);     box-shadow: 0 0 6px rgba(240, 80,  80,  0.4); }
.days-bar-fill.lifetime { background: var(--glow);           box-shadow: 0 0 8px rgba(41,  242, 107, 0.5); }

.days-bar-label {
    font-size: 11px;
    color: var(--muted);
    text-align: right;
}

/* ── Status dot ─────────────────────────────────────────────── */
.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

.status-dot.online  { background: var(--glow);        box-shadow: 0 0 5px rgba(41,  242, 107, 0.7); }
.status-dot.offline { background: rgb(240, 80,  80);  box-shadow: 0 0 5px rgba(240, 80,  80,  0.6); }

/* ── Changelog panel ────────────────────────────────────────── */
.changelog-panel {
    flex: 1;
    overflow-y: auto;
    gap: 0;
    /* standalone (outside bottom-row): cap height */
    max-height: 260px;
}

/* Inside bottom-row it fills available height naturally */
.bottom-row .changelog-panel {
    max-height: none;
}

.changelog-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 4px;
}

.changelog-loading {
    color: var(--muted);
    font-size: 12px;
}

.changelog-entry {}

.changelog-entry-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 6px;
}

.changelog-version {
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--glow);
    border: 1px solid var(--border);
    padding: 1px 7px;
}

.changelog-title {
    color: var(--highlight);
    font-size: 13px;
}

.changelog-date {
    color: var(--muted);
    font-size: 11px;
    margin-left: auto;
}

.changelog-items {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.changelog-items li {
    font-size: 12px;
    color: rgb(160, 220, 175);
    padding-left: 12px;
    position: relative;
}

.changelog-items li::before {
    content: '›';
    position: absolute;
    left: 0;
    color: var(--muted);
}

.changelog-divider {
    border: none;
    border-top: 1px solid rgba(28, 148, 61, 0.2);
    margin: 0;
}

/* ── Cooldown display ───────────────────────────────────────── */
#hwid-cooldown {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    margin-top: 6px;
}

/* ── Dashboard bottom row (changelog + chat) ────────────────── */
.bottom-row {
    display: flex;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

/* ── Chat panel ─────────────────────────────────────────────── */
.chat-panel {
    flex: 1.4;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    overflow: hidden;
    min-width: 0;
}

.chat-panel .panel-title {
    padding: 12px 14px 10px;
    flex-shrink: 0;
    margin-bottom: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-height: 0;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(28, 148, 61, 0.3); }

.chat-msg {
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-width: 88%;
}

.chat-msg.self {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-msg.other {
    align-self: flex-start;
    align-items: flex-start;
}

.chat-msg-meta {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 10px;
    color: var(--muted);
    opacity: 0.7;
}

.chat-msg.self .chat-msg-meta { flex-direction: row-reverse; }

.chat-msg-name {
    color: var(--glow);
    font-size: 10px;
    letter-spacing: 0.5px;
}

.chat-msg.self .chat-msg-name { color: rgb(130, 210, 255); }

.chat-msg-time { font-size: 9px; }

.chat-msg-bubble {
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1.4;
    word-break: break-word;
    border: 1px solid;
}

.chat-msg.other .chat-msg-bubble {
    background: rgba(4, 18, 6, 0.7);
    border-color: rgba(28, 148, 61, 0.35);
    color: var(--highlight);
}

.chat-msg.self .chat-msg-bubble {
    background: rgba(4, 18, 36, 0.7);
    border-color: rgba(60, 130, 200, 0.35);
    color: rgb(200, 230, 255);
}

.chat-divider-date {
    text-align: center;
    font-size: 10px;
    color: var(--muted);
    opacity: 0.5;
    margin: 4px 0;
    letter-spacing: 1px;
}

.chat-empty {
    color: var(--muted);
    font-size: 12px;
    text-align: center;
    margin: auto;
    opacity: 0.6;
}

.chat-input-row {
    display: flex;
    gap: 0;
    border-top: 1px solid rgba(28, 148, 61, 0.3);
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    background: var(--input-bg);
    border: none;
    border-right: 1px solid rgba(28, 148, 61, 0.3);
    color: var(--highlight);
    font-family: var(--font);
    font-size: 12px;
    padding: 9px 12px;
    outline: none;
    min-width: 0;
}

.chat-input::placeholder { color: rgba(79, 158, 94, 0.4); }
.chat-input:focus { background: rgba(4, 22, 6, 0.98); }

.chat-send-btn {
    background: var(--btn-bg);
    border: none;
    color: var(--glow);
    font-family: var(--font);
    font-size: 11px;
    letter-spacing: 1px;
    padding: 9px 14px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
    text-transform: uppercase;
}

.chat-send-btn:hover   { background: var(--btn-hover-bg); color: var(--highlight); }
.chat-send-btn:disabled { opacity: 0.35; cursor: not-allowed; }