* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    line-height: 1.6;
    color: #333;
    background: #fff;
}

header {
    background: #b30000;
    color: #fff;
    padding: 1rem;
    text-align: center;
}

header h1 {
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header h1 a {
    color: #fff;
    font-family: Georgia, "Times New Roman", Times, serif;
    text-decoration: none;
}

header p {
    font-family: Arial, sans-serif;
    font-size: 1rem;
}

nav {
    background: #f4f4f4;
    padding: 1rem;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
}

nav a {
    text-decoration: none;
    color: #b30000;
    font-weight: bold;
}

nav a:hover,
nav a:focus {
    color: #004aad;
}

.section {
    padding: 2rem 1rem;
    max-width: 40rem;
    margin: 0 auto;
}

.section h2,
.section h3 {
    font-family: Georgia, "Times New Roman", Times, serif;
    color: #b30000;
    font-weight: normal;
    margin-bottom: 1rem;
}

.section h3 {
    font-size: 1.2rem;
    margin-top: 1.5rem;
}

.section p {
    margin-bottom: 1rem;
}

.highlight {
    background: #f4f4f4;
    padding: 1rem;
    border-left: 5px solid #b30000;
    margin: 1rem 0;
}

.highlight p {
    margin: 0 0 0.75rem;
    white-space: pre-wrap;
}

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

form label {
    display: block;
    font-weight: bold;
    margin: 1rem 0 0.35rem;
}

input[type="text"],
input[type="email"],
select,
textarea {
    width: 100%;
    font-size: 16px;
    padding: 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #333;
    background: #fff;
}

textarea {
    resize: vertical;
}

fieldset {
    border: 1px solid #ddd;
    margin: 1rem 0;
    padding: 0.75rem 1rem 1rem;
}

legend {
    font-family: Georgia, "Times New Roman", Times, serif;
    color: #b30000;
    padding: 0 0.25rem;
}

label.choice {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    font-weight: normal;
    margin: 0.15rem 0;
    padding: 0.4rem 0;
}

label.choice input {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0.2rem 0 0;
    flex: none;
}

.req {
    color: #b30000;
    font-weight: bold;
    margin-right: 0.2rem;
}

label.consent input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.15rem;
    flex: none;
}

label.consent {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    font-weight: normal;
    margin: 1.25rem 0;
}

.card-preview {
    display: block;
    width: 100%;
    max-width: 360px;
    height: auto;
    margin: 0.5rem 0;
    border: 1px solid #ccc;
}

.captcha {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin: 1rem 0 0.25rem;
}

.captcha img {
    width: 220px;
    height: 72px;
    border: 1px solid #ccc;
    background: #fff;
    margin: 0;
}

.captcha label {
    flex: 1;
    min-width: 10rem;
    margin: 0;
}

.captcha input {
    font-size: 1.25rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.captcha button.secondary {
    width: auto;
    margin: 0;
}

button {
    display: inline-block;
    background: #b30000;
    color: #fff;
    border: 0;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
}

a.donate {
    display: inline-block;
    background: #b30000;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    font-weight: bold;
    text-decoration: none;
}

a.donate:hover,
a.donate:focus {
    background: #8b0000;
    color: #fff;
}

button:hover,
button:focus {
    background: #8b0000;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: 2px solid #004aad;
    outline-offset: 2px;
}

.error {
    background: #fff4f4;
    border-left: 5px solid #b30000;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
}

.counts,
.form-list {
    list-style: none;
    padding: 0;
}

.counts li,
.form-list li {
    padding: 0.25rem 0;
}

.form-list a {
    color: #b30000;
    font-weight: bold;
}

.hp {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

footer {
    background: #b30000;
    color: #fff;
    text-align: center;
    padding: 1rem;
    margin-top: 2rem;
}

.section.wide {
    max-width: 52rem;
}

.admin-card,
.q-card {
    border: 1px solid #ddd;
    padding: 1rem;
    margin: 1rem 0;
}

.admin-card h3,
.q-card h3 {
    font-family: Georgia, "Times New Roman", Times, serif;
    color: #b30000;
    font-weight: normal;
    margin-bottom: 0.5rem;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
}

.badge-public {
    background: #e7f6e7;
    color: #146c14;
}

.badge-private {
    background: #f4f4f4;
    color: #555;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: end;
    margin-top: 0.75rem;
}

.row-actions input[type="text"] {
    width: 14rem;
    max-width: 100%;
}

button.secondary {
    background: #f4f4f4;
    color: #333;
}

button.secondary:hover,
button.secondary:focus {
    background: #e4e4e4;
}

.option-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    margin: 0.35rem 0;
}

.option-row input[type="text"] {
    flex: 1;
}

.option-row label {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    font-weight: normal;
    margin: 0;
    white-space: nowrap;
}

.hint {
    color: #555;
    font-size: 0.95rem;
}

nav form {
    margin: 0;
}

.section.builder-screen {
    max-width: none;
    width: 100%;
    margin: 0;
}

.builder {
    display: grid;
    grid-template-columns: 14rem minmax(28rem, 1fr) 42rem;
    gap: 1.25rem;
    align-items: start;
}

.palette,
.traits {
    background: #f7f7f7;
    border: 1px solid #ddd;
    padding: 0.75rem;
}

.palette h3,
.traits h3 {
    font-family: Georgia, "Times New Roman", Times, serif;
    color: #b30000;
    font-weight: normal;
    margin-bottom: 0.6rem;
}

.palette button,
.traits > button,
.builder .traits > button[type="submit"] {
    width: 100%;
    margin: 0.25rem 0;
    text-align: left;
}

.component {
    display: flex;
    gap: 0.4rem;
    align-items: flex-start;
    margin: 0.35rem 0;
}

.component .nudge {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: none;
}

.component .nudge button {
    width: auto;
    margin: 0;
    padding: 0.3rem 0.55rem;
    background: #f4f4f4;
    color: #333;
    font-size: 0.85rem;
}

.component button.block {
    flex: 1;
    width: auto;
    min-width: 0;
    margin: 0;
}

.builder button.block {
    overflow: visible;
    height: auto;
    white-space: normal;
}

.traits .option-edit {
    display: block;
    margin: 0.85rem 0;
}

.traits .option-edit input.option-text {
    display: block;
    width: 100%;
    max-width: none;
    min-width: 36rem;
    box-sizing: border-box;
}

.traits .option-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.35rem;
}

.builder .traits .option-edit button[type="submit"],
.builder .traits .option-actions button[type="submit"] {
    width: auto;
    margin: 0;
    text-align: center;
}

.traits .option-actions label {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    font-weight: normal;
    margin: 0;
    white-space: nowrap;
}

.palette button {
    background: #fff;
    color: #333;
    border: 1px solid #ccc;
}

.palette button:hover,
.palette button:focus {
    background: #f4f4f4;
}

.canvas {
    border: 1px solid #ddd;
    min-height: 24rem;
    padding: 0.75rem 0.75rem 1rem;
    background: #fff;
}

.block {
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 0.65rem 0.75rem;
    margin: 0.2rem 0;
    cursor: pointer;
}

.block.selected {
    border-color: #b30000;
    background: #fff8f8;
}

.preview-title {
    font-family: Georgia, "Times New Roman", Times, serif;
    color: #b30000;
    font-weight: normal;
    font-size: 1.6rem;
    margin-bottom: 0.4rem;
}

.canvas input,
.canvas select,
.canvas textarea,
.canvas label.choice,
.canvas label.consent {
    pointer-events: none;
}

.preview-send {
    display: inline-block;
    background: #b30000;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    margin: 0.75rem;
}

.palette button:disabled {
    opacity: 0.45;
    cursor: default;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    nav ul {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    button {
        width: 100%;
    }
}
