* {
    box-sizing: border-box
}

html {
    color-scheme: dark
}

body {
    margin: 0;
    background: #101315;
    color: #edf2ef;
    font: 16px/1.6 Arial, sans-serif
}

header,
main {
    max-width: 1480px;
    margin: auto;
    padding: 28px 32px
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2d3436;
    gap: 20px
}

.brand {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px
}

.brand span {
    display: block;
    color: #93a19a;
    letter-spacing: 0;
    font-weight: 400
}

section {
    margin-bottom: 48px
}

.section-title {
    display: flex;
    align-items: center;
    gap: 18px
}

.section-title span {
    border: 1px solid #3c4842;
    border-radius: 50px;
    padding: 2px 12px;
    color: #a7b6ae
}

h1 {
    font-size: clamp(26px, 3vw, 38px);
    font-weight: 500;
    line-height: 1.2
}

h2 {
    font-weight: 500;
    font-size: 26px;
    line-height: 1.3;
    margin: 12px 0
}

p {
    white-space: normal;
    overflow-wrap: anywhere
}

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

.card {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 22px;
    padding: 22px;
    background: #191e20;
    border-radius: 18px;
    border: 1px solid
}

.on {
    border-color: #2c9360;
    box-shadow: 0 0 16px #33c87820, inset 0 0 12px #33c8780a
}

.off {
    border-color: #a0474c;
    box-shadow: 0 0 16px #e5516020, inset 0 0 12px #e551600a
}

.thumbs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: start;
    gap: 7px
}

.photo {
    padding: 0;
    background: none;
    border: 0;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 3/4
}

.photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover
}

.status {
    font-size: 14px;
    color: #6be8a0
}

.off .status {
    color: #ff9297
}

.info p {
    color: #bdc8c1;
    font-size: 14px
}

.parameters {
    border-top: 1px solid #35403a;
    padding-top: 12px
}

.button,
button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    font: inherit;
    cursor: pointer;
    padding: 10px 18px;
    background: #a6f7c6;
    color: #10251a;
    border: 1px solid transparent;
    border-radius: 9px
}

button:disabled {
    opacity: .5;
    cursor: wait
}

.secondary {
    background: transparent;
    color: #d6e2dc;
    border-color: #49544f
}

.danger {
    background: #582a30;
    color: #ffd3d6
}

.empty,
.no-photo {
    color: #97a69e
}

.no-photo {
    grid-column: 1/-1;
    padding: 20px
}

nav,
.toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap
}

.toolbar {
    align-items: center
}

dialog {
    border: 1px solid #46564d;
    border-radius: 16px;
    background: #1b2220;
    color: #edf2ef;
    padding: 24px;
    max-height: 90dvh;
    max-width: calc(100vw - 24px);
    width: 640px;
    overflow: auto
}

dialog::backdrop {
    background: #000c
}

#gallery {
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    background: #080b0df5;
    padding: 50px 60px;
    overflow: hidden
}

#large {
    width: 100%;
    height: calc(100% - 34px);
    object-fit: contain;
    touch-action: pan-y
}

#close,
#prev,
#next {
    position: absolute;
    background: #222b;
    color: white;
    font-size: 32px;
    padding: 4px 14px
}

#close {
    right: 20px;
    top: 12px
}

#prev {
    left: 10px;
    top: 45%
}

#next {
    right: 10px;
    top: 45%
}

#counter {
    text-align: center;
    color: #c4cfc8
}

.login {
    max-width: 460px;
    margin: 8vh auto
}

.login form {
    display: grid;
    gap: 18px
}

label {
    display: block;
    margin: 12px 0;
    color: #c9d8cf
}

input,
textarea,
select {
    display: block;
    width: 100%;
    font: inherit;
    background: #111715;
    color: #f1f7f3;
    border: 1px solid #46564d;
    border-radius: 8px;
    padding: 11px;
    margin-top: 6px
}

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

.board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px
}

.dropzone {
    min-height: 180px;
    border: 1px dashed #536359;
    border-radius: 14px;
    padding: 14px
}

.admin-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    background: #242e28;
    padding: 14px;
    border-radius: 10px;
    cursor: grab
}

.admin-card img {
    width: 48px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px
}

.admin-card strong {
    flex: 1
}

.admin-card button {
    padding: 6px 10px;
    font-size: 14px
}

.admin-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap
}

.dialog-title {
    display: flex;
    align-items: center;
    justify-content: space-between
}

#canvas {
    width: 100%;
    display: block;
    touch-action: none;
    height: auto
}

.saved-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0
}

.saved-photos img {
    width: 60px;
    height: 80px
}

.saved-photos button {
    display: block;
    padding: 4px;
    font-size: 14px
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid #e6d898;
    outline-offset: 3px
}

@media(max-width:1100px) {
    .cards {
        grid-template-columns: 1fr
    }
}

@media(max-width:600px) {

    header,
    main {
        padding: 20px 14px
    }

    .card {
        padding: 14px;
        gap: 14px
    }

    .board {
        grid-template-columns: 1fr
    }

    .admin-card {
        flex-wrap: wrap
    }

    .admin-actions {
        width: 100%
    }

    .info h2 {
        font-size: 22px
    }

    .button,
    button {
        padding: 9px 12px
    }

    #gallery {
        padding: 55px 32px
    }

    .card .button {
        width: 100%
    }

    .thumbs {
        gap: 4px
    }

    header {
        align-items: flex-start
    }

    .brand {
        font-size: 12px
    }
}

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

    .thumbs {
        max-width: 100%
    }
}

/* Атмосфера и порядок элементов карточки */
body {
    background: radial-gradient(ellipse at 15% 0, #321b2b 0, transparent 48%), radial-gradient(ellipse at 95% 65%, #281820 0, transparent 45%), #130e13;
    color: #f3e8ec
}

header {
    border-bottom-color: #49303d
}

.brand {
    color: #d9b8c5
}

.brand span {
    color: #b299a5
}

h1,
.card-name {
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 400
}

h1 {
    color: #f6e5ec;
    letter-spacing: .2px
}

.section-title span {
    border-color: #624451;
    color: #d1aebb
}

.card {
    background: linear-gradient(145deg, #2a1e28, #1d161e);
    border-radius: 20px;
    row-gap: 12px
}

.card-name {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    font-size: 32px;
    color: #f6e3eb;
    overflow-wrap: anywhere
}

.thumbs {
    grid-column: 1;
    grid-row: 1 / span 2
}

.info {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start
}

.info p {
    color: #d1bdc7;
    font-size: 16px;
    margin: 10px 0
}

.info .button {
    margin-top: auto
}

.parameters {
    border-color: #4d3543
}

.photo {
    border-radius: 7px
}

.photo img {
    transition: transform .25s
}

.photo:hover img {
    transform: scale(1.04)
}

.on {
    border-color: #508b68;
    box-shadow: 0 0 18px #68ca8c24, inset 0 0 16px #65b77b08
}

.off {
    border-color: #a25264;
    box-shadow: 0 0 18px #d35a7626, inset 0 0 16px #d35a7608
}

.status {
    color: #a6d9b5
}

.off .status {
    color: #ef9dad
}

.button,
button {
    background: #dfb4c5;
    color: #29151f;
    border-radius: 10px
}

.secondary {
    background: #ffffff03;
    color: #edd6df;
    border-color: #735363
}

.danger {
    background: #582a30;
    color: #ffd3d6
}

.empty,
.no-photo {
    color: #bca3b0
}

dialog {
    background: #241b24;
    border-color: #785268;
    color: #f5e4ec
}

input,
textarea,
select {
    background: #171118;
    border-color: #6c4e60;
    color: #f3e6ed
}

label {
    color: #d9bfcc
}

.admin-card {
    background: #302330
}

.dropzone {
    border-color: #725263
}

fieldset {
    border: 1px solid #684a5a;
    border-radius: 12px;
    margin: 20px 0;
    padding: 14px
}

legend {
    padding: 0 8px
}

.social-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 24px 0 8px
}

.social-link {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 10px;
    padding: 18px 10px;
    border: 1px solid #745568;
    border-radius: 14px;
    background: #382637;
    color: #f5dce7;
    text-decoration: none;
    font-size: 14px
}

.social-link:hover {
    background: #513247
}

.social-link svg {
    width: 34px;
    height: 34px
}

#bookingName {
    color: #d8b4c4;
    font-family: Georgia, serif;
    font-size: 24px;
    margin-top: 0
}

#bookingDialog {
    width: 520px
}

.dialog-title button {
    flex-shrink: 0
}

@media(max-width:600px) {
    .card {
        grid-template-columns: minmax(0, 1fr);
        padding: 20px;
        gap: 16px
    }

    .card-name {
        grid-column: 1;
        grid-row: 1;
        text-align: center;
        font-size: 34px
    }

    .thumbs {
        grid-column: 1;
        grid-row: 2;
        gap: 8px
    }

    .info {
        grid-column: 1;
        grid-row: 3;
        align-items: stretch
    }

    .status {
        text-align: center;
        font-size: 14px
    }

    .info p {
        margin: 4px 0 14px
    }

    .info .button {
        margin-top: 6px;
        width: 100%
    }

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

@media(prefers-reduced-motion:reduce) {
    .photo img {
        transition: none
    }
}

.users-page {
    max-width: 900px
}

.user-form {
    display: flex;
    align-items: end;
    gap: 16px;
    flex-wrap: wrap
}

.user-form label {
    flex: 1;
    min-width: 200px
}

.user-form button {
    margin-bottom: 12px
}

.user-card {
    padding: 20px;
    background: #2a1e28;
    border: 1px solid #725263;
    border-radius: 14px;
    margin: 16px 0
}

.user-card h3 {
    overflow-wrap: anywhere
}

.user-card .status {
    display: inline-block;
    margin-left: 12px
}

.error {
    color: #ffabb8
}

/* Главная: статичный фон, шапка и характеристики */
body:has(.site-background) {
    isolation: isolate;
    background: #130e13
}

.site-background {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: var(--desktop-bg);
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    background-color: #130e13
}

.public-header {
    justify-content: center;
    min-height: 90px;
    align-items: center;
    border-bottom: 0;
    padding-top: 24px;
    padding-bottom: 12px
}

.main-site-button {
    min-width: 230px;
    text-align: center;
    background: #2d1c2be0;
    border-color: #a97c92;
    box-shadow: 0 4px 24px #0003
}

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

.status-light {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #71ed99;
    box-shadow: 0 0 8px #71ed99;
    animation: status-glow 1.8s ease-in-out infinite
}

.off .status-light {
    background: #ff7489;
    box-shadow: 0 0 8px #ff7489
}

@keyframes status-glow {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .35
    }
}

.profile-details {
    width: 100%;
    margin: 12px 0 18px
}

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

.trait {
    background: #ffffff05;
    border: 1px solid #79526665;
    border-radius: 10px;
    padding: 9px 11px;
    min-width: 0
}

.trait dt {
    font-size: 14px;
    color: #baa1af
}

.trait dd {
    font-size: 16px;
    font-weight: 600;
    color: #f1d9e4;
    margin: 3px 0 0;
    overflow-wrap: anywhere
}

.trait:last-child:nth-child(odd) {
    grid-column: 1/-1
}

.info .extra-details {
    font-size: 14px;
    padding-top: 12px;
    color: #c9b4c0
}

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

.traits-form label {
    min-width: 0
}

.traits-form label:last-child {
    grid-column: 1/-1
}

@media(max-width:600px) {
    .info .status {
        justify-content: center
    }

    .public-header {
        padding: 20px 14px 10px;
        min-height: 80px
    }

    .main-site-button {
        min-width: 230px
    }
}

@media(prefers-reduced-motion:reduce) {
    .status-light {
        animation: none
    }
}

/* Яркое свечение и центрирование заголовков */
.card.on {
    border-color: green;
    box-shadow: 0 0 15px rgb(0, 255, 33)
}

.card.off {
    border-color: red;
    box-shadow: 0 0 15px rgb(255, 0, 0)
}

.section-title {
    justify-content: center;
    text-align: center
}

.section-title h1 {
    width: 100%
}

.save-notice {
    padding: 12px 14px;
    border: 1px solid #69af82;
    background: #20372a;
    color: #c4f3d2;
    border-radius: 10px;
    margin: 14px 0 0
}

.save-notice.error {
    border-color: #be6177;
    background: #43232c;
    color: #ffd2dd
}

.save-notice[hidden] {
    display: none
}

.main-site-button {
    border-color: green;
    box-shadow: 0 0 15px rgb(0, 255, 33)
}

.save-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap
}

.save-actions .save-notice {
    margin: 0;
    padding: 8px 12px
}

.save-actions button {
    flex-shrink: 0
}

@media(max-width:600px) {
    .site-background {
        background-image: var(--mobile-bg)
    }

    .save-actions .save-notice {
        font-size: 14px
    }
}

/* Полупрозрачные карточки и характеристики в одну строку */
.card {
    background: rgba(29, 18, 29, .68)
}

.trait-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px
}

.trait {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 11px
}

.trait dt {
    flex-shrink: 0
}

.trait dd {
    margin: 0;
    text-align: right;
    font-weight: 600
}

.trait:last-child:nth-child(odd) {
    grid-column: auto
}

/* Три ряда характеристик с фиксированным порядком */
.trait-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr))
}

.trait-height {
    grid-column: 1;
    grid-row: 1
}

.trait-weight {
    grid-column: 2;
    grid-row: 1
}

.trait-age {
    grid-column: 1;
    grid-row: 2
}

.trait-bust {
    grid-column: 2;
    grid-row: 2
}

.trait-grid .trait-hair {
    grid-column: 1/-1;
    grid-row: 3
}

.trait {
    gap: 7px;
    padding: 8px
}

.trait dt {
    flex-shrink: 1;
    min-width: 0
}

.trait dd {
    flex-shrink: 0;
    max-width: 60%
}

.trait-bust dt {
    font-size: 13px
}

/* Цвет волос всегда занимает оба столбца, включая правило последней ячейки. */
.trait-grid .trait.trait-hair,
.trait-grid .trait.trait-hair:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    grid-row: 3
}

#gallery {
    background: rgba(8, 11, 13, .72)
}

#gallery::backdrop {
    background: rgba(0, 0, 0, .12)
}

/* Статус в углу, запись у нижнего края карточки. */
.card {
    position: relative;
    padding-top: 52px;
    align-items: stretch
}

.card>.status {
    position: absolute;
    right: 18px;
    top: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    line-height: 1.4
}

.card .info {
    align-self: stretch;
    min-height: 0
}

.card .info>.button {
    margin-top: auto;
    margin-bottom: 0
}

.card .profile-details {
    margin-bottom: 18px
}

@media(max-width:600px) {
    .card {
        padding-top: 48px;
        grid-template-rows: auto auto minmax(0, 1fr)
    }

    .card>.status {
        right: 16px;
        top: 13px
    }

    .card .info>.button {
        margin-top: auto
    }

    .card .info {
        padding-top: 0
    }
}

/* Имя и статус: одна строка на компьютере, две на телефоне. */
.card {
    padding-top: 22px
}

.card-heading {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0
}

.card-heading .card-name {
    margin: 0;
    min-width: 0;
    font-size: 30px
}

.card-heading>.status {
    position: static;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    font-size: 14px;
    line-height: 1.4;
    white-space: nowrap
}

@media(max-width:600px) {
    .card {
        padding-top: 20px
    }

    .card-heading {
        grid-column: 1;
        grid-row: 1;
        flex-direction: column;
        justify-content: center;
        gap: 8px;
        text-align: center
    }

    .card-heading .card-name {
        font-size: 34px
    }

    .card-heading>.status {
        justify-content: center
    }
}

#gallery[data-loading="true"]::after {
    content: "Загрузка фото…";
    position: absolute;
    left: 50%;
    bottom: 70px;
    transform: translateX(-50%);
    padding: 5px 12px;
    border-radius: 8px;
    background: #161116bb;
    color: #f5e4ec;
    font-size: 14px;
    pointer-events: none
}

.profile-details {
    margin-top: 0px
}

.trait {
    padding: 8px 12px
}