:root {
    --paper: #fffaf3;
    --bg: #f3e4d2;
    --ink: #2a1a12;
    --muted: #746053;
    --line: #eadccb;
    --brass: #e0ac2b;
    --bean: #5c3317;
    --bean-deep: #3e2415;
    --seal: #8d3d32;
    --good: #2c6b45;
    --shadow: 0 24px 60px rgba(74, 42, 24, 0.12);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100%;
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 0 0, rgba(224, 172, 43, 0.2), transparent 28%),
        radial-gradient(circle at 100% 0, rgba(141, 61, 50, 0.1), transparent 26%),
        radial-gradient(circle at 80% 100%, rgba(92, 51, 23, 0.08), transparent 32%);
}

body, button, input, textarea, select { font: inherit; }

button, label, a, summary { touch-action: manipulation; }

button, input, textarea, select { -webkit-appearance: none; appearance: none; }

::selection { background: #f0d59a; }

.wrap {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    padding: 16px 14px 28px;
}

body.admin .wrap { max-width: 760px; }

body.gate .wrap { max-width: 440px; }

@supports (padding: max(0px)) {
    .wrap {
        padding-top: calc(16px + env(safe-area-inset-top));
        padding-bottom: calc(28px + env(safe-area-inset-bottom));
    }
}

.sheet {
    background: rgba(255, 250, 243, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 28px;
    padding: 22px 16px 16px;
    box-shadow: var(--shadow);
}

.hero { text-align: center; margin-bottom: 8px; }

.logo {
    width: 68px;
    height: 68px;
    margin: 0 auto 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 35% 30%, #8a5a34, var(--bean-deep) 72%);
    box-shadow: inset 0 0 0 2px rgba(224, 172, 43, 0.75), 0 10px 20px rgba(62, 36, 21, 0.18);
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--seal);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

h1, h2, .star-caption, .thanks h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
    letter-spacing: -0.03em;
}

h1 {
    margin: 0;
    font-size: 32px;
    line-height: 1.15;
}

.lede {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.place {
    display: flex;
    gap: 10px;
    align-items: center;
    text-align: left;
    margin: 16px 0 4px;
    padding: 12px;
    border-radius: 16px;
    background: #f6ecdf;
}

.place b { display: block; font-size: 15px; line-height: 1.3; }

.place small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }

.dot {
    width: 10px;
    height: 10px;
    flex: none;
    border-radius: 50%;
    background: var(--seal);
    box-shadow: 0 0 0 4px rgba(141, 61, 50, 0.14);
}

.block { margin: 18px 0; }

h2 {
    margin: 0 0 10px;
    font-size: 22px;
    line-height: 1.2;
}

.req { color: var(--seal); }

.opt {
    margin-left: 6px;
    color: var(--muted);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
}

.rate { text-align: center; }

.rate-box {
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
}

.stars {
    position: relative;
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    gap: 2px;
}

.star-scale {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stars input,
.pill input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.stars label {
    color: #e6d5c3;
    font-size: 46px;
    line-height: 1;
    padding: 2px 3px;
    cursor: pointer;
}

.stars input:checked ~ label {
    color: var(--brass);
    text-shadow: 0 8px 16px rgba(224, 172, 43, 0.35);
}

@media (hover: hover) and (pointer: fine) {
    .stars label:hover,
    .stars label:hover ~ label {
        color: var(--brass);
        text-shadow: 0 8px 16px rgba(224, 172, 43, 0.35);
    }
}

.stars input:focus + label { outline: 3px solid rgba(224, 172, 43, 0.55); outline-offset: 2px; border-radius: 8px; }

.star-caption {
    min-height: 1.3em;
    margin: 8px 0 0;
    font-size: 18px;
}

.q { margin: 0 0 12px; }

.qlabel, .field label, .search label {
    display: block;
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 700;
}

.pills { display: flex; flex-wrap: wrap; }

.pill { position: relative; display: inline-flex; margin: 0 8px 8px 0; }

.pill label {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-size: 15px;
    line-height: 1.2;
    cursor: pointer;
}

.pill input:checked + label {
    background: var(--bean);
    border-color: var(--bean);
    color: var(--paper);
}

.pill input:focus + label { box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.45); }

.field { margin: 0 0 14px; }

.field input, .field textarea, .search input, .linkbox {
    width: 100%;
    border: 1px solid #e7d7c6;
    border-radius: 14px;
    background: #fff;
    color: var(--ink);
    font-size: 16px;
    padding: 12px 14px;
}

.field textarea { min-height: 120px; resize: vertical; line-height: 1.4; }

.field textarea.short { min-height: 96px; }

.field input:focus, .field textarea:focus, .search input:focus, .linkbox:focus {
    outline: none;
    border-color: #c4622d;
    box-shadow: 0 0 0 4px rgba(196, 98, 45, 0.15);
}

.hint, .fine {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.fine { margin-top: 12px; text-align: center; }

.button, .danger, .ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 16px;
    padding: 14px 16px;
    font-weight: 700;
    font-size: 17px;
    cursor: pointer;
    text-decoration: none;
}

.button {
    color: #fffaf3;
    background: linear-gradient(180deg, #6f4328, #4a2618);
    box-shadow: 0 12px 24px rgba(74, 38, 24, 0.22);
}

.button:active { transform: translateY(1px); }

.button:disabled { opacity: 0.7; cursor: wait; }

.alert {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: 16px;
    background: #fdeceb;
    color: #7d2a24;
}

.alert ul { margin: 0; padding-left: 18px; }

.alert li + li { margin-top: 4px; }

.thanks { text-align: center; padding: 12px 6px 8px; }

.thanks-mark {
    width: 84px;
    height: 84px;
    margin: 4px auto 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3e6d4;
}

.thanks h2 { margin: 0 0 8px; font-size: 34px; }

.thanks p { margin: 0 0 8px; color: var(--muted); }

.thanks .place { text-align: left; }

.textlink {
    display: inline-block;
    margin-top: 14px;
    color: var(--bean);
    font-weight: 700;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand .logo { width: 46px; height: 46px; margin: 0; flex: none; }

.brand .logo svg { width: 26px; height: 26px; }

.brand strong { display: block; font-size: 16px; }

.brand span { display: block; color: var(--muted); font-size: 13px; }

.logout { margin: 0; }

.quiet {
    width: auto;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.banner {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: 16px;
    background: #fff4df;
    border: 1px solid #efd3a4;
    color: #6a4b16;
}

.banner.ok {
    background: #eef6f0;
    border-color: #cfe3d6;
    color: #24573a;
}

.stats {
    display: flex;
    gap: 8px;
    margin: 0 0 14px;
}

.stat {
    flex: 1;
    min-width: 0;
    padding: 12px 10px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--line);
    text-align: center;
}

.stat b {
    display: block;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 26px;
    line-height: 1;
}

.stat span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }

.panel {
    margin: 0 0 14px;
    padding: 14px;
    border-radius: 20px;
    background: rgba(255, 250, 243, 0.94);
    box-shadow: var(--shadow);
}

.panel h2 { font-size: 24px; }

.qr { margin: 0 0 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }

.qr:last-child { margin: 0; padding: 0; border: 0; }

.qr p { margin: 0 0 6px; }

.qr small { color: var(--muted); }

.linkbox { background: #fffaf3; font-size: 14px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
}

.chip.is-on { background: var(--bean); border-color: var(--bean); color: var(--paper); }

.search { display: flex; gap: 8px; margin: 0 0 14px; }

.search input { flex: 1; min-width: 0; }

.search button {
    width: auto;
    min-height: 48px;
    padding: 0 16px;
    border: 0;
    border-radius: 14px;
    background: var(--bean);
    color: var(--paper);
    font-weight: 700;
    cursor: pointer;
}

.list-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: baseline;
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 14px;
}

.rcard {
    margin: 0 0 12px;
    padding: 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-left: 5px solid var(--brass);
    background: var(--paper);
    box-shadow: 0 10px 28px rgba(74, 42, 24, 0.08);
}

.rcard.low { border-left-color: var(--seal); }
.rcard.mid { border-left-color: var(--brass); }
.rcard.high { border-left-color: var(--good); }
.rcard.is-target { box-shadow: 0 0 0 3px rgba(141, 61, 50, 0.25); }

.rcard-top, .rperson, .confirm-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.rcard-top > div { min-width: 0; }

.rplace { margin-top: 4px; font-weight: 700; overflow-wrap: anywhere; }

time { color: var(--muted); font-size: 13px; white-space: nowrap; }

.rperson { margin-top: 10px; align-items: center; }

.rperson a { color: var(--bean); font-weight: 700; text-decoration: none; }

.muted { color: var(--muted); }

.starbar { letter-spacing: 1px; font-size: 18px; }

.starbar .on { color: var(--brass); }
.starbar .off { color: #e6d5c3; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.tag {
    border-radius: 999px;
    background: #f6eee4;
    color: #5c4638;
    padding: 4px 8px;
    font-size: 13px;
}

.tag.bad { background: #fdeceb; color: #8a332c; }
.tag.good { background: #e7f3ec; color: #246143; }

.rtext, .rwish {
    margin: 10px 0 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.rwish { color: #5c4638; }

.rwish span { font-weight: 700; }

.rdelete { margin: 8px 0 0; }

.linkbtn {
    border: 0;
    background: transparent;
    color: var(--seal);
    padding: 6px 0;
    font-weight: 700;
    cursor: pointer;
}

.confirm {
    margin-top: 10px;
    padding: 10px;
    border-radius: 14px;
    background: #fdeceb;
}

.confirm p { margin: 0 0 8px; }

.confirm-row { align-items: center; }

.danger {
    width: auto;
    min-height: 44px;
    padding: 8px 14px;
    background: var(--seal);
    color: #fff;
    font-size: 15px;
}

.ghost {
    width: auto;
    min-height: 44px;
    padding: 8px 12px;
    background: transparent;
    color: var(--ink);
    font-size: 15px;
}

.pager { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }

.pager a {
    flex: 1;
    text-align: center;
    text-decoration: none;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    font-weight: 700;
}

.empty {
    padding: 28px 10px;
    text-align: center;
    color: var(--muted);
}

@media (max-width: 360px) {
    h1 { font-size: 28px; }
    .stars label { font-size: 40px; }
    .star-scale { width: 100%; }
    .sheet { border-radius: 22px; }
}

@media (min-width: 720px) {
    body.admin .stats { gap: 12px; }
}

@media print {
    body { background: #fff; }
    .noprint { display: none !important; }
    .sheet, .panel, .rcard { box-shadow: none; }
}
