* {
    box-sizing: border-box;
}

/* A class that sets `display` (like .grid-size-row's flex) would otherwise beat the
   `hidden` attribute and leave "hidden" rows showing. */
[hidden] {
    display: none !important;
}

/* WallZooki blue behind rounded white cards: the same look as the big screen, the guest page and the main page. */
html {
    background: #e3f2fd;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: sans-serif;
    color: #1d2733;
    background: linear-gradient(180deg, #2196f3 0%, #2196f3 35%, #e3f2fd 100%) fixed;
}

.page {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 16px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 8px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 22px rgba(18, 74, 124, 0.2);
}

h1 {
    font-size: 1.4rem;
    margin: 0;
}

h2 {
    font-size: 1.1rem;
    margin: 0 0 8px;
}

p {
    font-size: 0.9rem;
    line-height: 1.4;
}

.panel {
    background: white;
    border: none;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 10px 28px rgba(18, 74, 124, 0.2);
}

.panel.center {
    text-align: center;
}

/* The WallZooki logo (platform-logo.png) is shown inside the page's h1. */
.logo {
    display: block;
    height: auto;
    max-width: 100%;
}

.logo-large {
    width: 200px;
    margin: 0 auto 12px;
}

.logo-small {
    width: 110px;
}

/* The logo is a link to the main page; the link is exactly as big as the logo (and centered where the logo is). */
.logo-link {
    display: block;
    width: fit-content;
    margin: 0 auto;
    border-radius: 8px;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

input, textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: normal;
    border: 1px solid #c9d6e3;
    border-radius: 10px;
}

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #2196f3;
    outline-offset: 1px;
    border-color: #2196f3;
}

.grid-size-row {
    display: flex;
    gap: 12px;
}

.grid-size-row label {
    flex: 1;
}

.primary-btn {
    width: 100%;
    padding: 10px 16px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: #2196f3;
    border: none;
    border-radius: 12px;
    cursor: pointer;
}

.primary-btn:hover:not(:disabled) {
    background: #1e88e5;
}

.primary-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.text-btn {
    padding: 6px 14px;
    font-size: 0.85rem;
    background: #fff;
    border: 1px solid #b9d4ee;
    border-radius: 999px;
    cursor: pointer;
    color: #1b6fb5;
}

.text-btn:hover {
    background: #e3f2fd;
}

/* Sign-in page: the small line under the button that leads to the main page. The error line above it takes no
   room until there is something to say. */
.learn-more {
    margin: 12px 0 0;
    font-size: 0.9rem;
    color: #555;
}

.legal-link {
    margin: 10px 0 0;
    font-size: 0.8rem;
}

.legal-link a {
    color: #666;
}

.login-status:empty {
    display: none;
}

.learn-more a {
    color: #1b6fb5;
    font-weight: 600;
}

.error {
    color: crimson;
    font-size: 0.85rem;
    min-height: 1.2em;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge.pending {
    background: #fff3cd;
    color: #8a6300;
}

.badge.active {
    background: #cdeccd;
    color: #256029;
}

.badge.failed {
    background: #f8d7da;
    color: #842029;
}

.fine-print {
    font-size: 0.75rem;
    color: #777;
    word-break: break-all;
}

.lang-bar {
    text-align: end;
    margin-bottom: 8px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-select {
    padding: 6px 8px;
    font-size: 0.85rem;
    border: 1px solid #c9d6e3;
    border-radius: 10px;
    background: white;
    cursor: pointer;
}

label select {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: normal;
    border: 1px solid #c9d6e3;
    border-radius: 10px;
    background: white;
}

.hint {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    font-weight: normal;
    color: #777;
}

.hint .count {
    float: inline-end;
}

.ok {
    color: #256029;
    font-size: 0.85rem;
}

.primary-btn.inline {
    width: auto;
}

.primary-btn.small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 20px 0 12px;
    padding: 10px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 22px rgba(18, 74, 124, 0.2);
}

.section-head h2 {
    margin: 0;
}

.form-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* The boards sit side by side and wrap onto new rows. Each card is tall and narrow, like the display's sidebar. */
#board-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
    align-items: stretch;
}

.board-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: white;
    border: none;
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 10px 24px rgba(18, 74, 124, 0.2);
}

/* The title and the status badge: the badge drops under a long title instead of squeezing it. */
.board-card .board-card-head {
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-top: 10px;
}

.board-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.board-card h3 {
    margin: 0;
    font-size: 1.05rem;
    overflow-wrap: anywhere;
}

.board-meta {
    margin: 6px 0 4px;
    font-size: 0.8rem;
    color: #555;
}

.board-sidebar {
    margin: 4px 0;
    overflow-wrap: anywhere;
}

.board-meta + .board-meta {
    margin-top: 0;
}

/* The bottom of a card: the links to the board's pages, then its buttons. Pushed to the bottom (the cards of a row are
   all as tall as the tallest), so the links and buttons line up from card to card whatever the text above says. */
.board-card-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
    padding-top: 12px;
}

/* The links to a board's pages, the big-screen guide and "Share links": one under the other, all the same size, so
   longer wording (a classic board's "Approve squares", a showcase board's "Approve pictures", another language) never
   changes the layout. */
.board-links {
    display: grid;
    gap: 6px;
}

.board-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 5px 10px;
    border: none;
    border-radius: 999px;
    background: #e3f2fd;
    color: #1b6fb5;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.board-link:hover {
    background: #cfe6fb;
}

/* The help and sharing links (big-screen guide, Share links): set apart under a thin line, as small text links side by
   side, so they read as information and help rather than as buttons that act on the board (like Edit and Stop below). */
.board-links-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 16px;
    padding-top: 8px;
    border-top: 1px dashed #c9d6e3;
}

.board-links-info .board-link {
    min-height: 0;
    padding: 2px 2px;
    border: none;
    border-radius: 4px;
    background: none;
    color: #1b6fb5;
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.board-links-info .board-link:hover {
    background: none;
    color: #124a7c;
}

/* The buttons: two equal columns. The main action (Launch now, Try again) and Delete each take a whole row (.wide, set by
   renderBoardCard), the main action at the top and Delete at the bottom, so every card's buttons are arranged alike. */
.board-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.board-actions > button {
    width: 100%;
    min-height: 32px;
    padding: 5px 6px;
    font-size: 0.85rem;
    line-height: 1.2;
    border-radius: 999px;
}

.board-actions > button.wide {
    grid-column: 1 / -1;
}

.text-btn.danger {
    color: #842029;
    border-color: #e0b4b8;
}

.badge.draft,
.badge.ended {
    background: #e6e6e6;
    color: #444;
}

.notice {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 6px;
    padding: 8px 12px;
    border-radius: 10px;
    color: #0d47a1;
}

.image-field {
    margin-bottom: 12px;
}

.field-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
}

.file-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

/* Overrides the page's general rule that makes every label a block. */
label.file-btn {
    display: inline-block;
    flex: 0 0 auto;
    margin: 0;
    padding: 6px 12px;
    font-size: 0.9rem;
    font-weight: normal;
    background: #fff;
    color: #1b6fb5;
    border: 1px solid #b9d4ee;
    border-radius: 999px;
    cursor: pointer;
}

.file-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.85rem;
    color: #555;
    /* Wraps instead of truncating, so longer translations and long filenames stay readable. */
    overflow-wrap: anywhere;
}

/* Hidden but still focusable, so keyboard users can reach the file control. */
input.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

input.visually-hidden:focus-visible + .file-btn {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

.image-preview {
    display: block;
    max-width: 140px;
    max-height: 90px;
    margin: 6px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

/* The kind of board: two cards to choose from. */
.type-box {
    margin: 0 0 14px;
    padding: 8px 12px 10px;
    border: 1px solid #cfdcea;
    border-radius: 12px;
}
.type-box legend {
    padding: 0 6px;
    font-weight: 700;
}
/* A showcase board's starting look: four patterns (small maps of the real cells), two colors, a pace. */
.look-label {
    margin: 10px 0 4px;
    font-weight: 700;
    font-size: 0.9rem;
}
.look-patterns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.look-pattern {
    padding: 6px;
    text-align: center;
    font-size: 0.8rem;
    background: #fff;
    border: 2px solid #cfdcea;
    border-radius: 10px;
    cursor: pointer;
}
.look-pattern[aria-pressed="true"] {
    border-color: #2196f3;
    background: #e3f2fd;
    font-weight: 700;
}
.look-mini {
    display: grid;
    gap: 2px;
    aspect-ratio: 16 / 10;
    margin-bottom: 4px;
    padding: 3px;
    border-radius: 5px;
    background: linear-gradient(100deg, var(--mini-c1, #2196f3) 0%, var(--mini-c1, #2196f3) 80%, var(--mini-c2, #e3f2fd) 100%);
}
.look-mini i {
    display: block;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.85);
}
/* "Show on a TV" panel */
.tv-steps {
    margin: 0 0 14px;
    padding-inline-start: 22px;
    line-height: 1.6;
}

.tv-code-input {
    font-family: ui-monospace, Consolas, "Courier New", monospace;
    font-size: 1.4rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.look-bigqr {
    margin-top: 12px;
}
.look-colors {
    display: flex;
    gap: 18px;
    margin: 10px 0;
}
.look-colors label,
.look-pace {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}
.look-colors input[type="color"] {
    width: 40px;
    height: 30px;
    padding: 0;
    border: 1px solid #c9d6e3;
    border-radius: 8px;
    cursor: pointer;
}

.type-choice {
    align-items: flex-start;
    margin: 8px 0;
    padding: 8px 10px;
    border: 2px solid #e3ecf5;
    border-radius: 12px;
    cursor: pointer;
}
/* the kind that is chosen: a soft blue card */
.type-choice:has(input:checked) {
    border-color: #2196f3;
    background: #e3f2fd;
}
.type-choice small {
    display: block;
    margin-top: 2px;
}

.schedule-box {
    border: 1px solid #cfdcea;
    border-radius: 12px;
    padding: 10px 12px 4px;
    margin: 0 0 12px;
}

.schedule-box legend {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    padding: 0 6px;
}

/* The page's general rule makes every input full width; radio buttons sit inline. */
.choice input[type="radio"],
.choice input[type="checkbox"] {
    display: inline-block;
    width: auto;
    margin: 0 6px 0 0;
    vertical-align: middle;
}

.choice {
    font-weight: normal;
    margin-bottom: 8px;
}

.notice-warning {
    margin-bottom: 16px;
    background: #fff3cd;
    border-color: #e6c866;
}

.notice-warning h2 {
    color: #8a6300;
}

.primary-btn.danger-btn {
    background: #c62828;
}

.badge.deleting {
    background: #fff3cd;
    color: #8a6300;
}

.badge.scheduled {
    background: #d7ebfb;
    color: #0b5394;
}

/* The board credits line above the list of boards, and the price lines of the "add a board credit" panel. */
.credits-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 12px;
    padding: 10px 16px;
    font-size: 0.9rem;
}

.pay-quote {
    font-weight: 600;
    min-height: 1.4em;
}

/* Share links panel */
.share-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.share-row {
    padding: 12px 0;
    border-top: 1px solid #e3e3e3;
}

.share-row .hint {
    margin: 2px 0 8px;
}

.share-row .share-careful {
    color: #842029;
}

/* The address with its copy icon at the right end, inside the box */
.share-url-field {
    position: relative;
    direction: ltr;
}

.share-url {
    width: 100%;
    box-sizing: border-box;
    direction: ltr;
    text-align: left;
    font-size: 0.85rem;
    padding-right: 40px;
}

.share-copy-icon {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #1565c0;
    cursor: pointer;
}

.share-copy-icon:hover,
.share-copy-icon:focus-visible {
    background: #e3f2fd;
}

.share-copy-icon.copied {
    color: #2e7d32;
}

.share-pick {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* "Send what's checked" at the bottom of the share panel */
.share-send {
    padding: 12px 0;
    border-top: 1px solid #e3e3e3;
}

.share-send h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.share-send .hint {
    margin: 8px 0 0;
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

a.text-btn {
    display: inline-block;
    text-decoration: none;
}

a.text-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.share-qr {
    padding: 12px 0;
    border-top: 1px solid #e3e3e3;
}


.share-qr-img {
    display: block;
    max-width: 160px;
    width: 100%;
    height: auto;
    border: 1px solid #ccc;
    margin: 8px 0;
}

/* The miniature of a board's display sidebar at the top of its card */
.sidebar-mini-frame {
    position: relative;
    display: flex;
    justify-content: center;
    padding: 12px;
    /* the board's own two colors (set by the page from the board's look; WallZooki blue when it has none) */
    background: linear-gradient(100deg, var(--mini-c1, #2196f3) 0%, var(--mini-c1, #2196f3) 65%, var(--mini-c2, #e3f2fd) 100%);
    border-radius: 12px;
}

.sidebar-mini {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    width: 130px;
    height: 250px;
    padding: 8px;
    overflow: hidden;
    text-align: center;
    background: rgba(255, 255, 255, 0.96);
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
}

.sidebar-mini-top {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 56px;
    flex: 0 0 auto;
}

.sidebar-mini-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sidebar-mini-empty {
    font-size: 0.6rem;
    color: #999;
}

.sidebar-mini-words {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.sidebar-mini-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    margin: 4px 0;
    font-size: 0.72rem;
    line-height: 1.2;
}

.sidebar-mini-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    margin: 0;
    font-size: 0.62rem;
    line-height: 1.25;
}

.sidebar-mini-text.empty {
    color: #999;
    font-style: italic;
}

.sidebar-mini-bottom {
    flex: 0 0 auto;
    width: 100%;
}

.sidebar-mini-caption {
    display: block;
    margin-bottom: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1.2;
}

/* A stand-in for the QR code (the real one is made for the live board's own link). */
.sidebar-mini-qr {
    display: block;
    width: 56px;
    height: 56px;
    margin: 0 auto;
    background: repeating-conic-gradient(#222 0 25%, #fff 0 50%) 0 0 / 14px 14px;
    border: 3px solid #222;
}

/* A classic board's look is only its two colors: the rest belongs to a showcase board. */
.look-block--colors .showcase-only {
    display: none;
}

/* A live board WallZooki has paused: an amber badge, and a note with WallZooki's reason and where to ask. */
.badge.paused {
    background: #fff3cd;
    color: #8a6300;
}

.paused-notice {
    margin: 8px 0;
    padding: 10px 12px;
    background: #fff3cd;
    border: 1px solid #e6c866;
    border-radius: 6px;
    color: #5c4300;
}

.paused-notice p {
    margin: 0 0 6px;
}

.paused-notice p:last-child {
    margin-bottom: 0;
}

/* The board's status badge (Live, Draft, Paused by WallZooki...) in the top-right corner of the sidebar preview: the same
   spot on every card. A white edge and a shadow keep it readable on any board color. */
.sidebar-mini-frame > .badge {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 1;
    max-width: calc(100% - 12px);
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    font-size: 0.75rem;
    line-height: 1.2;
    /* always one line: a label too long for the corner ends in "..." (the whole label shows on hover) */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
