:root {
    color-scheme: light;
    --bg: #f3efe4;
    --panel: rgba(255, 250, 241, 0.92);
    --panel-strong: #fffdf8;
    --line: rgba(39, 58, 72, 0.16);
    --line-strong: rgba(39, 58, 72, 0.32);
    --text: #1d2730;
    --muted: #5e6f7d;
    --accent: #9f4f1e;
    --accent-soft: rgba(159, 79, 30, 0.12);
    --success: #1f6b4f;
    --danger: #a33e2d;
    --shadow: 0 18px 45px rgba(38, 49, 58, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(159, 79, 30, 0.14), transparent 34%),
        radial-gradient(circle at bottom right, rgba(31, 107, 79, 0.12), transparent 28%),
        linear-gradient(180deg, #efe7d4 0%, var(--bg) 55%, #ebe7dd 100%);
}

body.modal-open {
    overflow: hidden;
}

.page-shell {
  width: min(1872px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.countdown-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 18px 22px;
  border: 1px solid rgba(159, 79, 30, 0.22);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(159, 79, 30, 0.12), rgba(255, 250, 241, 0.96));
  box-shadow: var(--shadow);
}

.countdown-label,
.countdown-value {
  margin: 0;
}

.countdown-label {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.countdown-value {
  font-family: "IBM Plex Mono", "Fira Code", monospace;
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  font-weight: 700;
  color: var(--text);
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: end;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(255, 250, 241, 0.96), rgba(246, 240, 225, 0.9));
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0 0 10px;
    font-family: "IBM Plex Mono", "Fira Code", monospace;
    font-size: 0.82rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

.hero h1 {
    margin: 0;
    font-family: "Avenir Next Condensed", "Arial Narrow", sans-serif;
    font-size: clamp(2.2rem, 5vw, 4rem);
    line-height: 0.95;
    text-transform: uppercase;
}

.hero-copy {
    margin: 14px 0 0;
    max-width: 60ch;
    color: var(--muted);
    font-size: 1rem;
}

.refresh-button {
    border: 0;
    border-radius: 999px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #1f6b4f, #275c80);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
    box-shadow: 0 12px 24px rgba(39, 92, 128, 0.22);
}

.refresh-button:hover {
    transform: translateY(-1px);
}

.refresh-button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.meta-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.meta-label {
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.meta-card strong {
    font-size: 1.5rem;
}

.toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.toolbar-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 360px;
}

.toolbar-title,
.toolbar-note,
.page-summary {
    margin: 0;
}

.toolbar-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
}

.toolbar-note {
    color: var(--muted);
    max-width: 52ch;
}

.toolbar-side {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.search-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 300px;
}

.toggle-field {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 700;
}

.toggle-field input {
    inline-size: 18px;
    block-size: 18px;
    accent-color: var(--accent);
}

.search-field span {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
}

.search-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: #fffdf8;
    color: var(--text);
    font: inherit;
}

.status-message {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    text-align: right;
}

.status-message[data-state="success"] {
    color: var(--success);
}

.status-message[data-state="error"] {
    color: var(--danger);
}

.page-summary {
    color: var(--muted);
    font-size: 0.95rem;
    text-align: right;
}

.image-link-button {
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 8px 12px;
    background: #fffdf8;
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.image-link-button:hover {
    border-color: var(--accent);
}

.inline-image-card {
    display: flex;
    align-items: center;
    min-width: 420px;
}

.inline-image-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 420px;
    max-width: 100%;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: #fffdf8;
    cursor: pointer;
    overflow: hidden;
}

.inline-image-button:hover {
    border-color: var(--accent);
}

.inline-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: 280px;
    object-fit: contain;
    background: #efe7d4;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
}

.page-button {
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 10px 16px;
    background: rgba(255, 250, 241, 0.9);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background 180ms ease, border-color 180ms ease, opacity 180ms ease;
}

.page-button:hover {
    background: #fffdf8;
    border-color: var(--accent);
}

.page-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.page-indicator {
    margin: 0;
    min-width: 140px;
    text-align: center;
    font-weight: 700;
    color: var(--text);
}

.table-panel {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.table-wrap {
    overflow: auto;
    max-height: 70vh;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel-strong);
    contain: layout paint;
    will-change: scroll-position;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    text-align: left;
}

th {
    background: linear-gradient(180deg, #1d2730, #243845);
    color: #fdfaf3;
    font-size: 0.86rem;
    padding: 0;
    white-space: nowrap;
}

.sort-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    border: 0;
    padding: 12px 14px;
    background: linear-gradient(180deg, #1d2730, #243845);
    color: inherit;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    user-select: none;
}

.sort-button:hover {
    background: linear-gradient(180deg, #243845, #2c4554);
}

.sort-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 54px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    font-size: 0.72rem;
}

tbody tr:nth-child(even) {
    background: rgba(159, 79, 30, 0.04);
}

tbody tr:hover {
    background: rgba(31, 107, 79, 0.08);
}

td {
    font-size: 0.95rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.main-item-row td {
    background: rgba(255, 253, 248, 0.86);
}

.subsection-row td {
    padding: 0;
    background: rgba(159, 79, 30, 0.03);
    border-bottom: 1px solid var(--line);
}

.subsection-panel {
    padding: 16px 18px 18px;
    border-top: 1px solid rgba(39, 58, 72, 0.08);
}

.subsection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.subsection-title {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

.subsection-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(159, 79, 30, 0.12);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
}

.subsection-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: rgba(255, 250, 241, 0.72);
    border: 1px solid rgba(39, 58, 72, 0.1);
    border-radius: 16px;
    overflow: hidden;
}

.subsection-table td {
    padding: 12px 14px;
    background: transparent;
}

.subsection-table tr:last-child td {
    border-bottom: 0;
}

.name-cell,
.description-cell {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.name-cell-title {
    font-size: 1rem;
    padding-left: calc(var(--subitem-depth, 0) * 18px);
}

.name-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.name-link:hover {
    color: var(--accent);
    border-bottom-color: currentColor;
}

.store-link {
    width: fit-content;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
}

.store-link:hover {
    text-decoration: underline;
}

.identifier-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.identifier-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.9);
    color: var(--muted);
    font-family: "IBM Plex Mono", "Fira Code", monospace;
    font-size: 0.72rem;
}

.description-primary,
.description-secondary {
    margin: 0;
}

.description-secondary {
    color: var(--muted);
    font-size: 0.9rem;
}

.cell-id {
    font-family: "IBM Plex Mono", "Fira Code", monospace;
    font-size: 0.86rem;
}

.value-null {
    color: var(--muted);
    font-style: italic;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
}

.bool-true {
    background: rgba(31, 107, 79, 0.12);
    color: var(--success);
}

.bool-false {
    background: rgba(163, 62, 45, 0.1);
    color: var(--danger);
}

.link-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.empty-state {
    padding: 28px;
    text-align: center;
    color: var(--muted);
}

.image-modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.image-modal.hidden {
    display: none;
}

.image-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(29, 39, 48, 0.72);
}

.image-modal-content {
    position: relative;
    z-index: 1;
    width: min(960px, 100%);
    max-height: 90vh;
    padding: 20px;
    border-radius: 20px;
    background: #fffdf8;
    box-shadow: 0 24px 48px rgba(29, 39, 48, 0.24);
}

.image-modal-close {
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 8px 12px;
    background: transparent;
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.image-modal-title {
    margin: 16px 0 12px;
    font-size: 1rem;
    font-weight: 700;
}

.image-modal-preview {
    display: block;
    width: 100%;
    max-height: calc(90vh - 120px);
    object-fit: contain;
    border-radius: 14px;
    background: #efe7d4;
}

@media (max-width: 840px) {
  .page-shell {
    width: min(100vw - 20px, 1440px);
    padding-top: 20px;
  }

  .countdown-banner,
  .hero,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

    .toolbar-side {
        align-items: flex-start;
        width: 100%;
    }

    .status-message {
        text-align: left;
    }

    .page-summary {
        text-align: left;
    }

    .pagination-bar {
        justify-content: space-between;
    }

    .search-field {
        width: 100%;
        min-width: 0;
    }
}
