:root {
    --bg: #282828; /* gruvbox dark background */
    --bg1: #3c3836; /* slightly lighter: buttons, inputs */
    --line: #504945; /* borders */
    --fg: #ebdbb2; /* text */
    --muted: #928374; /* grey text, like "since ..." */
    --yellow: #fabd2f; /* pause message */
    --green: #b8bb26;
    --red: #fb4934;
}

[hidden] {
    display: none !important;
}

.fira-sans-thin {
    font-family: "Fira Sans", sans-serif;
    font-weight: 100;
    font-style: normal;
}

.fira-sans-extralight {
    font-family: "Fira Sans", sans-serif;
    font-weight: 200;
    font-style: normal;
}

.fira-sans-light {
    font-family: "Fira Sans", sans-serif;
    font-weight: 300;
    font-style: normal;
}

.fira-sans-regular {
    font-family: "Fira Sans", sans-serif;
    font-weight: 400;
    font-style: normal;
}

.fira-sans-medium {
    font-family: "Fira Sans", sans-serif;
    font-weight: 500;
    font-style: normal;
}

.fira-sans-semibold {
    font-family: "Fira Sans", sans-serif;
    font-weight: 600;
    font-style: normal;
}

.fira-sans-bold {
    font-family: "Fira Sans", sans-serif;
    font-weight: 700;
    font-style: normal;
}

.fira-sans-extrabold {
    font-family: "Fira Sans", sans-serif;
    font-weight: 800;
    font-style: normal;
}

.fira-sans-black {
    font-family: "Fira Sans", sans-serif;
    font-weight: 900;
    font-style: normal;
}

.fira-sans-thin-italic {
    font-family: "Fira Sans", sans-serif;
    font-weight: 100;
    font-style: italic;
}

.fira-sans-extralight-italic {
    font-family: "Fira Sans", sans-serif;
    font-weight: 200;
    font-style: italic;
}

.fira-sans-light-italic {
    font-family: "Fira Sans", sans-serif;
    font-weight: 300;
    font-style: italic;
}

.fira-sans-regular-italic {
    font-family: "Fira Sans", sans-serif;
    font-weight: 400;
    font-style: italic;
}

.fira-sans-medium-italic {
    font-family: "Fira Sans", sans-serif;
    font-weight: 500;
    font-style: italic;
}

.fira-sans-semibold-italic {
    font-family: "Fira Sans", sans-serif;
    font-weight: 600;
    font-style: italic;
}

.fira-sans-bold-italic {
    font-family: "Fira Sans", sans-serif;
    font-weight: 700;
    font-style: italic;
}

.fira-sans-extrabold-italic {
    font-family: "Fira Sans", sans-serif;
    font-weight: 800;
    font-style: italic;
}

.fira-sans-black-italic {
    font-family: "Fira Sans", sans-serif;
    font-weight: 900;
    font-style: italic;
}

#add {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

td button {
    margin: 3px 2px;
    white-space: nowrap;
}

html {
    background: var(--bg);
}

body {
    max-width: 1200px;
    margin: 0 auto;
    padding: 22px 20px 60px;
    background-image: radial-gradient(
        1100px 480px at 50% -8%,
        rgba(250, 189, 47, 0.05),
        transparent 70%
    );
    color: var(--fg);
    font-family: "Fira Sans";
}

h1 {
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
    font-size: 30px;
    letter-spacing: 0.06em;
    color: var(--yellow);
    line-height: 1;
}
table {
    border-collapse: collapse;
    width: 100%;
    border: 1px solid var(--line);
}
td {
    border: 1px solid var(--line);
    padding: 10px 12px;
}
.time {
    font-variant-numeric: tabular-nums;
    font-size: 1.2em;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}
/* the small unit letters after each number, like YoshiTracker's "20 d" */
.time .u {
    margin-left: 2px;
    font-size: 0.6em;
    font-weight: 400;
    color: var(--muted);
}
.paused .time {
    opacity: 0.5;
}
.since {
    opacity: 0.6;
    font-size: 0.85em;
}
.message {
    color: #c80;
    font-size: 0.9em;
}
button,
input {
    background: var(--bg1);
    color: var(--fg);
    border: 1px solid var(--line);
    padding: 4px 10px;
    font: inherit;
    border-radius: 6px;
}
button:hover {
    border-color: var(--fg);
}
/* As many 260px-or-wider columns as fit; 1 column on phones */
/* auto-fit (not auto-fill): with fewer cards than columns, the empty columns
   are dropped and the cards stretch to fill the row */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}
/* count-ups: at most 3 per row (each at least a third of the row), so the cams and
   message board below line up with them */
.countups {
    grid-template-columns: repeat(auto-fit, minmax(max(260px, (100% - 2 * 14px) / 3), 1fr));
}

.card {
    background: var(--bg1);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 18px;
    min-width: 0;
}

.card h2 {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--yellow);
}

.card .time {
    font-size: 1.4em;
    margin: 6px 0;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

button.danger {
    color: var(--red);
}
button.danger:hover {
    border-color: var(--red);
}

#add,
#login {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: var(--bg1);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 16px;
}
#add input,
#login input {
    flex: 1;
    min-width: 140px;
}

.card.paused {
    opacity: 0.75;
}

.cams {
    margin-top: 14px;
}
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 12px;
}
.filters button {
    font-size: 12px;
    padding: 4px 11px;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.filters button.on {
    background: var(--yellow);
    border-color: var(--yellow);
    color: var(--bg);
}

.cam-stage {
    position: relative;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    overflow: hidden;
}
.cam-stage iframe,
.cam-stage video {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}
.cam-stage video {
    object-fit: contain; /* show the whole clip (TfL's are nearly square), with bars at the sides */
    background: #000;
}
.cam-note {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    text-align: center;
    color: var(--muted);
}

.doge {
    width: 64px;
    height: 64px;
    background: currentColor;
    mask: url(doge.svg) center / contain no-repeat;
}
.cam-credit {
    margin: 10px 0 0;
    font-size: 0.9em;
    color: var(--muted);
}
.cam-credit a {
    color: var(--fg);
}

.note {
    margin: 0 0 12px;
    font-size: 0.9em;
    color: var(--muted);
}

/* 2048 */
.games {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2048 and chess, half each */
    gap: 14px;
    margin-top: 14px;
}

.game,
.chess {
    display: flex;
    flex-direction: column;
}
.games .game-hint {
    margin-top: auto;
    padding-top: 10px;
}
.chess iframe {
    display: block;
    width: 100%;
    max-width: 420px;
    margin: auto;
    aspect-ratio: 10 / 11;
    border: 0;
}
.game-hint a {
    color: var(--fg);
}
.game-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 0.9em;
}
.game-bar b {
    color: var(--fg);
    font-variant-numeric: tabular-nums;
}
.game-bar button {
    margin-left: auto;
}
.board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-width: 420px;
    width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 8px;
    border-radius: 8px;
    background: var(--bg);
    touch-action: none;
    outline: none;
}
.board:focus {
    box-shadow: 0 0 0 2px var(--yellow);
}
.tile {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--bg1);
    font-size: 1.6em;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.tile.new {
    animation: pop 0.15s ease-out;
}
@keyframes pop {
    from {
        transform: scale(0.6);
    }
}

/* gruvbox */
.tile[data-v="2"] {
    background: #504945;
}
.tile[data-v="4"] {
    background: #665c54;
}
.tile[data-v="8"] {
    background: #458588;
}
.tile[data-v="16"] {
    background: #689d6a;
}
.tile[data-v="32"] {
    background: #98971a;
}
.tile[data-v="64"] {
    background: #d79921;
    color: var(--bg);
}
.tile[data-v="128"] {
    background: #d65d0e;
    font-size: 1.3em;
}
.tile[data-v="256"] {
    background: #cc241d;
    font-size: 1.3em;
}
.tile[data-v="512"] {
    background: #b16286;
    font-size: 1.3em;
}
.tile[data-v="1024"],
.tile[data-v="2048"],
.tile[data-v="4096"] {
    background: var(--yellow);
    color: var(--bg);
    font-size: 1.1em;
}
.game-status {
    min-height: 1.2em;
    margin: 10px 0 0;
    text-align: center;
    color: var(--yellow);
}
.game-hint {
    margin: 4px 0 0;
    text-align: center;
    font-size: 0.8em;
    color: var(--muted);
}

/* message board */
.board-card {
    margin-top: 14px;
}
#board-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
#board-form button {
    align-self: flex-end;
}
textarea {
    background: var(--bg1);
    color: var(--fg);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 10px;
    font: inherit;
    resize: vertical;
}
/* the message box can be dragged taller, but only so far (about 8 lines); longer text
   scrolls inside it instead of pushing the messages out of the card */
#board-text {
    min-height: 3.5em;
    max-height: 10em;
}
#board-form input,
#board-form textarea {
    background: var(--bg);
}
/* bots */
.honeypot {
    position: absolute;
    left: -9999px;
}
.board-wait {
    margin: 0;
    padding: 10px 12px;
    border: 1px dashed var(--line);
    border-radius: 6px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.board-error {
    margin: 6px 0 0;
    color: var(--red);
}
.board-error:empty {
    display: none;
}
.board-list {
    margin-top: 12px;
}
.board-msg {
    padding: 10px 0;
    border-top: 1px solid var(--line);
}
.board-meta {
    font-size: 0.85em;
    color: var(--muted);
}
.board-meta b {
    color: var(--yellow);
}
.board-text {
    margin-top: 4px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.board-empty {
    margin: 0;
    color: var(--muted);
}
.board-msg button {
    margin-top: 6px;
}

/* for phone */
@media (max-width: 600px) {
    body {
        padding: 14px 10px 40px;
    }
    .cams {
        margin-left: -10px;
        margin-right: -10px;
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }
    .cam-stage {
        margin: 0 -18px;
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }
}

/* diaries */
.diary-posts {
    align-items: start; /* a short post doesn't stretch to match a tall photo post */
}
.post {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.post > button {
    align-self: flex-start;
}
.post-image {
    display: block;
    width: 100%;
    border-radius: 6px;
}
.comments {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}
.comment .board-text {
    margin-top: 2px;
    font-size: 0.95em;
}
.comment-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.comment-form button {
    align-self: flex-end;
}
.comment-wait {
    font-size: 0.85em;
}
/* text-only buttons: "comment", "poster login", "log out" */
.link-button {
    align-self: flex-start;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 0.85em;
    cursor: pointer;
    text-decoration: underline dotted;
}
.link-button:hover {
    color: var(--fg);
}
.link-button.danger {
    margin-left: 6px;
}
.compose {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}
.compose textarea {
    background: var(--bg);
}
.compose-preview {
    max-width: 240px;
    border-radius: 6px;
}
.compose-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.compose-bar #post-send {
    margin-left: auto; /* post button on the right */
}
.compose-status {
    color: var(--muted);
    font-size: 0.85em;
}
/* the file picker, dressed up as one of our buttons */
.file-button {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
}
.file-button:hover {
    border-color: var(--fg);
}
.poster-login {
    margin-top: 30px;
    text-align: center;
    color: var(--muted);
    font-size: 0.9em;
}
.login-card {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 420px;
    margin: 10px auto 0;
}
.login-card input {
    flex: 1;
    min-width: 140px;
}
.login-card .board-error {
    width: 100%;
}
/* links to the diaries on the main page */
.diary-links {
    margin-bottom: 14px; /* gap before the count-ups below it */
}
.diary-links .filters {
    margin-bottom: 0;
}
.diary-links a {
    padding: 4px 12px;
    border: 1px solid var(--line);
    border-radius: 999px; /* pill, like the cam buttons */
    color: var(--fg);
    text-decoration: none;
}
.diary-links a:hover {
    border-color: var(--yellow);
    color: var(--yellow);
}
.poster-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.poster-form input {
    flex: 1;
    min-width: 140px;
}
/* "posting as anna" / "commenting as anna" for a logged-in diary writer */
.posting-as {
    margin: 0;
    font-size: 0.85em;
    color: var(--muted);
}
.posting-as b {
    color: var(--yellow);
}
/* diary writers' names link to their diary */
a.author {
    text-decoration: none;
}
a.author:hover {
    text-decoration: underline;
}
.post-wait {
    margin-bottom: 14px;
}
/* "wow, such empty" with the doge, for an empty message board or diary */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 0;
    color: var(--muted);
}

/* diary picker: a single row, title and links side by side */
.diary-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
}
.diary-links h2 {
    margin: 0;
}
/* count-up cards: name and location at the top, the count-up and message at the bottom,
   so they line up across cards of different heights */
.countups .card {
    display: flex;
    flex-direction: column;
    container-type: inline-size; /* lets the count-up size itself to the card's width */
}
/* message, count-up and "since" date, grouped at the bottom of the card */
.countups .card-bottom {
    margin-top: auto;
    padding-top: 6px; /* keeps a gap above it on the tallest card */
}
.countups .card .time {
    /* the count-up is the point of the card, so make it big, but never wider than the card
       (12cqi = 12% of the card's width) */
    font-size: min(2.1em, 12cqi);
    line-height: 1.1;
}

/* London's nearly square clip: the area stays 16:9 like the other cams (so the card doesn't
   change height), and the clip sits centred inside it, on the area's own background */
.cam-stage.clip video {
    background: none;
}

/* cams and the message board on the same 3 columns as the count-ups above (same gap too),
   cams taking two, so their edges line up with the count-up cards */
.duo {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 14px;
}
.duo .cams {
    grid-column: span 2;
}
.duo .cams,
.duo .board-card {
    margin-top: 0;
}
/* the board is exactly as tall as the cams card: its own content doesn't count towards
   the row height (contain: size), and the message list scrolls inside it */
.duo .board-card {
    display: flex;
    flex-direction: column;
    contain: size;
}
.duo .board-list {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
}
/* phones and narrow windows (incl. phones held sideways): both two-column rows stack,
   message board under the cams, chess under 2048 */
@media (max-width: 900px) {
    .duo,
    .games {
        grid-template-columns: 1fr;
    }
    .duo .cams {
        grid-column: auto; /* one column now, no spanning */
    }
    .duo .board-card {
        contain: none; /* stacked under the cams, it needs its own height again */
    }
    .duo .board-list {
        flex: none; /* back to its natural height, or it would collapse to nothing */
        max-height: 400px;
    }
}

/* area cards (weather, air, birds, time, moon), one per place, on the count-ups' 3 columns */
.areas {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 14px;
}
.env h2 {
    margin-bottom: 12px;
}
.env-where {
    margin-left: 4px;
    color: var(--muted);
    font-weight: 400;
    font-size: 0.85em;
}
/* each line: icon, big number with small unit, then words */
.env-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 5px 0;
}
.env-icon {
    width: 1.4em;
    text-align: center;
    flex: none;
}
.env-v {
    font-size: 1.25em;
    font-variant-numeric: tabular-nums;
}
.env-row .u {
    margin-left: 2px;
    font-size: 0.7em;
    color: var(--muted);
}
.env-label {
    font-size: 0.85em;
}
.env-sub {
    color: var(--muted);
    font-size: 0.9em;
}
/* two short readings side by side (air + humidity, wind + pressure) */
.env-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 10px;
}
.aqi-dot {
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    border-radius: 50%;
}
@media (max-width: 900px) {
    .areas {
        grid-template-columns: 1fr;
    }
}
