:root {
    --bg: #0a0a0a;
    --surface: #141414;
    --text: #e5e5e5;
    --text-dim: #737373;
    --alert: #ef4444;
    --success: #22c55e;
    --info: #3b82f6;
    --border: #262626;
    --font: 'JetBrains Mono', 'SF Mono', 'Monaco', monospace;
}

@keyframes hal-glow {
    0%, 100% { 
        background-color: var(--bg);
    }
    50% { 
        background-color: #1a0000;
    }
}

.hal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    background: radial-gradient(ellipse at center, rgba(239, 68, 68, 0.4) 0%, rgba(139, 0, 0, 0.6) 50%, rgba(50, 0, 0, 0.8) 100%);
    transition: opacity 0.3s ease;
}

.hal-overlay.active {
    animation: hal-pulse 0.8s ease-in-out 3;
}

@keyframes hal-pulse {
    0%, 100% { 
        opacity: 0;
    }
    50% { 
        opacity: 1;
    }
}

body.alert-active {
    animation: hal-glow 0.8s ease-in-out 3;
}

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

html, body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 48px 24px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

header {
    margin-bottom: 48px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.title-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.settings-link {
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    transition: color 0.15s ease;
}

.settings-link:hover {
    color: var(--text);
}

.sound-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 6px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.sound-toggle:hover {
    color: var(--text);
    border-color: var(--text-dim);
}

.logout-link {
    font-size: 10px;
    letter-spacing: 0.15em;
    color: var(--text-dim);
    text-decoration: none;
    text-transform: uppercase;
    transition: color 0.15s ease;
}

.logout-link:hover {
    color: var(--text);
}

h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.version {
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.1em;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    font-size: 10px;
    color: var(--text-dim);
    transition: color 0.2s;
}

.status-indicator.active {
    color: var(--success);
}

.status-indicator.connected {
    color: var(--success);
}

.status-indicator.error {
    color: var(--alert);
}

.status-text {
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    text-transform: uppercase;
}

section {
    margin-bottom: 32px;
}

.config {
    border: 1px solid var(--border);
    padding: 24px;
}

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.config-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.label {
    font-size: 10px;
    letter-spacing: 0.15em;
    color: var(--text-dim);
    text-transform: uppercase;
}

.value {
    font-size: 13px;
    color: var(--text);
}

.countdown {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

.mode-switch {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mode-label {
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--border);
}

.mode-btn {
    background: transparent;
    border: none;
    border-right: 1px solid var(--border);
    padding: 16px 24px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-family: var(--font);
    color: var(--text-dim);
}

.mode-btn:last-child {
    border-right: none;
}

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

.mode-btn:hover:not(.active) {
    background: var(--surface);
    color: var(--text);
}

.mode-value {
    font-size: 16px;
}

.mode-name {
    font-size: 9px;
    letter-spacing: 0.15em;
}

.mode-status {
    font-size: 11px;
    color: var(--text-dim);
}

.mode-status.aggressive {
    color: var(--alert);
}

.controls {
    display: flex;
    gap: 0;
}

.controls button {
    flex: 1;
}

button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 24px;
    font-family: var(--font);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: border-color 0.2s, opacity 0.2s;
    border-radius: 0;
}

button:hover:not(:disabled) {
    border-color: var(--text);
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

button:active:not(:disabled) {
    background: var(--surface);
}

.activity {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
}

.section-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.activity-log {
    flex: 1;
    padding: 16px 24px;
    overflow-y: auto;
    max-height: 400px;
    background: var(--surface);
}

.day-group {
    margin-bottom: 24px;
}

.day-group:last-child {
    margin-bottom: 0;
}

.day-header {
    font-size: 11px;
    letter-spacing: 0.2em;
    color: var(--text-dim);
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.day-entries {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.headshot-spacer {
    width: 32px;
    flex-shrink: 0;
}

.log-entry {
    font-size: 12px;
    line-height: 1.8;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry.with-player {
    padding: 10px 0;
}

.entry-time {
    font-size: 11px;
    color: var(--text-dim);
    flex-shrink: 0;
}

.entry-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.entry-headshot {
    width: 32px;
    height: 32px;
    object-fit: cover;
    background: var(--surface);
    flex-shrink: 0;
}

.entry-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.entry-player {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entry-action {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.entry-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-entry.alert {
    color: var(--alert);
}

.log-entry.alert .entry-player {
    color: var(--alert);
}

.log-entry.error {
    color: var(--alert);
}

.log-entry.success {
    color: var(--success);
}

.log-entry.success .entry-player {
    color: var(--success);
}

.log-entry.info {
    color: var(--info);
}

.log-entry.info .entry-player {
    color: var(--info);
}

.log-entry.dim {
    color: var(--text-dim);
}

footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.footer-text {
    font-size: 10px;
    letter-spacing: 0.15em;
    color: var(--text-dim);
    text-transform: uppercase;
}

@media (max-width: 480px) {
    .container {
        padding: 24px 16px;
    }
    
    .config-grid {
        grid-template-columns: 1fr;
    }
    
    .controls {
        flex-direction: column;
    }
    
    button {
        width: 100%;
    }
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
}

.login-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255,255,255,0.008) 2px,
        rgba(255,255,255,0.008) 4px
    );
    pointer-events: none;
    z-index: 1000;
}

.corner-mark {
    position: fixed;
    width: 24px;
    height: 24px;
    border: 1px solid var(--border);
    pointer-events: none;
    z-index: 10;
}

.corner-mark::before,
.corner-mark::after {
    content: '';
    position: absolute;
    background: var(--border);
}

.corner-mark.tl { top: 16px; left: 16px; border-right: none; border-bottom: none; }
.corner-mark.tr { top: 16px; right: 16px; border-left: none; border-bottom: none; }
.corner-mark.bl { bottom: 16px; left: 16px; border-right: none; border-top: none; }
.corner-mark.br { bottom: 16px; right: 16px; border-left: none; border-top: none; }

.corner-mark.tl::before { top: 11px; left: -1px; width: 8px; height: 1px; }
.corner-mark.tl::after { top: -1px; left: 11px; width: 1px; height: 8px; }
.corner-mark.tr::before { top: 11px; right: -1px; width: 8px; height: 1px; }
.corner-mark.tr::after { top: -1px; right: 11px; width: 1px; height: 8px; }
.corner-mark.bl::before { bottom: 11px; left: -1px; width: 8px; height: 1px; }
.corner-mark.bl::after { bottom: -1px; left: 11px; width: 1px; height: 8px; }
.corner-mark.br::before { bottom: 11px; right: -1px; width: 8px; height: 1px; }
.corner-mark.br::after { bottom: -1px; right: 11px; width: 1px; height: 8px; }

.system-status {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 9px;
    letter-spacing: 0.2em;
    color: var(--text-dim);
    text-transform: uppercase;
    z-index: 10;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.login-container {
    width: 100%;
    max-width: 360px;
    padding: 48px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-header {
    text-align: center;
    margin-bottom: 48px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 10px;
    letter-spacing: 0.15em;
    color: var(--text-dim);
    text-transform: uppercase;
}

.login-form {
    width: 100%;
}

.input-group {
    margin-bottom: 24px;
}

.input-group label {
    display: block;
    font-size: 10px;
    letter-spacing: 0.15em;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
}

.input-group input:focus {
    outline: none;
    border-color: var(--text-dim);
}

.login-error {
    font-size: 11px;
    color: var(--alert);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 24px;
    text-align: center;
}

.login-button {
    width: 100%;
    padding: 14px 24px;
    background: var(--text);
    border: 1px solid var(--text);
    color: var(--bg);
    font-family: var(--font);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s ease;
}

.login-button:hover {
    background: transparent;
    color: var(--text);
}

.login-version {
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 0.15em;
    margin-top: 48px;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    flex: 1;
    padding-right: 44px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.toggle-password:hover {
    color: var(--text);
}

.toggle-password svg {
    width: 16px;
    height: 16px;
}

.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.admin-content {
    background: var(--surface);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 440px;
    max-height: 80vh;
    overflow-y: auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.admin-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--text);
}

.admin-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.admin-close:hover {
    color: var(--text);
}

.admin-section {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.admin-section:last-child {
    border-bottom: none;
}

.admin-section-header {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.15em;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.admin-list {
    margin-bottom: 16px;
}

.admin-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    margin-bottom: 6px;
}

.admin-item.dim {
    color: var(--text-dim);
    font-size: 11px;
}

.admin-item-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    flex: 1;
}

.admin-item-phone {
    font-size: 11px;
    color: var(--text-dim);
}

.admin-delete {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.admin-delete:hover {
    color: var(--alert);
}

.admin-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-input {
    flex: 1;
    min-width: 100px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font);
    font-size: 12px;
    padding: 10px 12px;
}

.admin-input::placeholder {
    color: var(--text-dim);
}

.admin-input:focus {
    outline: none;
    border-color: var(--text-dim);
}

.admin-btn {
    background: var(--text);
    color: var(--bg);
    border: none;
    font-family: var(--font);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    padding: 10px 16px;
    cursor: pointer;
    white-space: nowrap;
}

.admin-btn:hover {
    background: var(--text-dim);
}

.admin-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: var(--text-dim);
    cursor: pointer;
    white-space: nowrap;
}

.admin-checkbox input {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.admin-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.admin-toggle input {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.admin-toggle-label {
    font-size: 9px;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    min-width: 40px;
}

.header-icon-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-icon-btn:hover {
    color: var(--text);
}

.archive-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 500px;
    height: 100vh;
    background: var(--bg);
    border-left: 1px solid var(--border);
    transition: right 0.3s ease;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.archive-panel.open {
    right: 0;
}

.archive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.archive-header h2 {
    font-size: 11px;
    letter-spacing: 0.2em;
    font-weight: 400;
    color: var(--text);
    margin: 0;
}

.archive-close {
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    font-family: var(--font);
    line-height: 1;
}

.archive-close:hover {
    background: var(--border);
}

.archive-controls {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.filter-label,
.search-label {
    font-size: 9px;
    letter-spacing: 0.15em;
    color: var(--text-dim);
    display: block;
    margin-bottom: 8px;
}

.filter-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid var(--border);
}

.filter-btn {
    background: transparent;
    border: none;
    border-right: 1px solid var(--border);
    padding: 12px 8px;
    font-family: var(--font);
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    cursor: pointer;
}

.filter-btn:last-child {
    border-right: none;
}

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

.search-wrapper {
    position: relative;
}

#archive-search {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border);
    padding: 12px 16px;
    font-family: var(--font);
    font-size: 12px;
    color: var(--text);
    box-sizing: border-box;
}

#archive-search::placeholder {
    color: var(--text-dim);
}

#archive-search:focus {
    outline: none;
    border-color: var(--text-dim);
}

.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    max-height: 240px;
    overflow-y: auto;
    display: none;
    z-index: 10;
}

.suggestions.open {
    display: block;
}

.suggestion-item {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background: var(--border);
}

.suggestion-img {
    width: 28px;
    height: 28px;
    object-fit: cover;
}

.suggestion-name {
    font-size: 12px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-type {
    font-size: 9px;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.archive-list {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.archive-date-header {
    font-size: 10px;
    letter-spacing: 0.15em;
    color: var(--text-dim);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.archive-item {
    display: grid;
    grid-template-columns: 60px 20px 36px 1fr;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.archive-time {
    font-size: 11px;
    color: var(--text-dim);
}

.archive-icon {
    color: var(--text-dim);
}

.archive-img {
    width: 32px;
    height: 32px;
    object-fit: cover;
}

.archive-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.archive-player {
    font-size: 12px;
    color: var(--text);
}

.archive-team {
    font-size: 10px;
    color: var(--text-dim);
}

.archive-empty {
    color: var(--text-dim);
    font-size: 11px;
    text-align: center;
    padding: 48px 24px;
}

.hal-alert {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: hal-pulse 2s ease-in-out infinite;
}

@keyframes hal-pulse {
    0%, 100% { background: rgba(139, 0, 0, 0.95); }
    50% { background: rgba(50, 0, 0, 0.98); }
}

.hal-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.hal-eye {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ff6666, #ff0000 40%, #990000 70%, #330000);
    box-shadow: 
        0 0 60px rgba(255, 0, 0, 0.8),
        0 0 120px rgba(255, 0, 0, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.5);
    animation: hal-eye-glow 2s ease-in-out infinite;
}

@keyframes hal-eye-glow {
    0%, 100% { 
        box-shadow: 
            0 0 60px rgba(255, 0, 0, 0.8),
            0 0 120px rgba(255, 0, 0, 0.5),
            inset 0 0 30px rgba(0, 0, 0, 0.5);
    }
    50% { 
        box-shadow: 
            0 0 80px rgba(255, 0, 0, 1),
            0 0 160px rgba(255, 0, 0, 0.7),
            inset 0 0 20px rgba(0, 0, 0, 0.3);
    }
}

.hal-label {
    font-size: 12px;
    letter-spacing: 0.4em;
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    margin-top: 20px;
}

.hal-player {
    font-size: 32px;
    letter-spacing: 0.15em;
    color: #fff;
    font-weight: 400;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.8);
}

.hal-team {
    font-size: 14px;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.7);
}

.hal-acknowledge {
    margin-top: 40px;
    padding: 20px 60px;
    background: transparent;
    border: 2px solid #fff;
    color: #fff;
    font-family: var(--font);
    font-size: 14px;
    letter-spacing: 0.3em;
    cursor: pointer;
    transition: all 0.2s;
}

.hal-acknowledge:hover {
    background: #fff;
    color: #000;
}

.hal-acknowledge:active {
    transform: scale(0.98);
}
