:root {
    --primary: #175cd3;
    --primary-deep: #134ba9;
    --primary-border: rgba(23, 92, 211, 0.22);
    --bg: #f5f6f8;
    --panel: #ffffff;
    --text: #202733;
    --muted: #707a89;
    --line: #dfe3e8;
    --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; }
.page-context { margin-bottom: 8px; color: var(--primary); font-size: 13px; line-height: 1.6; font-weight: 700; }
.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;
}
@media (max-width: 640px) {
    .card { padding: 20px 18px; }
    .title { font-size:24px; }
    .captcha-row { grid-template-columns: 1fr; }
}

.guestbook-footer {
    padding: 20px 0 8px;
    color: #8a94a3;
    font-size: 12px;
    line-height: 1.7;
    text-align: center;
}
.guestbook-footer__inner {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}
.guestbook-footer a { color: inherit; text-decoration: none; }
.guestbook-footer a:hover { color: var(--primary); }
.guestbook-footer__divider { width: 1px; height: 12px; background: #d8dde5; }

.theme-default,
.theme-china-red,
.theme-vibrant-orange,
.theme-education-green {
    --bg: #f5f6f8;
    --panel: #fff;
    --text: #25282d;
    --muted: #70798a;
    --line: #dfe3e8;
}
.theme-default {
    --primary: #175cd3;
    --primary-deep: #134ba9;
    --primary-border: rgba(23, 92, 211, .22);
}
.theme-china-red {
    --primary: #a61b29;
    --primary-deep: #80131f;
    --primary-border: rgba(166, 27, 41, .22);
}
.theme-vibrant-orange {
    --primary: #e87524;
    --primary-deep: #c85d13;
    --primary-border: rgba(232, 117, 36, .24);
}
.theme-education-green {
    --primary: #2f8056;
    --primary-deep: #236542;
    --primary-border: rgba(47, 128, 86, .22);
}
.theme-default .card,
.theme-china-red .card,
.theme-vibrant-orange .card,
.theme-education-green .card {
    padding: 30px 32px;
    border: 1px solid var(--line);
    border-top: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: none;
}
.guestbook-card-head {
    position: relative;
}
.theme-default .guestbook-card-head::before,
.theme-china-red .guestbook-card-head::before,
.theme-vibrant-orange .guestbook-card-head::before,
.theme-education-green .guestbook-card-head::before {
    position: absolute;
    inset: 0 auto 0 -32px;
    width: 4px;
    background: var(--primary);
    content: "";
}
.theme-china-red .guestbook-card-head::before {
    width: 7px;
    border-radius: 5px 0 0 5px;
    background: repeating-linear-gradient(
        135deg,
        #a61b29 0 9px,
        #ffffff 9px 14px,
        #456b8f 14px 23px,
        #ffffff 23px 28px
    );
}
.theme-default .guestbook-card-head::before {
    width: 7px;
    border-radius: 5px 0 0 5px;
    background: repeating-linear-gradient(
        135deg,
        #175cd3 0 9px,
        #ffffff 9px 14px,
        #6f8299 14px 23px,
        #ffffff 23px 28px
    );
}
.theme-education-green .guestbook-card-head::before {
    width: 7px;
    border-radius: 5px 0 0 5px;
    background: repeating-linear-gradient(
        135deg,
        #2f8056 0 9px,
        #ffffff 9px 14px,
        #6f8d80 14px 23px,
        #ffffff 23px 28px
    );
}
.theme-vibrant-orange .guestbook-card-head::before {
    width: 7px;
    border-radius: 5px 0 0 5px;
    background: repeating-linear-gradient(
        135deg,
        #e87524 0 9px,
        #ffffff 9px 14px,
        #8a786b 14px 23px,
        #ffffff 23px 28px
    );
}
.theme-default .button,
.theme-china-red .button,
.theme-vibrant-orange .button,
.theme-education-green .button,
.theme-default .field,
.theme-china-red .field,
.theme-vibrant-orange .field,
.theme-education-green .field {
    border-radius: 6px;
    box-shadow: none;
    letter-spacing: 0;
}
.theme-default .field:focus,
.theme-china-red .field:focus,
.theme-vibrant-orange .field:focus,
.theme-education-green .field:focus {
    border-color: var(--primary);
    outline: 0;
    box-shadow: 0 0 0 3px var(--primary-border);
}
.theme-default .guestbook-success-dialog,
.theme-china-red .guestbook-success-dialog,
.theme-vibrant-orange .guestbook-success-dialog,
.theme-education-green .guestbook-success-dialog {
    border-radius: 6px;
}

@media (max-width: 640px) {
    .theme-default .card,
    .theme-china-red .card,
    .theme-vibrant-orange .card,
    .theme-education-green .card {
        padding: 24px 20px;
    }

    .theme-default .guestbook-card-head::before,
    .theme-china-red .guestbook-card-head::before,
    .theme-vibrant-orange .guestbook-card-head::before,
    .theme-education-green .guestbook-card-head::before {
        left: -20px;
    }
}
