:root {
    --bg: #0a0a0a;
    --fg: #00ff41;
    --dim: #007a1f;
    --accent: #00bfff;
    --warn: #ff6600;
    --border: #333;
    --input-bg: #111;
}

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

body {
    background: var(--bg);
    color: var(--fg);
    font-family: "Courier New", "Lucida Console", monospace;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

header {
    border-bottom: 1px solid var(--border);
    padding: 10px 0 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 { color: var(--accent); font-size: 20px; }

nav a {
    margin-left: 15px;
    color: var(--dim);
    font-size: 13px;
}
nav a:hover { color: var(--fg); }

.box {
    border: 1px solid var(--border);
    padding: 15px;
    margin-bottom: 15px;
}

.box h2 {
    color: var(--accent);
    font-size: 16px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}

input, textarea, select {
    background: var(--input-bg);
    color: var(--fg);
    border: 1px solid var(--border);
    padding: 8px;
    font-family: inherit;
    font-size: 14px;
    width: 100%;
    margin-bottom: 8px;
}

input:focus, textarea:focus { border-color: var(--accent); outline: none; }

textarea { min-height: 100px; resize: vertical; }

button, .btn {
    background: var(--dim);
    color: #000;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
}

button:hover, .btn:hover { background: var(--fg); }

.error { color: var(--warn); margin-bottom: 10px; }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
}

th { color: var(--accent); font-size: 12px; text-transform: uppercase; }

.meta { color: var(--dim); font-size: 12px; }

.post {
    border: 1px solid var(--border);
    margin-bottom: 10px;
    padding: 10px;
}

.post-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: var(--accent);
    font-size: 13px;
}

.post-body { white-space: pre-wrap; }

.breadcrumb {
    color: var(--dim);
    font-size: 12px;
    margin-bottom: 15px;
}

.breadcrumb a { color: var(--dim); }
.breadcrumb a:hover { color: var(--fg); }

.login-box {
    max-width: 400px;
    margin: 60px auto;
}

/* The opening-screen art (admin/login_art.py). Centre the block, never the
   lines: text-align: center shifts every line independently, which shears the
   letters of the title and turns a hillside into a pole. And not
   display: table, inside which browsers drop the newlines between the spans. */
.login-box pre {
    width: max-content;
    max-width: 100%;
    margin: 0 auto 20px;
    overflow-x: auto;
    text-align: left;
    color: var(--dim);
    /* The art is 60 columns wide, and a monospace column is about 0.61em. At
       11px that is some 400px: the width of the login box, and too wide for a
       phone. So the type shrinks until all 60 columns fit the screen, less
       the page's 20px gutters. */
    font-size: min(11px, calc((100vw - 40px) / 36.6));
    line-height: 1.2;
}
.art-title { color: var(--accent); }
.art-sub, .art-star { color: var(--dim); }
.art-hill { color: var(--fg); }
.art-stone { color: var(--warn); }
.art-man { color: #fff; }

.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 15px;
}

.tab {
    padding: 8px 16px;
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--dim);
    background: transparent;
    text-transform: none;
    font-weight: normal;
}

.tab.active { color: var(--fg); border-bottom-color: var(--bg); }

#chat-messages {
    height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border);
    padding: 10px;
    margin-bottom: 10px;
    font-size: 13px;
}

#chat-messages .msg-user { color: var(--accent); }
#chat-messages .msg-time { color: var(--dim); font-size: 11px; }

#chat-input {
    display: flex;
    gap: 8px;
}

#chat-input input { flex: 1; margin-bottom: 0; }
#chat-input button { width: 80px; }

.badge {
    display: inline-block;
    background: var(--dim);
    color: #000;
    padding: 1px 6px;
    font-size: 11px;
    margin-left: 5px;
}

.pinned { border-left: 3px solid var(--warn); }

.btn-danger {
    background: #ff3333;
    color: #fff;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    text-transform: uppercase;
}

.btn-danger:hover { background: #cc0000; }

.btn-small {
    padding: 2px 8px;
    font-size: 11px;
    display: inline-block;
}

.admin-badge {
    display: inline-block;
    background: var(--warn);
    color: #000;
    padding: 1px 5px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 3px;
}

/* Chat sidebar layout */
#chat-layout {
    display: flex;
    gap: 15px;
}

#chat-sidebar {
    width: 200px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    padding: 10px;
}

#chat-sidebar h3 {
    color: var(--accent);
    font-size: 11px;
    text-transform: uppercase;
    margin: 12px 0 5px;
    padding-bottom: 3px;
    border-bottom: 1px solid var(--border);
}

#chat-sidebar h3:first-child {
    margin-top: 0;
}

#chat-main {
    flex: 1;
    min-width: 0;
}

.channel-item {
    padding: 4px 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--dim);
}

.channel-item:hover {
    color: var(--fg);
    background: rgba(0, 255, 65, 0.05);
}

.channel-item.active {
    color: var(--fg);
    background: rgba(0, 255, 65, 0.1);
}

.user-item {
    padding: 4px 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--dim);
}

.user-item:hover {
    color: var(--accent);
    background: rgba(0, 191, 255, 0.05);
}

/* Logout is a POST form; make its button read as a nav link. */
.nav-form {
    display: inline;
}
.link-button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--link, inherit);
    text-decoration: underline;
    cursor: pointer;
}
.link-button:hover {
    color: var(--fg);
}

/* ------------------------------------------------------------------------
   Utilities. The Content-Security-Policy forbids inline styles, so anything
   a template used to say with style="..." is a class here. They come last
   so they win over the component rules above at equal specificity.
   ------------------------------------------------------------------------ */
.hidden { display: none; }

.text-fg { color: var(--fg); }
.text-dim { color: var(--dim); }
.text-accent { color: var(--accent); }
.text-warn { color: var(--warn); }
.text-alert { color: red; }
.text-white { color: #fff; }
.bold { font-weight: bold; }
.italic { font-style: italic; }
.center { text-align: center; }
.text-85 { font-size: 0.85em; }
.text-130 { font-size: 1.3em; }
.text-16 { font-size: 16px; }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 2px; }
.mt-5 { margin-top: 5px; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-15 { margin-top: 15px; }
.mt-2rem { margin-top: 2rem; }
.mt-3rem { margin-top: 3rem; }
.mb-10 { margin-bottom: 10px; }
.ml-5 { margin-left: 5px; }
.ml-10 { margin-left: 10px; }
.float-right { float: right; }
.pad-item { padding: 4px 8px; }

.inline-form { display: inline; }
.button-row { display: flex; gap: 8px; margin-top: 10px; }
.input-compact { font-size: 12px; padding: 4px; }

.box-accent { border-color: var(--accent); }
.box-warn { border-color: var(--warn); }
.box-alert { border-color: red; color: red; }
.landing-box { max-width: 600px; margin: 2rem auto; text-align: left; }
.row-total { border-top: 2px solid var(--accent); }

/* :hover is listed too because `button:hover` outranks a lone class. */
.btn-muted, .btn-muted:hover { background: var(--border); }
.btn-muted { color: var(--fg); }
.btn-muted.text-warn { color: var(--warn); }
.btn-warn, .btn-warn:hover { background: var(--warn); }

/* Unread DM stays red through hover and selection until it is opened. */
.channel-item.unread,
.channel-item.unread:hover,
.channel-item.unread.active { color: red; }

.chat-system { color: var(--warn); }
.chat-announcement {
    color: var(--warn);
    border-left: 3px solid var(--warn);
    padding-left: 8px;
    margin: 4px 0;
}

/* ------------------------------------------------------------------------
   The Long Climb
   ------------------------------------------------------------------------ */
.c-gold { color: #e6c34a; }
.c-blood { color: #ff4d4d; }
.c-leaf { color: var(--fg); }
.c-sky { color: var(--accent); }
.c-dim { color: var(--dim); }

.climb-status {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 22px;
    padding: 6px 10px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    font-size: 13px;
}
.climb-notice {
    border-left: 3px solid var(--accent);
    padding: 2px 0 2px 10px;
    margin-bottom: 12px;
    color: #cfe9ff;
}
.climb-scene p, .climb-notice p { margin-bottom: 6px; max-width: 70ch; }
.climb-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}
.climb-choice { display: flex; gap: 4px; }
.climb-choice button { padding: 10px 14px; text-transform: none; }
.climb-amount { width: 9ch; margin-bottom: 0; }
.climb-sheet { margin-top: 16px; padding-top: 8px; border-top: 1px solid var(--border); }
.climb-stele { margin-top: 10px; font-size: 13px; }
.climb-stele tr.c-sky td { color: var(--accent); }
.climb-words { width: 34ch; max-width: 100%; margin-bottom: 0; }
.climb-news { margin-top: 10px; }
.climb-news h3 { color: var(--accent); font-size: 12px; text-transform: uppercase; margin-bottom: 4px; }
.climb-news p, .climb-wall p { margin-bottom: 4px; max-width: 75ch; }
.climb-wall { margin-top: 10px; border-left: 3px solid var(--border); padding-left: 10px; }

/* The Long Climb on a phone: tables scroll sideways inside themselves rather
   than dragging the whole page with them, and choices become a column of
   full-width, finger-sized buttons. */
.climb-stele { display: block; overflow-x: auto; white-space: nowrap; }
@media (max-width: 600px) {
    .climb-status { font-size: 12px; gap: 2px 14px; }
    .climb-choices { flex-direction: column; }
    .climb-choice { width: 100%; }
    .climb-choice button { flex: 1; min-height: 44px; padding: 12px 14px; text-align: left; }
    .climb-amount, .climb-words { flex: 1; width: auto; min-width: 0; }
}
