/* Oui ça a été fais avec Claude code parce que j'aime pas
le front
Signé : ex_ode
*/

:root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-2: #1c2230;
    --border: #30363d;
    --text: #e6edf3;
    --text-dim: #8b949e;

    --online: #3fb950;
    --error: #f85149;
    --offline: #f0883e;
    --closed: #8b949e;
    --unknown: #484f58;

    --radius: 10px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: ui-sans-serif, system-ui, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

.gate {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 16px;
}

.gate form {
    width: min(360px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    display: grid;
    gap: 14px;
}

.gate h1 {
    margin: 0;
    font-size: 20px;
}

.gate p {
    margin: 0;
    color: var(--text-dim);
    font-size: 13px;
}

input[type="password"],
input[type="search"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
}

input:focus-visible,
button:focus-visible {
    outline: 2px solid #58a6ff;
    outline-offset: 1px;
}

button {
    padding: 10px 14px;
    background: #238636;
    border: 1px solid #2ea043;
    border-radius: 8px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

button:hover {
    background: #2ea043;
}

button.ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text-dim);
    font-weight: 500;
}

button.ghost:hover {
    background: var(--surface-2);
    color: var(--text);
}

.gate .message {
    min-height: 20px;
    color: var(--error);
    font-size: 13px;
}

header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    padding: 14px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

header h1 {
    margin: 0;
    font-size: 17px;
    white-space: nowrap;
}

.link-state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-dim);
}

.link-state .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--offline);
}

.link-state.live .dot {
    background: var(--online);
}

.counters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-inline-start: auto;
}

.counter {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-dim);
}

.counter[aria-pressed="true"] {
    color: var(--text);
    border-color: #58a6ff;
}

.counter .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.counter b {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

main {
    padding: 20px;
}

.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.toolbar input {
    max-width: 320px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.card {
    position: relative;
    padding: 14px 16px 14px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    overflow: hidden;
    text-align: start;
    color: inherit;
    font: inherit;
    display: block;
    width: 100%;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--status-color, var(--unknown));
}

.card:hover {
    border-color: #58a6ff;
}

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

.card-name {
    font-weight: 600;
}

.card-status {
    font-size: 12px;
    font-weight: 600;
    color: var(--status-color, var(--text-dim));
    white-space: nowrap;
}

.card-line {
    font-size: 13px;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 8px 0 6px;
    font-size: 13px;
    min-width: 0;
}

.avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--surface-2);
    flex: none;
}

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

.player-handle {
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-empty {
    color: var(--text-dim);
    font-style: italic;
}

.badge-unverified {
    flex: none;
    padding: 1px 7px;
    background: rgba(240, 136, 62, 0.15);
    border: 1px solid rgba(240, 136, 62, 0.4);
    border-radius: 999px;
    color: var(--offline);
    font-size: 11px;
    font-weight: 600;
}

.card-warning {
    margin-top: 8px;
    padding: 7px 9px;
    background: rgba(240, 136, 62, 0.12);
    border-radius: 6px;
    font-size: 12px;
    color: #f7c396;
}

.card-error {
    margin-top: 8px;
    padding: 7px 9px;
    background: rgba(248, 81, 73, 0.12);
    border-radius: 6px;
    font-size: 12px;
    color: #ffb4ae;
}

.card-error code {
    color: var(--error);
    font-weight: 700;
}

.empty {
    padding: 48px 0;
    text-align: center;
    color: var(--text-dim);
}

dialog {
    width: min(560px, calc(100vw - 32px));
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
}

dialog::backdrop {
    background: rgba(1, 4, 9, 0.7);
}

.detail-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.detail-head h2 {
    margin: 0;
    font-size: 17px;
}

.detail-head .card-status {
    margin-inline-start: auto;
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border);
}

button.danger {
    background: #da3633;
    border-color: #f85149;
    color: #fff;
}

button.danger:hover {
    background: #f85149;
}

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

button.ghost:disabled:hover {
    background: transparent;
    color: var(--text-dim);
}

button.danger:disabled:hover {
    background: #da3633;
}

.action-message {
    font-size: 13px;
    color: var(--text-dim);
}

.action-message.failed {
    color: var(--error);
}

.detail-body {
    padding: 16px 20px 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.detail-body h3 {
    margin: 20px 0 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
}

.detail-body h3:first-child {
    margin-top: 0;
}

dl.facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 16px;
    margin: 0;
    font-size: 14px;
}

dl.facts dt {
    color: var(--text-dim);
}

dl.facts dd {
    margin: 0;
    word-break: break-word;
}

.timeline {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
}

.timeline li {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.timeline time {
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

.timeline .kind-error {
    color: #ffb4ae;
}

.timeline .kind-connected {
    color: #8ee79a;
}

.timeline .kind-disconnected,
.timeline .kind-closed {
    color: #f0c08e;
}

.timeline .kind-identified {
    color: #a6a0f5;
}

.timeline .kind-logout {
    color: var(--text-dim);
}

@media (max-width: 600px) {
    .counters {
        margin-inline-start: 0;
        width: 100%;
    }
}