@font-face {
    font-family: "Neue Montreal";
    font-weight: 700;
    font-style: normal;
    src: url("/OTNeueMontreal-BoldSemiSqueezed.otf") format("opentype");
}

@font-face {
    font-family: "Neue Montreal";
    font-weight: 500;
    font-style: normal;
    src: url("/OTNeueMontreal-MediumSqueezed.otf") format("opentype");
}

@font-face {
    font-family: "Neue Montreal";
    font-weight: 200;
    font-style: italic;
    src: url("/OTNeueMontreal-ThinItalicExtraSqueezed.otf") format("opentype");
}

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #2a2a3e;
    --bg-hover: #3a3a4e;
    --border: #2a2a4e;
    --text-primary: #e0e0e0;
    --text-secondary: #888;
    --text-muted: #666;
    --accent: #ff6b6b;
    --accent-hover: #ff5252;
    --accent-glow: rgba(255, 107, 107, 0.3);
    --highlight: #7f7fff;
    --highlight-bg: #2a2a5e;
    --success: #4caf50;
    --gold: #ffd700;
    --text-inverse: #fff;
    --text-muted-strong: #555;
    --text-subtle: #aaa;
    --text-button: #ccc;
    --font-display:
        "Neue Montreal", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        sans-serif;
    --font-body:
        "Neue Montreal", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        sans-serif;
    --font-callout:
        "Neue Montreal", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        sans-serif;
}

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

body {
    font-family: var(--font-body);
    font-weight: 500;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding-top: 2rem;
}

.view {
    display: none;
}
.view.active {
    display: block;
}

h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--accent);
}

/* --- Name Dialog --- */

#name-dialog {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    max-width: 420px;
    width: 90vw;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#name-dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
}

#name-dialog h2 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    color: var(--accent);
}

#name-dialog p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-bottom: 1.2rem;
}

#name-input {
    width: 100%;
    padding: 0.6rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1.4rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.6rem;
}

#name-input:focus {
    outline: none;
    border-color: var(--accent);
}

#pick-random-btn {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    color: var(--text-button);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}
#pick-random-btn:hover {
    background: var(--bg-hover);
}

#set-name-btn {
    width: 100%;
    padding: 0.7rem;
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    border-radius: 8px;
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
}
#set-name-btn:hover {
    background: var(--accent-hover);
}

/* --- Lobby --- */
#lobby-view {
    width: 600px;
}

#player-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem 0.8rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 1.25rem;
}

#display-name-label {
    color: var(--highlight);
    font-weight: bold;
}

#stats-display {
    color: var(--text-secondary);
    font-size: 1rem;
}

#lobby-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#lobby-controls button {
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 1.25rem;
    cursor: pointer;
}

#start-battle-btn {
    background: var(--accent);
    color: var(--text-inverse);
    font-weight: bold;
}

#start-battle-btn:hover {
    background: var(--accent-hover);
}

#lobby-controls button:last-child {
    background: var(--bg-tertiary);
    color: var(--text-button);
}
#lobby-controls button:last-child:hover {
    background: var(--bg-hover);
}

#battle-list table {
    width: 100%;
    border-collapse: collapse;
}

#battle-list th,
#battle-list td {
    padding: 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

#battle-list th {
    color: var(--text-secondary);
    font-weight: normal;
    font-size: 1rem;
    text-transform: uppercase;
}

#battle-rows tr {
    cursor: pointer;
    transition: background 0.15s;
}
#battle-rows tr:hover {
    background: var(--bg-secondary);
}
#battle-rows tr.active-battle td:first-child {
    border-left: 3px solid var(--accent);
}

#no-battles {
    font-family: var(--font-callout);
    font-weight: 200;
    font-style: italic;
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.hint {
    font-family: var(--font-callout);
    font-weight: 200;
    font-style: italic;
    color: var(--text-muted-strong);
    font-size: 1rem;
    text-align: center;
    margin-top: 1rem;
}

/* --- Battle --- */
#battle-view {
    width: 700px;
}

#battle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

#battle-id-label {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

#battle-main {
    display: flex;
    gap: 1.5rem;
}

#click-area {
    flex: 1;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    cursor: pointer;
    user-select: none;
    transition:
        background 0.1s,
        transform 0.05s;
    position: relative;
    overflow: hidden;
}

#click-area:active {
    background: var(--border);
    transform: scale(0.98);
}

#click-area.clicked {
    animation: clickflash 0.08s ease-out;
}

@keyframes clickflash {
    0% {
        background: var(--bg-hover);
    }
    100% {
        background: var(--bg-secondary);
    }
}

#number-display {
    font-size: 8rem;
    font-weight: 800;
    color: var(--accent);
    user-select: none;
}

#participants-panel {
    width: 200px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1rem;
}

#participants-panel h3 {
    font-size: 1.125rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

#participant-list {
    list-style: none;
}

#participant-list li {
    padding: 0.3rem 0;
    font-size: 1.25rem;
    color: var(--text-button);
}

#battle-log {
    margin-top: 1rem;
}

#battle-log h3 {
    font-size: 1.125rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

#log-entries {
    list-style: none;
    max-height: 120px;
    overflow-y: auto;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

#log-entries li {
    padding: 0.15rem 0;
}

#log-entries li .clicker-name {
    color: var(--highlight);
}

/* --- Results --- */
#results-view {
    width: 500px;
    text-align: center;
}

#results-view h1 {
    color: var(--gold);
}

#winner-title {
    font-size: 1.5rem;
    font-family: var(--font-callout);
    font-weight: 200;
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

#winner-announcement {
    font-size: 2rem;
    margin: 1rem 0;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--gold);
}

#final-blow {
    font-family: var(--font-callout);
    font-weight: 200;
    font-style: italic;
    color: var(--text-subtle);
    margin-bottom: 1rem;
}

#click-breakdown h3 {
    color: var(--text-muted);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

#click-stats {
    list-style: none;
    display: inline-block;
    text-align: left;
    margin-bottom: 1rem;
}

#click-stats li {
    padding: 0.3rem 0;
}

#click-stats li .stat-player {
    color: var(--highlight);
}
#click-stats li .stat-count {
    color: var(--accent);
    font-weight: bold;
}

#duration-display {
    font-family: var(--font-callout);
    font-weight: 200;
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

#results-view button {
    padding: 0.6rem 2rem;
    background: var(--bg-tertiary);
    color: var(--text-button);
    border: none;
    border-radius: 8px;
    font-size: 1.5rem;
    cursor: pointer;
}
#results-view button:hover {
    background: var(--bg-hover);
}

/* --- Status Bar --- */
#status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 0.4rem;
    font-size: 1rem;
    font-family: var(--font-callout);
    font-weight: 200;
    font-style: italic;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}
