:root {
    --bg: #0e1116;
    --panel: #161b22;
    --panel2: #1c232d;
    --line: #2a313c;
    --fg: #e6e9ee;
    --dim: #8b949e;
    --green: #4ade80;
    --red: #f87171;
    --blue: #60a5fa;
    --yellow: #facc15;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font: 15px/1.45 system-ui, -apple-system, 'Segoe UI', sans-serif;
    overscroll-behavior: none;
}
#app { height: 100dvh; display: flex; flex-direction: column; }
.dim { color: var(--dim); }

/* ---- chrome ---- */
.topbar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    background: var(--panel); border-bottom: 1px solid var(--line);
    flex: none;
}
.topbar h1 { font-size: 18px; margin: 0; flex: 1; }

.btn {
    background: var(--panel2); color: var(--fg);
    border: 1px solid var(--line); border-radius: 8px;
    padding: 8px 12px; font-size: 14px; cursor: pointer;
}
.btn.primary { background: #1d4d3d; border-color: #2e7d6f; }
.btn.liked { color: var(--red); border-color: var(--red); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.icon-btn { background: none; border: none; color: var(--fg); font-size: 18px; padding: 4px 8px; cursor: pointer; }

/* bold disabled state: dimmed, not-allowed cursor, everywhere */
button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- wall canvas ---- */
.wall-area { position: relative; height: 44dvh; background: #000; flex: none; }
.wall-view { position: absolute; inset: 0; }
.wall-view canvas { display: block; }
.wall-empty {
    position: absolute; inset: 0; z-index: 2;
    display: flex; align-items: center; justify-content: center;
    color: var(--dim); pointer-events: none;
}
/* author display rule would defeat the UA's [hidden] rule otherwise */
.wall-empty[hidden] { display: none; }
.placebar {
    position: absolute; top: 8px; left: 8px; right: 8px; z-index: 5;
    display: flex; gap: 8px; align-items: center;
    background: rgba(14, 17, 22, 0.92);
    border: 1px solid var(--line); border-radius: 10px; padding: 8px;
}
.placebar input[type=range] { flex: 1; }

/* ---- info bar ---- */
.infobar {
    padding: 8px 12px; min-height: 58px;
    background: var(--panel); border-bottom: 1px solid var(--line);
    flex: none;
}
.info-line { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.info-grade { color: var(--green); font-weight: 700; }
.info-name { font-weight: 600; }
.info-setter { color: var(--dim); font-size: 13px; }
.info-btns { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }

/* ---- filter bar ---- */
.filterbar {
    display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
    padding: 8px 12px;
    background: var(--panel); border-bottom: 1px solid var(--line);
    flex: none;
}
.filterbar select, .filterbar input {
    background: var(--panel2); color: var(--fg);
    border: 1px solid var(--line); border-radius: 8px;
    padding: 5px 8px; font-size: 13px;
}
.filterbar .search { flex: 1; min-width: 110px; }
.filterbar .chk { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--dim); }

/* ---- climb list ---- */
.list { flex: 1; overflow-y: auto; min-height: 0; }
.list-empty { padding: 20px 14px; }
.row {
    display: flex; gap: 10px; align-items: baseline; width: 100%;
    text-align: left; padding: 10px 14px;
    background: none; border: none; border-bottom: 1px solid var(--line);
    color: var(--fg); cursor: pointer; font: inherit;
}
.row.selected { background: var(--panel); }
.row .grade { color: var(--green); font-weight: 700; }
.row .col-mid { display: flex; flex-direction: column; min-width: 0; }
.row-title { font-weight: 600; }
.row-sub { color: var(--dim); font-size: 12px; }
.row-stats { margin-left: auto; color: var(--dim); font-size: 12px; white-space: nowrap; }

.footer {
    display: flex; justify-content: space-between;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    background: var(--panel); border-top: 1px solid var(--line);
    color: var(--dim); font-size: 13px;
    flex: none;
}

/* ---- bottom sheet ---- */
.sheet-overlay {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(0, 0, 0, 0.5);
    display: flex; align-items: flex-end;
}
/* modeless: backdrop lets clicks through so the canvas stays interactive
   (used by the climb editor, which needs hold-tapping while open) */
.sheet-overlay.modeless { pointer-events: none; background: none; }
.sheet-overlay.modeless .sheet { pointer-events: auto; }
.sheet {
    background: var(--panel); width: 100%;
    max-height: 80dvh; overflow-y: auto;
    border-radius: 16px 16px 0 0;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font-size: 16px; }
.sheet-body { padding-top: 10px; display: flex; flex-direction: column; gap: 10px; }

/* ---- forms ---- */
input, select { font: inherit; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; color: var(--dim); }
.field input, .field select {
    background: var(--panel2); color: var(--fg);
    border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px;
}
.form-error { color: var(--red); font-size: 13px; min-height: 16px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
    border: 1px solid var(--line); background: var(--panel2);
    color: var(--fg); border-radius: 999px;
    padding: 6px 12px; cursor: pointer; font-size: 13px;
}
.chip.on { color: #0e1116; font-weight: 700; }
.chip[data-role=start].on { background: var(--green); border-color: var(--green); }
.chip[data-role=finish].on { background: var(--red); border-color: var(--red); }
.chip[data-role=hand].on { background: var(--yellow); border-color: var(--yellow); }
.chip[data-role=foot].on { background: var(--blue); border-color: var(--blue); }

.comment { padding: 8px 0; border-bottom: 1px solid var(--line); }
.comment .who { color: var(--dim); font-size: 12px; }
.comment-form { display: flex; gap: 6px; }
.comment-form input {
    flex: 1; background: var(--panel2); color: var(--fg);
    border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}

.menu-item {
    display: block; width: 100%; text-align: left;
    background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
    color: var(--fg); padding: 10px 12px; font-size: 15px; cursor: pointer;
}
.menu-item + .menu-item { margin-top: 6px; }
.invite-box { display: flex; gap: 6px; padding: 4px 0; }
.invite-box input {
    flex: 1; background: var(--panel2); color: var(--fg);
    border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 12px;
}
.upload-progress {
    display: flex; flex-direction: column; gap: 4px;
    font-size: 13px; color: var(--dim); padding: 2px 0;
}
/* author display rule would defeat the UA [hidden] rule otherwise */
.upload-progress[hidden] { display: none; }
.pbar {
    height: 6px; border-radius: 999px; overflow: hidden;
    background: var(--panel2); border: 1px solid var(--line);
}
.pbar-fill { height: 100%; width: 0; background: var(--green); transition: width 0.2s; }

/* ---- auth ---- */
.auth { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card {
    width: 100%; max-width: 340px;
    background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
    padding: 20px; display: flex; flex-direction: column; gap: 12px;
}
.auth-card h1 { margin: 0; text-align: center; }
.tabs { display: flex; gap: 8px; }
.tabs .btn { flex: 1; }
.tabs .btn.on { outline: 1px solid var(--green); }

.toast {
    position: fixed; bottom: 72px; left: 50%; transform: translateX(-50%);
    background: #2a313c; color: var(--fg);
    padding: 8px 14px; border-radius: 999px;
    z-index: 99; font-size: 14px;
}
