:root {
    --bg-1: #f9f4ff;
    --bg-2: #fff7fb;
    --card: #ffffff;
    --card-soft: #fffaf2;
    --line: #eadff5;
    --line-strong: #d8cdea;
    --text: #2e2540;
    --text-soft: #4e4564;
    --muted: #7a718f;
    --primary: #7a4de8;
    --primary-dark: #6439cf;
    --primary-soft: #9268f5;
    --success-bg: #eaf8ee;
    --success-text: #1f7a39;
    --error-bg: #fdecec;
    --error-text: #a32626;
    --shadow: 0 14px 34px rgba(70, 40, 120, 0.10);
    --shadow-soft: 0 8px 20px rgba(70, 40, 120, 0.06);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, #ffe9f2 0%, transparent 28%),
        radial-gradient(circle at top right, #efe7ff 0%, transparent 24%),
        linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
    min-height: 100vh;
}

body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

a {
    color: var(--primary);
}

a:hover {
    color: var(--primary-dark);
}

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 14px;
    padding: 14px 22px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-soft));
    box-shadow: 0 10px 22px rgba(122, 77, 232, 0.25);
    text-decoration: none;
}

button:hover,
.button-link:hover {
    background: linear-gradient(135deg, var(--primary-dark), #7d55e6);
    color: #fff;
}

button:focus-visible,
.button-link:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(122, 77, 232, 0.12);
}

.container,
.page-shell {
    width: min(100%, 920px);
    margin: 0 auto;
}

.container {
    max-width: 760px;
    margin-top: 40px;
    margin-bottom: 40px;
    background: var(--card);
    padding: 32px;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.page-shell {
    padding: 28px 18px 48px;
}

.login-shell {
    width: 100%;
    max-width: 520px;
}

.login-card,
.hero-card,
.form-card,
.entry-card,
.content-card,
.nav-card,
.empty-state {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.login-card,
.hero-card {
    background: linear-gradient(135deg, #fff8fc 0%, #ffffff 55%, #fffaf2 100%);
}

.login-card {
    padding: 32px;
}

.hero-card {
    padding: 24px;
    margin-bottom: 22px;
}

.form-card,
.entry-card {
    padding: 26px;
}

.content-card {
    padding: 28px;
}

.nav-card {
    margin-top: 22px;
    background: rgba(255, 255, 255, 0.75);
    padding: 18px;
}

.empty-state {
    padding: 56px 24px;
    text-align: center;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-card .brand {
    display: block;
    text-align: center;
    margin-bottom: 28px;
}

.brand-badge {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), #a77cff);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.login-card .brand-badge {
    width: 68px;
    height: 68px;
    margin: 0 auto 14px;
    border-radius: 20px;
    font-size: 30px;
    box-shadow: 0 10px 24px rgba(122, 77, 232, 0.22);
}

.brand h1,
h1 {
    margin: 0;
    color: var(--primary);
}

.brand h1 {
    font-size: 26px;
}

.login-card .brand h1 {
    margin-bottom: 8px;
    font-size: 30px;
}

.brand p,
.small-note,
.footer-note,
.hint,
.muted,
.nav-center,
.meta-pill,
.upload-name,
.legal-links {
    color: var(--muted);
}

.brand p {
    margin: 3px 0 0;
    font-size: 14px;
}

h1 {
    margin-top: 0;
}

h2,
.section-title {
    margin-top: 0;
    color: var(--primary);
}

h3 {
    color: var(--text);
}

.content-card h3 {
    margin-top: 28px;
}

p,
li {
    line-height: 1.65;
}

ul {
    padding-left: 20px;
}

p {
    margin-bottom: 24px;
}

.hero-card h2 {
    margin-bottom: 10px;
    font-size: 30px;
    color: var(--text);
}

.hero-card p {
    margin: 0;
    color: var(--text-soft);
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.meta-pill {
    background: #ffffff;
    border: 1px solid var(--line);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 14px;
}

.top-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.top-actions.column {
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.top-actions form {
    margin: 0;
}

.back-link,
.logout-link,
.admin-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.back-link,
.logout-link {
    padding: 10px 14px;
    color: var(--primary);
    font-weight: bold;
}

.admin-link {
    color: var(--muted);
    font-size: 13px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.6);
}

.logout-link {
    font-size: 16px;
    line-height: 1;
}

.admin-link.subtle {
    font-size: 12px;
    opacity: 0.75;
    padding-right: 4px;
    border: 0;
    background: transparent;
}

.guest-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #fff;
    font-weight: bold;
    background: linear-gradient(135deg, var(--primary), var(--primary-soft));
    padding: 12px 18px;
    border-radius: 14px;
    box-shadow: 0 10px 22px rgba(122, 77, 232, 0.25);
}

.guest-button:hover,
.back-link:hover,
.logout-link:hover,
.admin-link:hover {
    border-color: #d7c8f4;
}

.admin-link.subtle:hover {
    border-color: transparent;
    color: var(--primary);
    opacity: 1;
}

.message {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: 14px;
}

.message.success,
.success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid #caead3;
}

.message.error,
.error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid #f3caca;
}

.form-group {
    margin-bottom: 18px;
}

.secondary-button {
    padding: 10px 14px;
    font-size: 14px;
    border-radius: 12px;
    box-shadow: none;
}

.drawing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.drawing-header label {
    margin-bottom: 0;
}

.drawing-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.drawing-color-picker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.75);
    color: var(--text-soft);
    font-size: 14px;
    font-weight: bold;
}

.drawing-color-picker input[type="color"] {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
}

.drawing-pad {
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,248,252,0.98)),
        repeating-linear-gradient(0deg, transparent 0, transparent 27px, rgba(122, 77, 232, 0.06) 27px, rgba(122, 77, 232, 0.06) 28px);
    padding: 10px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.drawing-pad canvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
    background: #fffdfd;
    cursor: crosshair;
    touch-action: none;
}

.drawing-display {
    background: linear-gradient(180deg, #fffdfd 0%, #fff7fb 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-soft);
}

.drawing-display img {
    display: block;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    border-radius: 12px;
    background: #fff;
}

.drawing-field.is-error .drawing-pad {
    border-color: #e29191;
    box-shadow: 0 0 0 3px rgba(227, 111, 111, 0.12);
}

.drawing-error {
    display: none;
    margin: 10px 0 0;
    color: var(--error-text);
    font-size: 14px;
}

.drawing-field.is-error .drawing-error {
    display: block;
}

.embedded-drawing {
    margin-top: 10px;
}


label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
}

.label-note {
    color: var(--muted);
    font-weight: normal;
    font-size: 13px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    box-sizing: border-box;
    font-size: 16px;
    background: #fff;
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

input[type="file"] {
    cursor: pointer;
}

textarea {
    resize: vertical;
    min-height: 130px;
}

.field-card,
.answer-item {
    background: var(--card-soft);
    border: 1px solid #f0e5d6;
    border-radius: var(--radius-lg);
    padding: 18px;
}

.field-card {
    margin-bottom: 16px;
}

.color-picker-row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: center;
}

.color-picker-row.centered {
    justify-content: center;
}

.color-picker-control {
    position: relative;
    width: 188px;
    min-width: 188px;
    height: 140px;
    border-radius: 28px;
    box-shadow: var(--shadow-soft);
}

.color-picker-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.color-picker-face {
    width: 100%;
    height: 100%;
    border-radius: 28px;
    border: 1px solid var(--line-strong);
    background: #ff7eb6;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 18px;
    color: #fff;
    font-weight: bold;
    letter-spacing: 0.02em;
    box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.32);
}

.color-picker-face span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(46, 37, 64, 0.22);
    backdrop-filter: blur(4px);
}

.favorite-color-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.favorite-color-swatch {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    border: 3px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 10px 20px rgba(46, 37, 64, 0.12);
    background: #ff7eb6;
}

.favorite-color-label {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 4px;
}

.favorite-color-value {
    font-weight: bold;
    letter-spacing: 0.08em;
    color: var(--text);
}

.favorite-color-swatch.small {
    width: 34px;
    height: 34px;
    border-radius: 12px;
}

.answer-color {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

.submit-row {
    margin-top: 22px;
}

.footer-note,
.hint,
.small-note,
.nav-center,
.upload-name,
.legal-links {
    font-size: 14px;
}

.small-note {
    margin-top: 8px;
}

.hint {
    margin-top: 18px;
    text-align: center;
}

.legal-links {
    margin-top: 18px;
}

.legal-links a {
    text-decoration: none;
    margin-right: 14px;
}

.section {
    margin-bottom: 28px;
}

.section:last-child {
    margin-bottom: 0;
}

.answer-list {
    display: grid;
    gap: 16px;
}

.question,
.upload-label {
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--text);
}

.answer {
    color: #43385b;
    white-space: pre-wrap;
    word-break: break-word;
}

.upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.upload-card,
.upload-item {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 14px;
    box-shadow: var(--shadow-soft);
}

.upload-card {
    text-align: center;
}

.upload-card img,
.upload-item img {
    width: 100%;
    height: auto;
    max-height: 420px;
    object-fit: contain;
    border-radius: 12px;
    display: block;
    margin-bottom: 12px;
    background: #f4f4f4;
}

.lightbox-trigger {
    cursor: zoom-in;
}

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(20, 16, 30, 0.88);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 9999;
}

.lightbox.is-open {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
}

.lightbox-content img {
    display: block;
    max-width: 95vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    background: #fff;
}

.lightbox-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    padding: 0;
    background: #fff;
    color: #333;
    font-size: 26px;
    line-height: 1;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}

.lightbox-hint {
    margin-top: 12px;
    text-align: center;
    color: #eee;
    font-size: 14px;
}

.nav-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.nav-button,
.nav-disabled {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    text-align: center;
    padding: 13px 16px;
    border-radius: 14px;
    text-decoration: none;
    font-weight: bold;
}

.nav-button {
    background: linear-gradient(135deg, var(--primary), var(--primary-soft));
    color: #fff;
    box-shadow: 0 10px 22px rgba(122, 77, 232, 0.25);
}

.nav-button:hover {
    background: linear-gradient(135deg, var(--primary-dark), #7d55e6);
    color: #fff;
}

.nav-disabled {
    background: #ddd5ef;
    color: #7d7397;
    cursor: default;
}

.nav-center {
    flex: 1;
    text-align: center;
    min-width: 180px;
}

.jump-form {
    margin-top: 12px;
}

.jump-label {
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: bold;
    color: var(--text-soft);
}

.jump-select {
    max-width: 320px;
    margin: 0 auto;
    text-align: center;
    text-align-last: center;
}

.jump-submit {
    margin-top: 10px;
}

.empty-state h2 {
    margin-top: 0;
    color: var(--primary);
}

.small-input {
    max-width: 120px;
}

.inline-form {
    display: inline-block;
    margin: 0;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
}

.badge.active {
    background: #e8f7ec;
    color: #1c7c36;
}

.badge.inactive {
    background: #fdecec;
    color: #a32626;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 24px;
    background: #fff;
}

th,
td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f3f3f7;
}

.answer-question {
    font-weight: bold;
    margin-bottom: 6px;
}

.entry-meta,
.empty-state,
.plain-link {
    color: #666;
}

.upload-item img {
    margin-bottom: 10px;
}

.admin-topnav {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

@media (max-width: 640px) {
    .page-shell {
        padding: 24px 14px 40px;
    }

    .hero-card,
    .form-card,
    .entry-card,
    .content-card,
    .nav-card,
    .login-card {
        padding: 18px;
        border-radius: 18px;
    }

    .hero-card h2 {
        font-size: 25px;
    }

    .top-actions,
    .top-actions.column {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .guest-button,
    .back-link,
    .logout-link,
    .admin-link,
    .nav-button,
    .nav-disabled,
    .secondary-button,
    .top-actions form button {
        width: 100%;
    }

    .nav-center {
        order: -1;
        width: 100%;
        margin-bottom: 4px;
    }

    .jump-select {
        max-width: none;
    }

    .color-picker-row {
        align-items: stretch;
    }

    .color-picker-control {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 560px) {
    .login-card .brand h1 {
        font-size: 26px;
    }

    .login-card .brand-badge {
        width: 60px;
        height: 60px;
        font-size: 26px;
    }
}
