:root {
    --bg: #f6f0e6;
    --surface: #fffdf8;
    --ink: #2b2418;
    --muted: #6f6454;
    --line: #e4d8c6;
    --accent: #c45c26;
    --accent-dark: #9a3f16;
    --danger: #b42318;
    --liked: #efe4c8;
    --radius: 14px;
    --shadow: 0 8px 24px rgba(43, 36, 24, 0.08);
    --pad: max(16px, env(safe-area-inset-left));
    --pad-r: max(16px, env(safe-area-inset-right));
    --top: env(safe-area-inset-top);
    --bottom: env(safe-area-inset-bottom);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
}

body {
    font-size: 17px;
    line-height: 1.45;
    padding-bottom: calc(24px + var(--bottom));
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--accent-dark);
}

h1,
h2 {
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 0.5rem;
}

h1 {
    font-size: 1.7rem;
}

h2 {
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-top: 1.6rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(10px + var(--top)) var(--pad-r) 10px var(--pad);
    background: #2b2418;
    color: #fffdf8;
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    color: inherit;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.02em;
}

.topbar-link {
    color: #f0d7c4;
    text-decoration: none;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
}

.content {
    padding: 18px var(--pad-r) 24px var(--pad);
    max-width: 40rem;
    margin: 0 auto;
}

.content.has-fab {
    padding-bottom: calc(96px + var(--bottom));
}

.flash,
.error,
.empty {
    margin: 12px var(--pad) 0;
    padding: 12px 14px;
    border-radius: var(--radius);
}

.content .flash,
.content .error,
.content .empty,
.login-wrap .error {
    margin-left: 0;
    margin-right: 0;
}

.flash {
    background: #e7f3e4;
    color: #215c2a;
}

.error {
    background: #fdecea;
    color: var(--danger);
}

.empty {
    background: var(--surface);
    color: var(--muted);
}

.crumb {
    margin: 0 0 12px;
}

.crumb a {
    text-decoration: none;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.meta {
    color: var(--muted);
    margin: 0 0 1rem;
    font-size: 0.95rem;
}

.search {
    display: flex;
    gap: 8px;
    margin: 0 0 16px;
    position: relative;
}

.search input[type="search"] {
    flex: 1;
    min-height: 48px;
    padding: 12px 40px 12px 14px;
}

.search-clear {
    position: absolute;
    right: 96px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--muted);
    font-size: 1.4rem;
}

.search button {
    min-width: 80px;
}

.cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.card {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    min-height: 76px;
    padding: 8px 12px 8px 8px;
}

.card-thumb {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    background: #ece2d2;
}

.card-thumb.placeholder {
    display: block;
    background:
        radial-gradient(circle at 30% 30%, #f3e6d4, #d9c4a4);
}

.card-title {
    display: block;
    font-weight: 650;
}

.card-meta {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 2px;
}

.hero {
    width: 100%;
    max-height: 240px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 14px;
    background: #ece2d2;
}

.liked {
    margin: 0 0 1rem;
    padding: 12px 14px;
    background: var(--liked);
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
}

.checklist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.check-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    min-height: 44px;
}

.check-item input {
    width: 22px;
    height: 22px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--accent);
}

.check-item input:checked + span {
    text-decoration: line-through;
    color: var(--muted);
}

.prose {
    white-space: pre-wrap;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.inline {
    margin: 0;
}

.stack {
    display: grid;
    gap: 16px;
}

label,
legend {
    display: grid;
    gap: 6px;
    font-weight: 650;
}

.hint {
    font-weight: 400;
    color: var(--muted);
    font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="search"],
textarea {
    width: 100%;
    font: inherit;
    color: inherit;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    min-height: 48px;
    appearance: none;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus,
textarea:focus,
button:focus-visible {
    outline: 3px solid rgba(196, 92, 38, 0.35);
    outline-offset: 1px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 18px;
    border-radius: 12px;
    border: 0;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    flex: 1;
}

.btn.primary {
    background: var(--accent);
    color: #fff;
}

.btn.primary:active {
    background: var(--accent-dark);
}

.btn.secondary {
    background: transparent;
    color: var(--accent-dark);
    border: 2px solid var(--accent);
}

.btn.secondary:active {
    background: rgba(196, 92, 38, 0.12);
}

.btn.danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid #f0c4c0;
}

.sticky-save {
    width: 100%;
    position: sticky;
    bottom: calc(12px + var(--bottom));
    box-shadow: var(--shadow);
}

.photo-field {
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 14px;
    display: grid;
    gap: 12px;
    background: var(--surface);
}

.file-label {
    position: relative;
    width: 100%;
    font-weight: 700;
}

.file-label:focus-within {
    outline: 3px solid rgba(196, 92, 38, 0.35);
    outline-offset: 1px;
}

.file-label input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 0;
}

.preview {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 10px;
}

.preview.hidden {
    display: none;
}

.check-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    min-height: 44px;
}

.check-inline input {
    width: 22px;
    height: 22px;
    accent-color: var(--accent);
}

.fab {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(16px + var(--bottom));
    min-height: 56px;
    min-width: 56px;
    padding: 0 22px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(196, 92, 38, 0.4);
    z-index: 20;
}

.page-login {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px var(--pad);
}

.login-wrap {
    width: min(100%, 22rem);
}

.login-wrap h1 {
    font-size: 2rem;
}

.lede {
    color: var(--muted);
    margin: 0 0 1.4rem;
}

@media (min-width: 700px) {
    .hero {
        max-height: 320px;
    }

    .btn {
        flex: 0 0 auto;
        min-width: 140px;
    }
}
