:root {
    --primary: #0050b3;
    --primary-deep: #003f8f;
    --primary-border: rgba(0,80,179,0.18);
    --bg: #f5f7fa;
    --panel: #ffffff;
    --text: #1f2937;
    --muted: #8c8c8c;
    --line: #e5e7eb;
    --danger: #dc2626;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "PingFang SC","Microsoft YaHei",sans-serif; background: var(--bg); color: var(--text); }
.shell { width:min(780px, calc(100% - 24px)); margin: 28px auto; }
.card { position: relative; padding: 26px 28px; border-radius: 20px; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 8px 18px rgba(15,23,42,0.04); }
.title { margin:0; font-size:28px; line-height:1.3; font-weight:700; }
.desc { margin-top:10px; color:#667085; font-size:14px; line-height:1.85; }
.grid { display:grid; gap:18px; margin-top:24px; }
.field-label { display:block; margin-bottom:8px; color:#475467; font-size:13px; line-height:1.6; font-weight:700; }
.field {
    width:100%; min-height:44px; padding:0 14px; border:1px solid #dbe2ea; border-radius:12px; background:#fff;
    color:#1f2937; font-size:14px; line-height:1.4;
}
.field.is-error {
    border-color: rgba(220, 38, 38, 0.52);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}
.field.is-valid {
    border-color: rgba(5, 150, 105, 0.52);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}
textarea.field { min-height: 180px; padding: 12px 14px; resize: vertical; }
.textarea-wrap { position: relative; }
.textarea-counter {
    position: absolute;
    right: 14px;
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.92);
    color: #98a2b3;
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
    pointer-events: none;
    transition: color 0.18s ease, background 0.18s ease;
}
.textarea-counter.is-near-limit {
    color: #b45309;
    background: rgba(254, 243, 199, 0.92);
}
.textarea-counter.is-over-limit {
    color: #dc2626;
    background: rgba(254, 226, 226, 0.92);
}
.captcha-row { display:grid; grid-template-columns: 180px 120px auto; gap:12px; align-items:center; justify-content:start; }
.captcha-input {
    width: 180px;
    min-width: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.captcha-image { width:120px; height:40px; border-radius:10px; border:1px solid #dbe2ea; background:#fff; display:block; cursor:pointer; }
.captcha-inline-error {
    margin-top: 0;
    min-height: 20px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}
.captcha-inline-error.is-valid { color: #059669; }
.button {
    display:inline-flex; align-items:center; justify-content:center; min-height:42px; padding:0 18px; border-radius:999px;
    border:1px solid transparent; background:var(--primary); color:#fff; font-size:14px; font-weight:700; cursor:pointer;
}
.button:hover { background: var(--primary-deep); }
.button.secondary { background:#fff; color:var(--primary); border-color: var(--primary-border); }
.button.secondary:hover { background:#fff; color:var(--primary-deep); border-color: var(--primary-border); }
.actions { display:flex; gap:12px; flex-wrap:wrap; margin-top:24px; }
.error { margin-top:8px; color:var(--danger); font-size:12px; line-height:1.7; }
.error.is-valid { color: #059669; }
.error[hidden] { display: none; }
.form-error {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.16);
    color: var(--danger);
    font-size: 13px;
    line-height: 1.8;
    font-weight: 700;
}
.form-success {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(5, 150, 105, 0.08);
    border: 1px solid rgba(5, 150, 105, 0.16);
    color: #047857;
    font-size: 13px;
    line-height: 1.8;
    font-weight: 700;
}
.hidden { display: none !important; }
.guestbook-success-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
}
.guestbook-success-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.46);
}
.guestbook-success-dialog {
    position: relative;
    width: min(460px, calc(100% - 28px));
    margin: min(16vh, 120px) auto 0;
    padding: 24px 22px 20px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 22px 40px rgba(15, 23, 42, 0.2);
}
.guestbook-success-dialog h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.3;
}
.guestbook-success-dialog p {
    margin: 12px 0 0;
    color: #475467;
    font-size: 15px;
    line-height: 1.8;
}
.guestbook-success-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
}
.theme-china-red {
    --primary: #b22222;
    --primary-deep: #7a1212;
    --primary-border: rgba(178, 34, 34, 0.14);
    --bg: #faf7f5;
    --panel: #ffffff;
    --text: #2a1f1f;
    --muted: #8f7a7a;
    --line: #efe2df;
}

.theme-education-green {
    --primary: #2f8f57;
    --primary-deep: #1f6b40;
    --primary-border: rgba(47, 143, 87, 0.14);
    --bg: #f4faf6;
    --panel: #ffffff;
    --text: #1f2f28;
    --muted: #74867c;
    --line: #dde7df;
}

.theme-vibrant-orange {
    --primary: #f28c28;
    --primary-deep: #c96a10;
    --primary-border: rgba(242, 140, 40, 0.16);
    --bg: #fff9f3;
    --panel: #ffffff;
    --text: #35261d;
    --muted: #907669;
    --line: #f2e3d6;
}
.theme-china-red .card {
    border-top: 3px solid rgba(178, 34, 34, 0.56);
}
.theme-china-red .button {
    border-radius: 12px;
    letter-spacing: 0.03em;
}
.theme-china-red .field {
    border-radius: 10px;
}
.theme-education-green .card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 24px;
    bottom: 24px;
    width: 4px;
    border-radius: 999px;
    background: rgba(47, 143, 87, 0.18);
}
.theme-education-green .button {
    box-shadow: 0 8px 18px rgba(47, 143, 87, 0.12);
}
.theme-education-green .button.secondary {
    box-shadow: none;
}
.theme-education-green .field {
    border-radius: 14px;
}
.theme-vibrant-orange .card {
    border-radius: 22px;
    box-shadow: 0 12px 26px rgba(201, 106, 16, 0.06);
}
.theme-vibrant-orange .button {
    border-radius: 14px;
    box-shadow: 0 10px 22px rgba(242, 140, 40, 0.18);
}
.theme-vibrant-orange .button.secondary {
    box-shadow: none;
}
.theme-vibrant-orange .field {
    border-radius: 16px;
}
@media (max-width: 640px) {
    .card { padding: 20px 18px; }
    .title { font-size:24px; }
    .captcha-row { grid-template-columns: 1fr; }
}
