/* xyzzy's BJ Image Hoster: blue felt table.
   Felt = generated cloth noise + table light. Gold ink = printed table markings.
   Rail = dark padded working panels. Chips = actions and states. */
:root {
    --felt: #1d52a0;
    --felt-hi: #2f78d0;
    --felt-lo: #0f2a52;
    --ink: #ecd9a0;
    --ink-soft: rgba(236, 217, 160, .5);
    --ink-faint: rgba(236, 217, 160, .22);
    --cream: #f7f2e4;
    --text: #f4f1ea;
    --text-2: rgba(244, 241, 234, .74);
    --text-on-felt-2: #c9d6ea;
    --rail: #17120e;
    --rail-2: #221b15;
    --rail-hi: #2e251d;
    --rail-line: rgba(255, 255, 255, .1);
    --well: #0b0907;
    --chip-yellow: #f4b81c;
    --chip-yellow-hi: #ffc93b;
    --chip-white: #f4f1ea;
    --chip-purple: #8a4fd1;
    --chip-black: #26211c;
    --chip-red: #e0383e;
    --dark-text: #1b1a17;
    --ok: #7fd8a0;
    --danger-text: #ffd9d9;
    --warn-text: #ffcf6b;
    --board: #0c0c0c;
    --display: "Limelight", Georgia, serif;
    --sans: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Red Hat Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
    --radius: 18px;
    --ease: cubic-bezier(.16, 1, .3, 1);
    /* Generated cloth: dark speckle + light fibre, tiled. Reused by the admin's felt band. */
    --felt-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85 .95' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .42 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    --felt-fibre: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { min-height: 100%; background: var(--felt-lo); }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font: 400 15px/1.5 var(--sans);
    -webkit-font-smoothing: antialiased;
    background-color: var(--felt);
    background-image:
        var(--felt-noise),
        var(--felt-fibre),
        radial-gradient(ellipse 70% 55% at 50% 30%, var(--felt-hi), transparent 70%),
        radial-gradient(ellipse 120% 100% at 50% 35%, transparent 55%, var(--felt-lo));
    background-repeat: repeat, repeat, no-repeat, no-repeat;
}

::selection { background: var(--chip-yellow); color: var(--dark-text); }
input, textarea { caret-color: var(--chip-yellow); }
* { scrollbar-color: var(--ink-soft) transparent; }
:focus-visible { outline: 3px solid var(--chip-yellow); outline-offset: 3px; }
a { color: var(--ink); text-underline-offset: 3px; }
img { max-width: 100%; }
.num, time { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Page frame ---------- */
.page {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 max(20px, env(safe-area-inset-right)) 40px max(20px, env(safe-area-inset-left));
}

.topbar {
    display: flex;
    justify-content: flex-end;
    padding-top: 20px;
    position: relative;
    z-index: 2;
}

.nav { display: flex; gap: 4px; }
.nav a {
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 999px;
    transition: background .2s var(--ease);
}
.nav a:hover { background: rgba(0, 0, 0, .22); }
.nav a[aria-current="page"] { background: var(--rail); box-shadow: inset 0 1px 0 var(--rail-hi), 0 4px 10px rgba(0, 0, 0, .25); }

/* Printed table arc (site name + rules). Scales with width. */
.arc {
    display: block;
    width: 100%;
    max-width: 1320px;
    height: auto;
    margin: -40px auto 0;
    overflow: visible;
}
.arc .name { font-family: var(--display); fill: var(--ink); letter-spacing: 3px; }
.arc .rules { font-family: var(--sans); font-weight: 600; fill: var(--ink); letter-spacing: 3px; opacity: .88; }
.arc .line { fill: none; stroke: var(--ink); }
.arc a { cursor: pointer; }
.arc-sub {
    display: none;
    text-align: center;
    color: var(--ink);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin: 4px 0 0;
}

.page-title {
    font: 400 clamp(26px, 4vw, 40px)/1.1 var(--display);
    color: var(--ink);
    letter-spacing: .03em;
    margin: 0;
    text-wrap: balance;
}

.foot {
    margin-top: 40px;
    text-align: center;
    font-size: 12.5px;
    color: var(--text-on-felt-2);
}

/* ---------- Rail panel ---------- */
.rail {
    background: linear-gradient(var(--rail-hi), var(--rail) 20px);
    border-radius: var(--radius);
    box-shadow: 0 2px 0 rgba(0, 0, 0, .35), 0 22px 44px rgba(0, 0, 0, .38);
    padding: 28px;
}

/* ---------- Chips (buttons) ---------- */
.chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: 700 15px/1 var(--sans);
    border: 0;
    border-radius: 999px;
    padding: 13px 20px;
    color: var(--dark-text);
    background: var(--chip-white);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: transform .15s var(--ease), background-color .15s var(--ease), box-shadow .15s var(--ease);
    box-shadow: 0 2px 0 rgba(0, 0, 0, .35);
}
.chip::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: inherit;
    border: 2px dashed rgba(0, 0, 0, .16);
    pointer-events: none;
}
.chip:hover { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0, 0, 0, .35); }
.chip:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.chip--yellow { background: var(--chip-yellow); }
.chip--yellow:hover { background: var(--chip-yellow-hi); }
.chip--yellow::after { border-color: rgba(255, 255, 255, .55); }
.chip--purple { background: var(--chip-purple); color: #fff; }
.chip--purple::after { border-color: rgba(255, 255, 255, .45); }
.chip--ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .3); }
.chip--ghost::after { display: none; }
.chip--ghost:hover { background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .5); }
.chip--small { font-size: 13px; padding: 9px 14px; }
.chip--small::after { inset: 2px; border-width: 1.5px; }
.chip.is-done { background: var(--ok); }
.chip[disabled], .chip[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: .45;
    transform: none;
    box-shadow: none;
}

.chip--danger { background: var(--chip-red); color: #fff; }
.chip--danger::after { border-color: rgba(255, 255, 255, .45); }

/* Quiet destructive trigger: text, not a chip, so it never competes with the main action */
.textbtn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: none;
    padding: 6px 2px;
    color: var(--danger-text);
    font: 600 13px var(--sans);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--chip-red) 70%, transparent);
    text-underline-offset: 3px;
}
.textbtn-danger .icon { width: 15px; height: 15px; }
.textbtn-danger:hover { color: #fff; }

/* Inline "are you sure" box for deleting */
.confirm {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--chip-red) 14%, transparent);
    box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--chip-red) 55%, transparent);
}
.confirm p { margin: 0; font-size: 14px; color: var(--danger-text); }
.confirm .row { gap: 8px; }
.confirm-error { font-weight: 600; }

/* ---------- Link field ---------- */
.linkfield {
    display: flex;
    gap: 5px;
    padding: 5px;
    background: var(--cream);
    border-radius: 14px;
}
.linkfield input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    font: 600 16px var(--mono);
    color: var(--dark-text);
    padding: 0 10px;
    text-overflow: ellipsis;
}
.linkfield input:focus { outline: none; }
.linkfield:focus-within { box-shadow: 0 0 0 3px var(--chip-yellow); }

/* ---------- Tags ---------- */
.tag {
    display: inline-block;
    font: 700 10px/1 var(--sans);
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 999px;
    vertical-align: 2px;
}
.tag--new { background: var(--chip-yellow); color: var(--dark-text); }
.tag--replaced { background: var(--chip-purple); color: #fff; }
.tag--edit { background: var(--chip-white); color: var(--dark-text); }

/* Framed board: how an image sits on the table in TTS */
.board {
    display: block;
    border: 5px solid var(--board);
    background: var(--board);
    box-shadow: 0 2px 0 rgba(0, 0, 0, .4), 0 16px 28px rgba(0, 0, 0, .45);
}

.k {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-2);
    margin: 0 0 8px;
}

.notice {
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    background: color-mix(in srgb, var(--chip-red) 16%, transparent);
    box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--chip-red) 60%, transparent);
    color: var(--danger-text);
}

.notice--ok {
    background: color-mix(in srgb, var(--ok) 14%, transparent);
    box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ok) 55%, transparent);
    color: #dff7e8;
}
.notice--info {
    background: color-mix(in srgb, var(--ink) 10%, transparent);
    box-shadow: inset 0 0 0 1.5px var(--ink-faint);
    color: var(--text);
}

/* ---------- Shared helpers (used by every page) ---------- */
.mono { font-family: var(--mono); }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.lede { color: var(--text-on-felt-2); margin: 8px 0 0; max-width: 62ch; }
.help { font-size: 13px; color: var(--text-2); margin: 8px 0 0; max-width: 62ch; }
.help.is-warn { color: var(--warn-text); }

/* Small printed arc on inner pages, linking home */
.arc-home { display: block; }
.arc--small { margin-top: -34px; }

/* Sub-pages on phones: the small arc gets too small to read, so set the name as a line instead. */
.brand-line {
    display: none;
    text-align: center;
    font: 400 22px/1.2 var(--display);
    color: var(--ink);
    letter-spacing: .03em;
    text-decoration: none;
    margin: 14px 0 26px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--ink-soft);
}

@media (max-width: 720px) {
    .arc { margin-top: 14px; }
    .arc .rules { display: none; }
    .arc .name { font-size: 78px; }
    .arc--small { display: none; }
    .brand-line { display: block; }
    .arc-sub { display: block; }
    .rail { padding: 20px; }
    .topbar { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
