:root {
    color-scheme: light;
    --ink: #242725;
    --muted: #6d746f;
    --line: #d9ded6;
    --paper: #fffaf3;
    --panel: #ffffff;
    --leaf: #526b4d;
    --leaf-dark: #334633;
    --berry: #8d4054;
    --gold: #c69445;
    --coffee: #6a4635;
    --mist: #edf1ec;
    --shadow: 0 22px 60px rgba(28, 32, 29, 0.16);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
    background: var(--paper);
    color: var(--ink);
}

body {
    margin: 0;
    min-height: 100vh;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
}

button,
input,
textarea {
    font: inherit;
}

.brand-mark {
    display: block;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #fff7df;
    box-shadow: 0 4px 14px rgba(36, 39, 37, 0.12);
    object-fit: contain;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.button--primary {
    border-color: var(--leaf);
    background: var(--leaf);
    color: #fff;
}

.button--ghost {
    background: rgba(255, 255, 255, 0.72);
    color: var(--leaf-dark);
}

.public-body {
    background: var(--paper);
}

.home-page {
    background: #2e3322;
}

.home-hero {
    position: relative;
    min-height: 60vh;
    min-height: 60svh;
    display: grid;
    align-items: end;
    overflow: hidden;
    isolation: isolate;
    padding-top: 92px;
    background: #d7c69f;
    color: #2e2d1f;
}

.home-hero__background {
    position: absolute;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    background: #d7c69f;
}

.home-hero__blur {
    position: absolute;
    inset: -48px;
    width: calc(100% + 96px);
    height: calc(100% + 96px);
    max-width: none;
    object-fit: cover;
    filter: blur(34px) saturate(1.08);
    transform: scale(1.04);
    opacity: 0.88;
}

.home-hero__image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center center;
}

.home-hero__background::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(180deg, rgba(39, 43, 29, 0.46) 0%, rgba(39, 43, 29, 0.08) 42%, rgba(29, 32, 22, 0.34) 100%),
        radial-gradient(circle at 50% 68%, rgba(255, 247, 223, 0.12), rgba(255, 247, 223, 0) 48%);
}

.home-hero__background--fallback {
    display: grid;
    place-items: center;
    color: rgba(255, 248, 230, 0.82);
    background:
        linear-gradient(160deg, rgba(199, 170, 107, 0.72), rgba(71, 89, 52, 0.86)),
        #7a7d4a;
}

.home-hero__background--fallback .brand-mark {
    width: 120px;
    height: 120px;
    transform: scale(2.2);
}

.home-topbar {
    position: absolute;
    top: max(16px, env(safe-area-inset-top));
    left: max(16px, env(safe-area-inset-left));
    right: max(16px, env(safe-area-inset-right));
    z-index: 2;
    display: flex;
    justify-content: flex-start;
    pointer-events: none;
}

.home-hero__content {
    position: relative;
    z-index: 1;
    width: 100%;
    margin: 0;
    padding: 18px max(16px, env(safe-area-inset-right)) 18px max(16px, env(safe-area-inset-left));
    background: rgba(246, 233, 199, 0.8);
    color: #2e2d1f;
    -webkit-backdrop-filter: blur(10px) saturate(1.04);
    backdrop-filter: blur(10px) saturate(1.04);
}

.home-brand,
.story-logo,
.login-brand,
.admin-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-decoration: none;
}

.home-brand {
    max-width: min(100%, 360px);
    padding: 8px 11px;
    border: 1px solid rgba(255, 250, 232, 0.34);
    border-radius: 8px;
    background: rgba(55, 64, 38, 0.52);
    color: #fff7df;
    font-weight: 780;
    line-height: 1.18;
    text-shadow: 0 1px 16px rgba(20, 24, 14, 0.44);
    box-shadow: 0 12px 34px rgba(31, 34, 22, 0.24);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.home-brand .brand-mark {
    width: 34px;
    height: 34px;
}

.home-hero h1 {
    margin: 0 0 10px;
    max-width: 720px;
    color: #282a1d;
    font-size: clamp(38px, 8vw, 72px);
    line-height: 1;
    letter-spacing: 0;
}

.home-hero p {
    max-width: 620px;
    margin: 0;
    color: rgba(43, 43, 31, 0.9);
    font-size: clamp(16px, 2vw, 21px);
}

.home-stories {
    padding: 28px 16px 54px;
    background: #2e3322;
}

.home-stories__inner {
    width: min(1100px, 100%);
    margin: 0 auto;
}

.home-stories h2 {
    margin: 0 0 16px;
    color: #fff7df;
    font-size: clamp(28px, 5vw, 42px);
    line-height: 1.05;
}

.story-grid {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}

.story-card {
    overflow: hidden;
    border: 0;
    border-radius: 8px;
    background: rgba(246, 233, 199, 0.86);
    color: #2e2d1f;
    box-shadow: 0 18px 44px rgba(31, 34, 22, 0.22);
}

.story-card__image {
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: #d7c69f;
}

.story-card__image img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: var(--home-image-x, 50%) var(--home-image-y, 50%);
    transform: scale(var(--home-image-zoom, 1));
    transform-origin: var(--home-image-x, 50%) var(--home-image-y, 50%);
}

.story-card span {
    display: block;
    padding: 14px 16px 16px;
    font-size: 18px;
    font-weight: 760;
}

.story-shell {
    position: relative;
    height: 100vh;
    height: 100svh;
    min-height: 100vh;
    min-height: 100svh;
    overflow: hidden;
    isolation: isolate;
    background: #d7c69f;
}

.story-background {
    position: absolute;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    background: #d7c69f;
}

.story-background__blur {
    position: absolute;
    inset: -48px;
    width: calc(100% + 96px);
    height: calc(100% + 96px);
    max-width: none;
    object-fit: cover;
    filter: blur(34px) saturate(1.08);
    transform: scale(1.04);
    opacity: 0.88;
}

.story-background::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(180deg, rgba(39, 43, 29, 0.46) 0%, rgba(39, 43, 29, 0.08) 42%, rgba(29, 32, 22, 0.22) 100%),
        radial-gradient(circle at 50% 68%, rgba(255, 247, 223, 0.12), rgba(255, 247, 223, 0) 48%);
}

.story-background--fallback {
    display: grid;
    place-items: center;
    color: rgba(255, 248, 230, 0.82);
    background:
        linear-gradient(160deg, rgba(199, 170, 107, 0.72), rgba(71, 89, 52, 0.86)),
        #7a7d4a;
}

.story-background--fallback .brand-mark {
    width: 120px;
    height: 120px;
    transform: scale(2.2);
}

.story-page {
    overflow: hidden;
    background: #2e3322;
}

.story-topbar {
    position: absolute;
    top: max(16px, env(safe-area-inset-top));
    left: max(16px, env(safe-area-inset-left));
    right: max(16px, env(safe-area-inset-right));
    z-index: 2;
    display: flex;
    justify-content: flex-start;
    pointer-events: none;
}

.story-frame {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100vh;
    height: 100svh;
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    margin: 0;
    overflow: hidden;
}

.story-image-area {
    position: relative;
    min-height: 0;
    overflow: hidden;
    background: rgba(215, 198, 159, 0.38);
}

.story-image-area img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center top;
}

.story-image-area--fallback {
    display: grid;
    place-items: center;
    color: rgba(255, 248, 230, 0.82);
}

.story-image-area--fallback .brand-mark {
    width: 96px;
    height: 96px;
    transform: scale(1.7);
}

.story-content {
    position: relative;
    z-index: 1;
    width: 100%;
    margin: 0;
    padding: 14px max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    border: 0;
    border-radius: 0;
    background: rgba(246, 233, 199, 0.8);
    box-shadow: none;
    color: #2e2d1f;
    -webkit-backdrop-filter: blur(10px) saturate(1.04);
    backdrop-filter: blur(10px) saturate(1.04);
}

.story-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: min(100%, 360px);
    padding: 8px 11px;
    border: 1px solid rgba(255, 250, 232, 0.34);
    border-radius: 8px;
    background: rgba(55, 64, 38, 0.52);
    color: #fff7df;
    font-weight: 780;
    line-height: 1.18;
    text-shadow: 0 1px 16px rgba(20, 24, 14, 0.44);
    box-shadow: 0 12px 34px rgba(31, 34, 22, 0.24);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.story-logo .brand-mark {
    width: 34px;
    height: 34px;
}

.story-kicker {
    margin: 0 0 8px;
    color: #6a723d;
    font-size: 13px;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-kicker {
    margin: 34px 0 10px;
    color: var(--berry);
    font-size: 13px;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.story-header h1 {
    margin: 0;
    color: #282a1d;
    font-size: clamp(19px, 5.1vw, 30px);
    line-height: 1;
    letter-spacing: 0;
}

.story-description {
    margin-top: 10px;
    color: rgba(43, 43, 31, 0.9);
    font-size: 15px;
    line-height: 1.45;
}

.audio-widget {
    margin-top: 12px;
    padding: 10px;
    border: 1px solid rgba(108, 108, 69, 0.18);
    border-radius: 8px;
    background: rgba(255, 248, 229, 0.4);
    box-shadow: none;
}

.audio-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 8px;
}

.audio-play {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 1px solid rgba(255, 250, 232, 0.34);
    border-radius: 8px;
    background: rgba(94, 109, 58, 0.8);
    color: #fff;
    font-size: 13px;
    font-weight: 840;
    cursor: pointer;
}

.audio-play__icon {
    width: 0;
    height: 0;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-left: 14px solid currentColor;
}

.audio-play [data-audio-label] {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audio-widget.is-playing .audio-play__icon {
    width: 14px;
    height: 18px;
    border: 0;
    border-left: 5px solid currentColor;
    border-right: 5px solid currentColor;
}

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

.audio-track input {
    width: 100%;
    min-width: 0;
    accent-color: #5f713b;
}

.audio-rates {
    display: inline-flex;
    align-items: stretch;
    gap: 4px;
    min-width: 0;
}

.audio-rate {
    min-width: 38px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 7px;
    border: 1px solid rgba(95, 113, 59, 0.36);
    border-radius: 6px;
    background: rgba(255, 248, 229, 0.74);
    color: rgba(55, 57, 39, 0.82);
    font-size: 13px;
    font-weight: 820;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease;
}

.audio-rate:not(:disabled):hover,
.audio-rate:not(:disabled):focus-visible {
    border-color: rgba(95, 113, 59, 0.68);
    background: rgba(255, 248, 229, 0.94);
}

.audio-rate.is-selected {
    border-color: rgba(95, 113, 59, 0.82);
    background: rgba(95, 113, 59, 0.82);
    color: #fff;
}

.audio-rate:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.audio-time {
    min-width: 38px;
    color: rgba(55, 57, 39, 0.74);
    font-size: 13px;
    font-weight: 720;
    line-height: 1;
    white-space: nowrap;
}

.audio-time:last-child {
    text-align: right;
}

.audio-empty {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid rgba(108, 108, 69, 0.18);
    border-radius: 8px;
    background: rgba(255, 248, 229, 0.4);
    color: rgba(55, 57, 39, 0.74);
}

.story-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.story-actions .button:only-child {
    grid-column: 1 / -1;
}

.story-page .button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px 12px;
    border-color: rgba(90, 92, 58, 0.26);
    box-shadow: 0 10px 24px rgba(41, 45, 28, 0.16);
    line-height: 1.15;
    font-size: 13px;
    text-align: center;
    white-space: normal;
}

.story-page .button--primary {
    border-color: rgba(255, 250, 232, 0.28);
    background: rgba(93, 111, 62, 0.8);
    color: #fff;
}

.story-page .button--ghost {
    border-color: rgba(105, 96, 62, 0.26);
    background: rgba(255, 248, 229, 0.8);
    color: #343822;
}

.map-frame {
    margin-top: 14px;
    overflow: hidden;
    border: 1px solid rgba(108, 108, 69, 0.18);
    border-radius: 8px;
    background: rgba(255, 248, 229, 0.58);
}

.map-frame iframe {
    display: block;
    width: 100%;
    height: 240px;
    border: 0;
}

.error-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 18px;
    padding: 24px;
    text-align: center;
}

.error-page h1 {
    margin: 0;
    font-size: clamp(34px, 8vw, 64px);
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        linear-gradient(135deg, rgba(82, 107, 77, 0.9), rgba(141, 64, 84, 0.76)),
        url("/media/stories/snegurka.jpg") center / cover;
}

.auth-shell {
    width: min(430px, 100%);
}

.login-panel {
    padding: 28px;
    border-radius: 8px;
    background: rgba(255, 250, 243, 0.94);
    box-shadow: var(--shadow);
}

.login-panel h1 {
    margin: 28px 0 18px;
    font-size: 40px;
    line-height: 1;
}

.login-brand {
    color: var(--leaf-dark);
}

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

label {
    display: grid;
    gap: 7px;
    color: var(--ink);
    font-weight: 720;
}

label span {
    font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="file"],
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 11px 12px;
}

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

label em,
.form-error {
    color: #b3261e;
    font-size: 14px;
    font-style: normal;
}

.form-error {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    background: #fff1ee;
    border: 1px solid #f0c9c2;
}

.muted {
    display: block;
    color: var(--muted);
    font-size: 14px;
}

.admin-body {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    background: #f5f7f4;
}

.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
    background: #26302a;
    color: #fff;
}

.admin-brand {
    color: #fff;
}

.admin-nav {
    display: grid;
    gap: 6px;
}

.admin-nav a,
.admin-logout button {
    width: 100%;
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.82);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.admin-nav a:hover,
.admin-logout button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.admin-logout {
    margin-top: auto;
}

.admin-main {
    width: min(1160px, calc(100% - 36px));
    margin: 0 auto;
    padding: 34px 0 54px;
}

.admin-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.admin-head h1 {
    margin: 0;
    font-size: clamp(32px, 4vw, 48px);
    line-height: 1;
}

.admin-kicker {
    margin: 0 0 8px;
}

.table-panel,
.form-section,
.stats-section,
.user-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(36, 39, 37, 0.06);
}

.table-panel {
    overflow: auto;
}

.data-table,
.mini-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td,
.mini-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.data-table tr:last-child td,
.mini-table tr:last-child td {
    border-bottom: 0;
}

code {
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--mist);
    color: var(--leaf-dark);
    font-size: 0.92em;
}

.qr-download {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--mist);
}

.qr-download small {
    color: var(--muted);
    font-weight: 560;
    overflow-wrap: anywhere;
}

.qr-download__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.qr-download__error {
    color: #b3261e;
}

.table-actions {
    display: flex;
    gap: 12px;
    white-space: nowrap;
}

.table-actions a {
    color: var(--berry);
    font-weight: 760;
    text-decoration: none;
}

.editor-form {
    gap: 18px;
}

.form-section {
    display: grid;
    gap: 16px;
    padding: 20px;
}

.form-section h2,
.stats-section h2,
.user-panel h2 {
    margin: 0;
    font-size: 22px;
}

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

.media-field {
    display: grid;
    align-content: start;
    gap: 10px;
}

.check-line {
    align-content: end;
    grid-template-columns: auto 1fr;
    align-items: center;
    min-height: 72px;
}

.check-line input {
    width: 20px;
    height: 20px;
    accent-color: var(--leaf);
}

.current-media {
    width: 160px;
    height: 110px;
    object-fit: cover;
    border-radius: 8px;
}

.current-media-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.current-media-actions .button {
    width: fit-content;
    min-height: 40px;
    padding: 8px 12px;
    font-size: 14px;
}

.home-crop-editor {
    display: grid;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--mist);
}

.home-crop-editor[hidden] {
    display: none;
}

.home-crop-editor__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.home-crop-editor__head span {
    font-size: 14px;
    font-weight: 820;
}

.home-crop-editor__head .button {
    min-height: 36px;
    padding: 7px 11px;
    font-size: 14px;
}

.home-crop-editor__preview {
    position: relative;
    width: min(100%, 320px);
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 1px solid rgba(82, 107, 77, 0.28);
    border-radius: 8px;
    background: #d7c69f;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.home-crop-editor__preview:active {
    cursor: grabbing;
}

.home-crop-editor__preview img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: var(--home-image-x, 50%) var(--home-image-y, 50%);
    pointer-events: none;
    transform: scale(var(--home-image-zoom, 1));
    transform-origin: var(--home-image-x, 50%) var(--home-image-y, 50%);
}

.home-crop-editor__controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.home-crop-editor__controls label {
    gap: 5px;
}

.home-crop-editor__controls input {
    width: 100%;
    accent-color: var(--leaf);
}

.storage-note {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--mist);
}

.storage-note div {
    display: grid;
    gap: 3px;
}

.storage-note span {
    color: var(--muted);
    font-size: 13px;
}

.storage-note strong {
    font-size: 20px;
    line-height: 1.1;
}

.storage-note p {
    grid-column: 1 / -1;
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.danger-zone {
    margin-top: 24px;
    padding: 18px;
    border: 1px solid #f0c9c2;
    border-radius: 8px;
    background: #fff1ee;
}

.danger-zone button {
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    background: #b3261e;
    color: #fff;
    padding: 10px 14px;
    font-weight: 760;
    cursor: pointer;
}

.narrow-form {
    width: min(520px, 100%);
}

.user-panel {
    display: grid;
    gap: 18px;
    padding: 22px;
}

.flash {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
}

.flash--success {
    border-color: #b8d9bc;
    background: #eff9f0;
}

.flash--warning {
    border-color: #ead39b;
    background: #fff8e6;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stats-cards div {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.stats-cards span {
    display: block;
    color: var(--muted);
    font-size: 14px;
}

.stats-cards strong {
    display: block;
    margin-top: 6px;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1;
}

.stats-section {
    margin-bottom: 18px;
    padding: 20px;
}

.stats-section--collapsible,
.admin-stats-zone--collapsible {
    display: block;
}

.stats-section__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    list-style: none;
    cursor: pointer;
}

.stats-section__summary::-webkit-details-marker {
    display: none;
}

.stats-section__summary::marker {
    content: "";
}

.stats-section__summary h2 {
    min-width: 0;
    margin: 0;
}

.stats-section__summary-action {
    min-width: 128px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--mist);
    color: var(--leaf-dark);
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.stats-section__summary-action::before {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 160ms ease;
}

.stats-section__summary-close {
    display: none;
}

.stats-section--collapsible[open] > .stats-section__summary .stats-section__summary-action::before,
.admin-stats-zone--collapsible[open] > .stats-section__summary .stats-section__summary-action::before {
    transform: rotate(-135deg) translateY(-1px);
}

.stats-section--collapsible[open] > .stats-section__summary .stats-section__summary-open,
.admin-stats-zone--collapsible[open] > .stats-section__summary .stats-section__summary-open {
    display: none;
}

.stats-section--collapsible[open] > .stats-section__summary .stats-section__summary-close,
.admin-stats-zone--collapsible[open] > .stats-section__summary .stats-section__summary-close {
    display: inline;
}

.stats-section__summary:focus-visible {
    outline: 3px solid rgba(82, 107, 77, 0.3);
    outline-offset: 4px;
}

.story-period-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.story-period-card {
    margin-bottom: 0;
}

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

.bar-list {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.bar-row {
    display: grid;
    grid-template-columns: minmax(120px, 220px) 1fr 58px;
    align-items: center;
    gap: 12px;
}

.bar-row div {
    height: 12px;
    border-radius: 999px;
    background: var(--mist);
    overflow: hidden;
}

.bar-row i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--leaf), var(--berry));
}

.story-hours-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.story-hour-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.story-hour-card header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.story-hour-card h3 {
    margin: 0;
    font-size: 17px;
    line-height: 1.2;
}

.story-hour-card header strong {
    color: var(--berry);
    font-size: 22px;
    line-height: 1;
}

.story-hour-card .bar-list {
    gap: 9px;
    margin-top: 0;
}

.story-hour-card .bar-row {
    grid-template-columns: minmax(82px, 1fr) 1fr 38px;
    gap: 8px;
}

.story-hour-card .bar-row span {
    font-size: 13px;
}

.admin-stats-zone {
    margin-top: 22px;
    padding: 20px;
    border: 1px solid #d9ddda;
    border-radius: 8px;
    background: #ecefed;
}

.admin-stats-zone > h2 {
    margin: 0 0 16px;
    font-size: 24px;
}

.admin-stats-zone > .stats-section__summary h2 {
    font-size: 24px;
}

.admin-stats-zone--collapsible[open] > .stats-section__summary {
    margin-bottom: 16px;
}

.admin-stats-zone .stats-cards {
    margin-bottom: 18px;
}

.admin-stats-zone .stats-section {
    background: #fff;
}

.mini-table td:last-child {
    width: 90px;
    text-align: right;
    font-weight: 800;
}

@media (max-width: 900px) {
    .admin-body {
        display: block;
    }

    .admin-sidebar {
        position: static;
        height: auto;
        gap: 14px;
    }

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

    .admin-main {
        width: min(100% - 28px, 1160px);
    }

    .stats-cards,
    .stats-columns,
    .story-period-grid,
    .form-grid,
    .home-crop-editor__controls,
    .storage-note {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .home-hero {
        min-height: 58vh;
        min-height: 58svh;
        padding-top: 82px;
    }

    .story-header h1 {
        font-size: clamp(22px, 7.7vw, 30px);
    }

    .audio-widget {
        padding: 10px;
    }

    .audio-controls {
        grid-template-columns: minmax(0, 1fr) minmax(178px, 0.86fr);
        gap: 6px;
    }

    .audio-play,
    .audio-rate {
        min-height: 48px;
        font-size: 13px;
    }

    .audio-play {
        gap: 8px;
        padding-inline: 8px;
    }

    .audio-rates {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        width: 100%;
        gap: 3px;
    }

    .audio-rate {
        min-width: 0;
        padding-inline: 3px;
    }

    .admin-head {
        display: grid;
    }

    .admin-nav {
        grid-template-columns: 1fr;
    }

    .bar-row {
        grid-template-columns: 1fr;
    }

    .bar-row strong {
        justify-self: end;
    }
}

@media (pointer: coarse), (any-pointer: coarse) {
    .story-page .audio-controls {
        grid-template-columns: minmax(0, 1fr) minmax(178px, 0.86fr);
        gap: 6px;
    }

    .story-page .audio-play,
    .story-page .audio-rate {
        min-height: 48px;
        font-size: 13px;
    }

    .story-page .audio-play {
        gap: 8px;
        padding-inline: 8px;
    }

    .story-page .audio-rates {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        width: 100%;
        gap: 3px;
    }

    .story-page .audio-rate {
        min-width: 0;
        padding-inline: 3px;
    }
}
