:root {
    --ink: #10213f;
    --muted: #71809a;
    --line: #dce6f2;
    --bg: #f5f9fd;
    --panel: rgba(255, 255, 255, .88);
    --blue: #2578f6;
    --cyan: #51c6d9;
    --amber: #f7b955;
    --coral: #f16f6f;
    --green: #62c46e;
    --shadow: 0 16px 45px rgba(41, 76, 121, .14);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 10%, rgba(81, 198, 217, .18), transparent 28rem),
        linear-gradient(180deg, #fbfdff 0%, var(--bg) 55%, #eef6fb 100%);
    min-height: 100vh;
    letter-spacing: 0;
}

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

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

img {
    max-width: 100%;
}

.site-shell main {
    padding-bottom: 86px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 72px;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 max(24px, calc((100vw - 1180px) / 2));
    background: rgba(255, 255, 255, .82);
    border-bottom: 1px solid rgba(220, 230, 242, .9);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    min-width: max-content;
}

.brand-mark,
.bottle-thumb,
.action-icon {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #dff6ff, #ffffff);
    color: var(--blue);
    box-shadow: inset 0 0 0 1px rgba(37, 120, 246, .12);
}

.desktop-nav {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.desktop-nav a,
.ghost-button,
.primary-small {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    white-space: nowrap;
}

.desktop-nav a.is-active,
.desktop-nav a:hover {
    color: var(--blue);
    background: rgba(37, 120, 246, .08);
}

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

.points-pill,
.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: var(--radius);
    background: #edf5ff;
    color: var(--blue);
    font-size: 13px;
    font-style: normal;
    white-space: nowrap;
}

.ghost-button,
.secondary-button {
    color: var(--ink);
    background: rgba(255, 255, 255, .72);
    border: 1px solid var(--line);
}

.primary-small,
.primary-button,
.secondary-button,
.action-card button,
.tiny-button {
    border: 0;
    border-radius: var(--radius);
    min-height: 44px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: normal;
    text-align: center;
}

.primary-small,
.primary-button,
.action-card button {
    background: linear-gradient(135deg, var(--blue), #1f68e8);
    color: #fff;
    box-shadow: 0 10px 24px rgba(37, 120, 246, .24);
}

.secondary-button {
    background: #fff;
    border: 1px solid var(--line);
}

.full {
    width: 100%;
}

.notice-bar,
.flash {
    width: min(1180px, calc(100% - 32px));
    margin: 16px auto 0;
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #fff;
}

.flash-success {
    color: #176b36;
    background: #f0fff4;
    border-color: #ccebd5;
}

.flash-error {
    color: #9d2929;
    background: #fff4f4;
    border-color: #f0cbcb;
}

.hero {
    width: min(1180px, calc(100% - 32px));
    min-height: 560px;
    margin: 24px auto 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 48%);
    align-items: center;
    gap: 28px;
    padding: 60px;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, .92) 0%, rgba(255, 255, 255, .78) 40%, rgba(255, 255, 255, .12) 78%),
        url("../img/ocean-bottle-hero.png") center right / cover no-repeat;
    box-shadow: var(--shadow);
}

.hero-copy {
    max-width: 560px;
    position: relative;
    z-index: 1;
}

.eyebrow {
    display: inline-flex;
    color: var(--blue);
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 10px;
}

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

.hero h1,
.quote-stage h1,
.auth-card h1 {
    font-size: 42px;
    line-height: 1.18;
    margin-bottom: 16px;
}

.hero p,
.quote-stage p,
.auth-card p {
    color: var(--muted);
    line-height: 1.8;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 28px 0 20px;
}

.hero-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero-metrics span {
    padding: 7px 10px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .76);
    border: 1px solid rgba(220, 230, 242, .9);
    color: var(--muted);
    font-size: 13px;
}

.section-wrap,
.profile-wrap,
.bottle-detail,
.compose-wrap,
.auth-stage {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto;
}

.two-column {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
    gap: 22px;
}

.soft-panel,
.profile-card,
.stat-row,
.tabs,
.detail-card,
.comments-panel,
.compose-card,
.auth-card,
.admin-card,
.quote-stage {
    background: var(--panel);
    border: 1px solid rgba(220, 230, 242, .86);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.soft-panel,
.tabs,
.detail-card,
.comments-panel,
.compose-card,
.auth-card,
.admin-card {
    padding: 24px;
}

.action-grid,
.bottle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.action-card,
.bottle-card,
.mini-bottle,
.list-row {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .82);
}

.action-card {
    min-height: 210px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    color: var(--ink);
}

.action-card p {
    color: var(--muted);
    line-height: 1.65;
    flex: 1;
}

.action-icon.blue {
    color: var(--blue);
}

.action-icon.amber {
    color: #a76800;
    background: #fff7df;
}

.mini-list {
    display: grid;
    gap: 10px;
}

.mini-bottle,
.list-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
}

.mini-bottle span,
.list-row span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.mini-bottle em,
.list-row em,
.card-head em,
.detail-meta span {
    color: var(--muted);
    font-size: 13px;
    font-style: normal;
}

.section-title,
.admin-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.bottle-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.bottle-card {
    min-height: 178px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bottle-card p {
    color: #33425f;
    line-height: 1.65;
    overflow-wrap: anywhere;
    flex: 1;
}

.card-head,
.card-foot,
.detail-meta,
.detail-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.card-foot {
    justify-content: space-between;
    color: var(--muted);
    font-size: 13px;
}

.mood-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--cyan);
}

.quote-stage {
    min-height: 360px;
    display: grid;
    align-content: center;
    padding: 54px;
    background:
        linear-gradient(120deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .62)),
        url("../img/ocean-bottle-hero.png") center / cover no-repeat;
}

.profile-wrap {
    display: grid;
    gap: 16px;
}

.profile-card {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 24px;
}

.avatar-sea {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: url("../img/ocean-bottle-hero.png") center / cover no-repeat;
    box-shadow: inset 0 0 0 3px #fff;
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
}

.stat-row div,
.admin-stats div {
    padding: 22px;
    text-align: center;
    border-right: 1px solid var(--line);
}

.stat-row div:last-child,
.admin-stats div:last-child {
    border-right: 0;
}

.stat-row span,
.admin-stats span {
    display: block;
    font-size: 28px;
    font-weight: 800;
}

.stat-row em,
.admin-stats em {
    color: var(--muted);
    font-style: normal;
    font-size: 13px;
}

.tab-buttons {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    margin-bottom: 16px;
}

.tab-buttons button {
    border: 0;
    background: transparent;
    border-bottom: 2px solid transparent;
    padding: 10px 4px;
    color: var(--muted);
    min-width: max-content;
}

.tab-buttons button.is-active {
    color: var(--blue);
    border-bottom-color: var(--blue);
}

.tab-panel {
    display: none;
    gap: 10px;
}

.tab-panel.is-active {
    display: grid;
}

.auth-stage,
.compose-wrap {
    min-height: calc(100vh - 160px);
    display: grid;
    place-items: center;
}

.auth-card,
.compose-card {
    width: min(100%, 620px);
}

.stack-form,
.compose-card {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 8px;
    color: #253554;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-height: 44px;
    padding: 11px 12px;
    background: #fff;
    color: var(--ink);
    outline: none;
}

textarea {
    min-height: 150px;
    resize: vertical;
    line-height: 1.7;
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(37, 120, 246, .62);
    box-shadow: 0 0 0 3px rgba(37, 120, 246, .12);
}

.char-hint,
.muted {
    color: var(--muted);
    font-size: 14px;
}

.center {
    text-align: center;
}

.field-block {
    display: grid;
    gap: 10px;
}

.mood-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.mood-options label {
    display: inline-flex;
    cursor: pointer;
}

.mood-options input {
    position: absolute;
    opacity: 0;
}

.mood-options span {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #fff;
}

.mood-options input:checked + span {
    color: var(--blue);
    border-color: rgba(37, 120, 246, .35);
    background: #eef6ff;
}

.field-grid,
.inline-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.locate-button {
    min-width: 132px;
}

.bottle-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 22px;
    align-items: start;
}

.detail-content {
    font-size: 20px;
    line-height: 1.9;
    overflow-wrap: anywhere;
}

.bottle-image {
    border-radius: var(--radius);
    border: 1px solid var(--line);
    margin: 8px 0 16px;
    max-height: 460px;
    object-fit: cover;
}

.comments-panel {
    position: sticky;
    top: 92px;
}

.comment-list {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.comment-item {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.comment-item p {
    color: #33425f;
    line-height: 1.65;
    margin-bottom: 8px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(16, 33, 63, .34);
}

.modal-card {
    width: min(100%, 420px);
    padding: 24px;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: var(--radius);
    background: #f2f6fb;
}

.mobile-tabbar {
    display: none;
}

.admin-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    background: #f4f7fb;
}

.admin-sidebar {
    min-height: 100vh;
    padding: 22px;
    background: #10213f;
    color: #fff;
    position: sticky;
    top: 0;
}

.admin-sidebar nav {
    display: grid;
    gap: 6px;
    margin: 28px 0;
}

.admin-sidebar a {
    min-height: 40px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    border-radius: var(--radius);
    color: rgba(255, 255, 255, .82);
}

.admin-sidebar a.is-active,
.admin-sidebar a:hover {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.admin-brand {
    padding: 0;
}

.admin-user {
    color: rgba(255, 255, 255, .72);
    display: grid;
    gap: 8px;
}

.admin-main {
    padding: 28px;
    min-width: 0;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 18px;
    overflow: hidden;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.full-row,
.settings-grid .primary-button {
    grid-column: 1 / -1;
}

.switch-line {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 12px;
}

.switch-line input {
    width: 20px;
    min-height: 20px;
}

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

td {
    overflow-wrap: anywhere;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.actions-cell {
    min-width: 220px;
}

.password-reset-form {
    margin-top: 8px;
}

.password-reset-form input {
    width: 110px;
    min-height: 32px;
    padding: 6px 8px;
}

.tiny-button {
    min-height: 32px;
    padding: 0 10px;
    color: #fff;
    background: var(--ink);
}

.search-form,
.inline-admin-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.word-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #fff;
}

.word-chip button {
    border: 0;
    background: #f3f6fa;
    border-radius: var(--radius);
    width: 28px;
    height: 28px;
}

.generated-cards {
    white-space: pre-wrap;
    padding: 14px;
    background: #0f1f38;
    color: #d8f4ff;
    border-radius: var(--radius);
    line-height: 1.8;
}

code {
    color: #0c5fd9;
    background: #eef6ff;
    padding: 2px 6px;
    border-radius: 6px;
}

@media (max-width: 980px) {
    .topbar {
        padding: 0 16px;
    }

    .desktop-nav,
    .top-actions {
        display: none;
    }

    .hero {
        min-height: 540px;
        grid-template-columns: 1fr;
        padding: 34px 24px;
        background:
            linear-gradient(180deg, rgba(255, 255, 255, .94) 0%, rgba(255, 255, 255, .76) 54%, rgba(255, 255, 255, .12) 100%),
            url("../img/ocean-bottle-hero.png") center bottom / cover no-repeat;
        align-items: start;
    }

    .hero h1,
    .quote-stage h1,
    .auth-card h1 {
        font-size: 32px;
    }

    .two-column,
    .bottle-detail,
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .bottle-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .comments-panel {
        position: static;
    }

    .admin-sidebar {
        min-height: auto;
        position: relative;
    }

    .admin-sidebar nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mobile-tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 30;
        height: 66px;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        background: rgba(255, 255, 255, .94);
        border-top: 1px solid var(--line);
        backdrop-filter: blur(14px);
    }

    .mobile-tabbar a {
        display: grid;
        place-items: center;
        gap: 2px;
        color: var(--muted);
        font-size: 12px;
    }

    .mobile-tabbar span {
        font-size: 20px;
    }

    .mobile-tabbar a.is-active {
        color: var(--blue);
    }
}

@media (max-width: 640px) {
    .hero,
    .section-wrap,
    .profile-wrap,
    .bottle-detail,
    .compose-wrap,
    .auth-stage {
        width: min(100% - 20px, 1180px);
        margin-top: 14px;
    }

    .hero {
        min-height: 500px;
    }

    .action-grid,
    .bottle-grid,
    .stat-row,
    .settings-grid,
    .admin-stats,
    .profile-card,
    .field-grid,
    .inline-field {
        grid-template-columns: 1fr;
    }

    .profile-card {
        text-align: center;
        justify-items: center;
    }

    .stat-row div,
    .admin-stats div {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .stat-row div:last-child,
    .admin-stats div:last-child {
        border-bottom: 0;
    }

    .soft-panel,
    .tabs,
    .detail-card,
    .comments-panel,
    .compose-card,
    .auth-card,
    .admin-card,
    .quote-stage {
        padding: 18px;
    }

    .mini-bottle,
    .list-row {
        grid-template-columns: 36px minmax(0, 1fr);
    }

    .mini-bottle em,
    .list-row em {
        grid-column: 2;
    }

    .search-form,
    .inline-admin-form {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .admin-main {
        padding: 16px;
    }
}
