:root {
    color-scheme: light;
    --bg: #f6f0e8;
    --surface: #fffaf3;
    --surface-strong: #ffffff;
    --ink: #26231f;
    --muted: #777069;
    --line: #e8ddd0;
    --accent: #6f8f72;
    --accent-strong: #446449;
    --rose: #d98c7a;
    --shadow: 0 18px 42px rgba(76, 58, 37, 0.12);
    --radius: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(217, 140, 122, 0.16), transparent 34rem),
        linear-gradient(180deg, #fbf7f0 0%, var(--bg) 48%, #efe8de 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    width: min(100%, 520px);
    min-height: 100vh;
    margin: 0 auto;
    padding: max(20px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 750;
}

.brand-mark,
.login-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    color: #fffaf3;
    background: var(--ink);
    font-size: 13px;
    letter-spacing: 0;
}

.icon-link {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(38, 35, 31, 0.08);
    border-radius: 16px;
    background: rgba(255, 250, 243, 0.74);
    box-shadow: 0 8px 18px rgba(76, 58, 37, 0.08);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hero,
.page-head {
    margin: 10px 0 24px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 760;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 10px;
    font-size: 34px;
    line-height: 1.05;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 8px;
    font-size: 22px;
    line-height: 1.15;
}

.hero p,
.page-head p,
.placeholder-panel p,
.login-card p,
.panel-copy {
    color: var(--muted);
    line-height: 1.5;
}

.tile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.tile,
.placeholder-panel,
.shopping-app,
.profile-panel,
.login-card {
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: var(--radius);
    background: rgba(255, 250, 243, 0.82);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.tile {
    min-height: 154px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.tile-icon,
.placeholder-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(38, 35, 31, 0.06);
    font-size: 24px;
}

.tile-title {
    margin-top: 20px;
    font-size: 19px;
    font-weight: 790;
}

.tile-copy {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.3;
}

.back-link {
    display: inline-flex;
    margin-bottom: 24px;
    color: var(--accent-strong);
    font-weight: 720;
}

.placeholder-panel,
.shopping-app,
.profile-panel {
    padding: 22px;
}

.placeholder-icon {
    margin-bottom: 20px;
}

.future-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.future-list span {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.58);
    color: var(--muted);
}

.login-view {
    min-height: calc(100vh - 56px);
    display: grid;
    place-items: center;
}

.login-card {
    width: 100%;
    padding: 28px 22px 22px;
}

.login-mark {
    width: 54px;
    height: 54px;
    border-radius: 20px;
    margin-bottom: 22px;
}

.form-stack,
.shopping-form {
    display: grid;
    gap: 14px;
}

label span {
    display: block;
    margin: 0 0 7px 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 720;
}

input,
select {
    width: 100%;
    min-height: 52px;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 0 15px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.78);
    outline: none;
}

input[type="checkbox"] {
    width: 22px;
    min-height: 22px;
    accent-color: var(--accent-strong);
}

input:focus,
select:focus {
    border-color: rgba(68, 100, 73, 0.54);
    box-shadow: 0 0 0 4px rgba(111, 143, 114, 0.16);
}

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    border: 0;
    border-radius: 18px;
    padding: 0 18px;
    color: #fff;
    background: var(--accent-strong);
    font-weight: 780;
    cursor: pointer;
}

.text-action {
    min-height: auto;
    border-radius: 0;
    padding: 0;
    color: var(--accent-strong);
    background: transparent;
    font-size: 13px;
    font-weight: 780;
}

.category-hint {
    display: block;
    margin: 8px 0 0 4px;
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 760;
}

.wordlist-panel {
    margin-top: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.45);
}

.wordlist-panel summary {
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.wordlist-grid {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.wordlist-group {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.wordlist-group h2 {
    margin-bottom: 7px;
    font-size: 15px;
}

.wordlist-group p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

button:disabled,
.text-action:disabled {
    opacity: 0.62;
}

.message {
    padding: 12px 14px;
    border-radius: 16px;
}

.error {
    color: #7d352b;
    background: #f8ded8;
}

.success {
    color: #2f5f39;
    background: #e3f1df;
}

.profile-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.profile-panel + .profile-panel {
    margin-top: 16px;
}

.profile-form {
    margin-top: 18px;
}

.password-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.password-line input[type="password"],
.password-line input[type="text"] {
    min-width: 0;
}

.password-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 52px;
    padding: 0 2px;
    color: var(--muted);
    white-space: nowrap;
}

.password-check input[type="checkbox"] {
    width: 18px;
    min-height: 18px;
}

.password-check span {
    display: inline;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 720;
}

.profile-avatar {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 20px;
    color: #fffaf3;
    background: var(--accent-strong);
    font-weight: 820;
}

.profile-name,
.profile-username {
    display: block;
}

.profile-name {
    font-size: 18px;
    font-weight: 800;
}

.profile-username {
    margin-top: 2px;
    color: var(--muted);
    font-size: 14px;
}

.shopping-form {
    grid-template-columns: 1fr;
}

.list-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 22px 2px 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 720;
}

.shopping-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.shopping-category-section {
    list-style: none;
}

.shopping-category-details {
    border-bottom: 1px solid var(--line);
}

.shopping-category-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 50px;
    padding: 10px 2px;
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 820;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
}

.shopping-category-details summary span:last-child {
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
}

.shopping-category-items {
    display: grid;
    gap: 10px;
    margin: 0 0 14px;
    padding: 0;
    list-style: none;
}

.shopping-item {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 10px;
    min-height: 66px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.68);
}

.item-check,
.item-delete {
    width: 44px;
    min-height: 44px;
    border-radius: 16px;
    padding: 0;
    color: var(--ink);
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(38, 35, 31, 0.08);
}

.item-check.is-completed {
    color: #fff;
    background: var(--accent);
}

.item-delete {
    color: #8d4438;
}

.item-name {
    display: block;
    font-weight: 780;
    overflow-wrap: anywhere;
}

.item-quantity {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
}

.shopping-item.is-completed .item-name,
.shopping-item.is-completed .item-quantity {
    color: #8e8981;
    text-decoration: line-through;
}

.empty-state {
    margin: 18px 0 0;
    color: var(--muted);
    text-align: center;
}

.danger-action {
    width: 100%;
    margin-top: 18px;
    color: #8d4438;
    background: #f8ded8;
}

.danger-action:disabled {
    opacity: 0.62;
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(38, 35, 31, 0.28);
}

.confirm-dialog {
    width: min(100%, 390px);
    border-radius: 24px;
    padding: 22px;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.confirm-dialog h2 {
    margin-bottom: 8px;
    font-size: 21px;
}

.confirm-dialog p {
    color: var(--muted);
    line-height: 1.45;
}

.dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 18px;
}

.secondary-action {
    color: var(--ink);
    background: #efe7dc;
}

@media (min-width: 520px) {
    .app-shell {
        padding-top: 32px;
    }

    .shopping-form {
        grid-template-columns: 1fr 0.58fr;
    }

    .shopping-form label:nth-of-type(3),
    .shopping-form button {
        grid-column: 1 / -1;
    }
}

@media (max-width: 360px) {
    .tile-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 30px;
    }
}
