:root {
    --bg: #f4f1ea;
    --bg-strong: #e8dfd1;
    --card: #fffdf8;
    --ink: #2f261d;
    --muted: #706253;
    --accent: #0f766e;
    --accent-strong: #115e59;
    --danger: #b42318;
    --border: #d8cdbd;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Trebuchet MS", sans-serif;
    background: radial-gradient(circle at top right, var(--bg-strong), var(--bg));
    color: var(--ink);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 18px 24px;
    border-bottom: 2px solid var(--border);
    background: rgba(255, 253, 248, 0.95);
    position: sticky;
    top: 0;
}

.topbar h1 {
    margin: 0;
    font-size: 1.35rem;
}

.topbar p {
    margin: 4px 0 0;
    color: var(--muted);
}

.topbar nav {
    display: flex;
    gap: 10px;
}

a {
    color: var(--accent-strong);
    text-decoration: none;
    font-weight: 600;
}

a:hover {
    text-decoration: underline;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

.editor-layout,
.moderator-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 18px;
    max-width: 1200px;
    margin: 0 auto;
}

.editor-layout {
    grid-template-columns: minmax(280px, 420px) 1fr;
}

.moderator-layout {
    grid-template-columns: 2fr 1fr;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

textarea,
input,
select,
button {
    font: inherit;
}

textarea,
input,
select {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
}

button {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    background: var(--accent);
    color: white;
    font-weight: 700;
    cursor: pointer;
}

button:hover {
    background: var(--accent-strong);
}

button:disabled {
    background: #8b9e9c;
    cursor: not-allowed;
}

button.danger {
    background: var(--danger);
}

.status {
    min-height: 1.3em;
    color: var(--muted);
}

.question-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.question-list li {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    background: #fff;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: start;
}

.question-list li.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.1);
}

.question-list li.dragging {
    opacity: 0.6;
}

.question-list li.drag-over {
    outline: 2px dashed var(--accent);
    outline-offset: 2px;
}

.question-list li.empty {
    color: var(--muted);
    justify-content: center;
}

.row-controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

.drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f7f1e7;
    color: var(--muted);
    font-weight: 700;
    user-select: none;
}

.current-card h2 {
    margin-top: 0;
}

.current-question {
    min-height: 220px;
    padding: 20px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    font-size: clamp(1.35rem, 4vw, 2.9rem);
    line-height: 1.25;
    font-weight: 700;
    background: #fffcf7;
}

.position-label {
    margin: 10px 0;
    color: var(--muted);
    font-weight: 600;
}

.nav-buttons {
    display: flex;
    gap: 10px;
}

.side-preview h3 {
    margin-bottom: 6px;
}

.muted {
    color: var(--muted);
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-shell {
    width: min(460px, 96vw);
}

.login-card h1 {
    margin-top: 0;
}

.subline {
    color: var(--muted);
    margin-top: -4px;
}

.error-box {
    border: 1px solid #e79a98;
    background: #fde7e6;
    color: #8f1d18;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 12px;
}

.edit-dialog {
    width: min(640px, 94vw);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    background: var(--card);
}

.edit-dialog::backdrop {
    background: rgba(33, 27, 21, 0.5);
}

.edit-dialog h3 {
    margin: 0;
}

.edit-dialog textarea {
    min-height: 140px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

button.ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--border);
}

button.ghost:hover {
    background: #f5ede0;
}

@media (max-width: 900px) {
    .editor-layout,
    .moderator-layout {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }
}
