:root {
    --bg: #f4efe5;
    --panel: rgba(255, 252, 247, 0.92);
    --ink: #1f2230;
    --accent: #15616d;
    --accent-2: #ff7d00;
    --muted: #6b7280;
    --line: rgba(31, 34, 48, 0.12);
    --fluo: #d9ff00;
    --danger: #a93434;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Avenir Next", "Segoe UI", sans-serif;
    color: var(--ink);
    background: #f5dfc6;
    min-height: 100vh;
}

button,
select,
input {
    font: inherit;
}

.auth-shell,
.app-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.auth-card,
.thread-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(17, 24, 39, 0.08);
}

.auth-card {
    width: min(420px, 100%);
    padding: 28px;
}

.extension-card {
    width: min(860px, 100%);
}

.stack {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 8px;
}

input,
select,
button {
    border-radius: 12px;
    border: 1px solid var(--line);
    padding: 12px 14px;
    background: white;
}

button,
.button-link {
    cursor: pointer;
    background: var(--accent);
    color: white;
    text-decoration: none;
    text-align: center;
}

.secondary {
    background: white;
    color: var(--ink);
}

.alert {
    padding: 12px 14px;
    background: #ffe9e9;
    color: var(--danger);
    border-radius: 12px;
}

.meta-note {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(21, 97, 109, 0.08);
    border: 1px solid var(--line);
}

code {
    font-family: "SFMono-Regular", "Menlo", monospace;
    background: rgba(31, 34, 48, 0.06);
    padding: 2px 6px;
    border-radius: 6px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
}

.topbar-actions,
.inline-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.topbar-button {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: white;
    color: var(--ink);
}

.topbar-game-select {
    width: 180px;
    max-width: 180px;
}

.tabs {
    display: flex;
    gap: 12px;
    margin: 24px 0;
}

.tabs a {
    padding: 12px 16px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.52);
}

.tabs a.active {
    background: var(--ink);
    color: white;
}

.thread-list {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.thread-card {
    padding: 18px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.thread-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.thread-actions,
.screenshot-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.thread-actions,
.screenshot-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.thread-assignments {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.thumb-strip {
    display: flex;
    gap: 14px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 6px;
    min-height: 146px;
    border-radius: 16px;
    overscroll-behavior-x: contain;
}

.thumb-card {
    flex: 0 0 180px;
    min-width: 180px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.thumb-card.dragging {
    opacity: 0.45;
}

.thumb-card img {
    width: 180px;
    height: 120px;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid var(--line);
    cursor: pointer;
    background: #ddd;
}

.badge-new {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--fluo);
    color: #000;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 700;
}

.thumb-card.drop-before {
    box-shadow: inset 4px 0 0 var(--accent);
}

.thumb-card.drop-after {
    box-shadow: inset -4px 0 0 var(--accent);
}

.thumb-strip.drop-target {
    background: rgba(21, 97, 109, 0.08);
    outline: 2px dashed rgba(21, 97, 109, 0.35);
    outline-offset: 4px;
}

.meta-line {
    color: var(--muted);
    font-size: 14px;
}

.screenshot-menu summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
    font-size: 13px;
    text-align: center;
}

.screenshot-menu summary::-webkit-details-marker {
    display: none;
}

.screenshot-menu[open] summary {
    background: white;
}

.screenshot-menu .screenshot-actions {
    margin-top: 8px;
    flex-direction: column;
    align-items: stretch;
}

.screenshot-menu .screenshot-actions button {
    width: 100%;
}

.assignment-pill {
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(21, 97, 109, 0.12);
}

.button-as-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    border-radius: 0;
}

.button-as-link:hover {
    color: var(--accent-2);
}

.lightbox {
    width: min(92vw, 1100px);
    border: 0;
    background: rgba(10, 16, 28, 0.96);
    padding: 24px;
    border-radius: 24px;
}

.lightbox::backdrop {
    background: rgba(10, 16, 28, 0.66);
}

.lightbox-image {
    width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    background: rgba(255, 255, 255, 0.14);
    border: 0;
}

.lightbox-close {
    top: 16px;
    right: 16px;
}

.lightbox-nav.prev {
    left: 16px;
    top: 50%;
}

.lightbox-nav.next {
    right: 16px;
    top: 50%;
}

@media (max-width: 700px) {
    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .thumb-card,
    .thumb-card img {
        min-width: 150px;
        width: 150px;
        height: 100px;
    }
}
