:root {
  --ink: #263044;
  --muted: #697386;
  --paper: #fffaf1;
  --white: #ffffff;
  --coral: #ff6b6b;
  --coral-dark: #e94f57;
  --yellow: #ffd166;
  --mint: #58d6b0;
  --blue: #5b8def;
  --lavender: #9b7ede;
  --line: #eadfce;
  --shadow: 0 18px 45px rgba(70, 54, 40, 0.12);
  --small-shadow: 0 8px 20px rgba(70, 54, 40, 0.1);
  --radius: 26px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 20%, rgba(255, 209, 102, 0.18), transparent 22rem),
    radial-gradient(circle at 92% 38%, rgba(88, 214, 176, 0.15), transparent 25rem),
    var(--paper);
  font-family: "M PLUS Rounded 1c", "Yu Gothic", sans-serif;
  line-height: 1.7;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-decor {
  position: fixed;
  z-index: -1;
  width: 220px;
  height: 220px;
  border: 3px dashed rgba(255, 107, 107, 0.18);
  border-radius: 48% 52% 65% 35%;
  pointer-events: none;
}

.page-decor--one {
  top: -90px;
  left: -70px;
  transform: rotate(15deg);
}

.page-decor--two {
  right: -100px;
  bottom: 5%;
  border-color: rgba(91, 141, 239, 0.16);
  transform: rotate(-20deg);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
}

.brand__icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 18px;
  box-shadow: 4px 5px 0 var(--ink);
  font-size: 26px;
  transform: rotate(-3deg);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 20px;
  letter-spacing: 0.02em;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
}

.header-link {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.header-link:hover {
  color: var(--coral-dark);
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  display: grid;
  min-height: 530px;
  align-items: center;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 60px;
  padding: 46px 7%;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 247, 231, 0.92));
  border: 2px solid var(--ink);
  border-radius: 40px;
  box-shadow: 10px 12px 0 var(--ink);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--coral-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(38px, 5vw, 68px);
  line-height: 1.3;
  letter-spacing: -0.04em;
}

.hero h1 em {
  position: relative;
  color: var(--coral);
  font-style: normal;
  white-space: nowrap;
}

.hero h1 em::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 8px;
  background: var(--yellow);
  border-radius: 99px;
  content: "";
  opacity: 0.65;
  transform: rotate(-1deg);
}

.hero__copy > p:not(.eyebrow) {
  max-width: 530px;
  margin: 24px 0 28px;
  color: var(--muted);
  font-size: 16px;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  border: 0;
  border-radius: 15px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

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

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

.button--primary {
  color: var(--white);
  background: var(--coral);
  box-shadow: 0 7px 0 var(--coral-dark);
}

.button--primary:active {
  box-shadow: 0 3px 0 var(--coral-dark);
  transform: translateY(4px);
}

.button--secondary {
  color: var(--white);
  background: var(--blue);
}

.button--danger {
  color: #b42336;
  background: #fff0f1;
}

.button--ghost {
  background: #f5efe6;
}

.button--wide {
  width: 100%;
}

.hero__art {
  position: relative;
  min-height: 400px;
}

.hero-phone {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 50%;
  display: flex;
  width: 220px;
  height: 390px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--white);
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.28) 0 34px, transparent 35px),
    linear-gradient(150deg, var(--mint), var(--blue));
  border: 8px solid var(--ink);
  border-radius: 38px;
  box-shadow: 14px 18px 0 rgba(38, 48, 68, 0.18);
  transform: translateX(-42%) rotate(5deg);
}

.hero-phone::before {
  position: absolute;
  top: 10px;
  width: 64px;
  height: 8px;
  background: var(--ink);
  border-radius: 99px;
  content: "";
}

.hero-phone span {
  font-size: 20px;
}

.hero-phone strong {
  font-size: 38px;
  letter-spacing: 0.08em;
}

.hero-phone__button {
  position: absolute;
  bottom: 10px;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
}

.hero-card {
  position: absolute;
  top: 70px;
  left: 5%;
  display: grid;
  width: 190px;
  height: 255px;
  place-items: center;
  color: var(--ink);
  background: var(--yellow);
  border: 4px solid var(--ink);
  border-radius: 28px;
  font-size: 30px;
  font-weight: 800;
  transform: rotate(-13deg);
}

.spark {
  position: absolute;
  z-index: 3;
  font-size: 38px;
  font-weight: 800;
}

.spark--one {
  top: 5%;
  right: 4%;
  color: var(--coral);
}

.spark--two {
  right: 2%;
  bottom: 13%;
  color: var(--yellow);
  -webkit-text-stroke: 3px var(--ink);
}

.spark--three {
  bottom: 2%;
  left: 2%;
  color: var(--lavender);
}

.catalog {
  padding: 100px 0 80px;
  scroll-margin-top: 20px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 46px);
}

.result-count {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 14px;
}

.filter-panel {
  display: grid;
  align-items: stretch;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 12px;
  margin: 28px 0 18px;
  padding: 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--small-shadow);
}

.search-field {
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: #f8f4ed;
  border: 2px solid transparent;
  border-radius: 14px;
}

.search-field:focus-within {
  border-color: var(--blue);
}

.search-field > span {
  font-size: 25px;
  font-weight: 800;
}

.search-field input {
  width: 100%;
  background: transparent;
  border: 0;
  outline: none;
}

.sort-field {
  display: flex;
  min-width: 190px;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  background: #f8f4ed;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
}

.sort-field select {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  cursor: pointer;
  font-weight: 700;
}

.tag-filter {
  display: flex;
  min-height: 42px;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 30px;
}

.tag-button,
.tag {
  display: inline-flex;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
}

.tag-button {
  min-height: 38px;
  padding: 7px 15px;
  cursor: pointer;
}

.tag-button:hover,
.tag-button.is-active {
  color: var(--white);
  background: var(--ink);
  border-color: var(--ink);
}

.tag {
  padding: 5px 10px;
}

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

.app-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 6px 7px 0 var(--ink);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.app-card:hover {
  box-shadow: 9px 11px 0 var(--ink);
  transform: translateY(-4px);
}

.app-card__media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 11;
  background:
    linear-gradient(145deg, rgba(255, 209, 102, 0.8), rgba(255, 107, 107, 0.75));
  cursor: pointer;
}

.app-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.app-card:hover .app-card__media img {
  transform: scale(1.035);
}

.app-card__placeholder {
  display: grid;
  height: 100%;
  place-items: center;
  color: rgba(38, 48, 68, 0.8);
  font-size: 58px;
}

.app-card__image-count {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 5px 9px;
  color: var(--white);
  background: rgba(38, 48, 68, 0.8);
  border-radius: 99px;
  font-size: 11px;
}

.app-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 21px;
}

.app-card h3 {
  margin: 0 0 9px;
  font-size: 22px;
  line-height: 1.4;
}

.app-card__description {
  display: -webkit-box;
  margin: 0 0 14px;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.app-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: auto 0 18px;
}

.app-card__actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 9px;
}

.app-card__actions .button {
  min-height: 44px;
  padding: 8px 12px;
  font-size: 13px;
}

.status-card {
  display: grid;
  min-height: 260px;
  place-items: center;
  align-content: center;
  gap: 16px;
  color: var(--muted);
  text-align: center;
}

.status-card__icon {
  font-size: 50px;
}

.status-card h3,
.status-card p {
  margin: 0;
}

.loader {
  width: 44px;
  height: 44px;
  border: 5px solid #eadfce;
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.site-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.site-footer strong {
  color: var(--ink);
  font-size: 17px;
}

.site-footer p {
  margin: 3px 0 0;
}

.app-dialog {
  width: min(920px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  overflow: auto;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 28px;
  box-shadow: 8px 10px 0 var(--ink);
}

.app-dialog::backdrop {
  background: rgba(38, 48, 68, 0.66);
  backdrop-filter: blur(4px);
}

.dialog-close {
  position: sticky;
  z-index: 4;
  top: 15px;
  float: right;
  width: 42px;
  height: 42px;
  margin: 15px 15px -57px 0;
  color: var(--white);
  background: var(--ink);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 25px;
}

.dialog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
}

.dialog-gallery {
  min-height: 520px;
  padding: 22px;
  background: #eee6d8;
}

.dialog-gallery__main {
  width: 100%;
  height: 410px;
  object-fit: contain;
  background: var(--ink);
  border-radius: 19px;
}

.dialog-thumbs {
  display: flex;
  gap: 9px;
  margin-top: 10px;
  overflow-x: auto;
}

.dialog-thumb {
  width: 66px;
  height: 66px;
  padding: 0;
  overflow: hidden;
  background: var(--white);
  border: 3px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  flex: 0 0 auto;
}

.dialog-thumb.is-active {
  border-color: var(--coral);
}

.dialog-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dialog-info {
  padding: 60px 34px 34px;
}

.dialog-info h2 {
  margin: 0 0 12px;
  font-size: 30px;
  line-height: 1.4;
}

.dialog-info__description {
  margin: 18px 0 28px;
  color: var(--muted);
  white-space: pre-wrap;
}

/* Admin */
.admin-body {
  background: #f6f2ea;
}

.admin-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 40px auto 80px;
}

.auth-card {
  display: grid;
  max-width: 560px;
  min-height: 420px;
  align-content: center;
  justify-items: center;
  margin: 60px auto;
  padding: 50px;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 30px;
  box-shadow: 8px 9px 0 var(--ink);
  text-align: center;
}

.auth-card__icon {
  display: grid;
  width: 90px;
  height: 90px;
  place-items: center;
  background: #fff2d4;
  border-radius: 30px;
  font-size: 42px;
  transform: rotate(-4deg);
}

.auth-card h1 {
  margin: 24px 0 8px;
}

.auth-card p {
  margin: 0 0 25px;
  color: var(--muted);
}

.admin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.admin-heading h1 {
  margin: 0;
  font-size: 32px;
}

.admin-heading__user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.admin-layout {
  display: grid;
  align-items: start;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 24px;
}

.panel {
  padding: 28px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--small-shadow);
}

.panel h2 {
  margin: 0 0 22px;
  font-size: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field--full {
  grid-column: 1 / -1;
}

.form-field > span,
.form-label {
  font-size: 13px;
  font-weight: 800;
}

.required {
  color: var(--coral-dark);
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 12px 14px;
  background: #faf8f3;
  border: 2px solid #e8e0d6;
  border-radius: 12px;
  outline: none;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--blue);
}

.form-field textarea {
  min-height: 140px;
  resize: vertical;
}

.field-help {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.tag-editor {
  display: flex;
  gap: 8px;
}

.tag-editor input {
  flex: 1;
}

.tag-list {
  display: flex;
  min-height: 28px;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-list button {
  padding: 5px 10px;
  background: #f1ece4;
  border: 0;
  border-radius: 99px;
  cursor: pointer;
  font-size: 12px;
}

.tag-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag-suggestions button {
  padding: 4px 9px;
  color: var(--blue);
  background: #eef4ff;
  border: 0;
  border-radius: 99px;
  cursor: pointer;
  font-size: 11px;
}

.drop-zone {
  position: relative;
  display: grid;
  min-height: 125px;
  place-items: center;
  padding: 20px;
  color: var(--muted);
  background: #faf8f3;
  border: 2px dashed #cfc3b4;
  border-radius: 16px;
  text-align: center;
}

.drop-zone.is-dragging {
  background: #eef4ff;
  border-color: var(--blue);
}

.drop-zone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.image-previews {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.image-preview {
  position: relative;
  overflow: hidden;
  aspect-ratio: 9 / 16;
  background: #eee;
  border-radius: 12px;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview button {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  color: var(--white);
  background: rgba(38, 48, 68, 0.9);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.admin-list {
  display: grid;
  max-height: 720px;
  gap: 12px;
  overflow: auto;
}

.admin-app {
  padding: 15px;
  background: #faf8f3;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.admin-app h3 {
  margin: 0;
  font-size: 16px;
}

.admin-app p {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 11px;
}

.admin-app__actions {
  display: flex;
  gap: 8px;
}

.admin-app__actions button {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 11px;
}

.notice {
  margin-bottom: 18px;
  padding: 13px 16px;
  background: #eef4ff;
  border-radius: 12px;
  font-size: 13px;
}

.notice--error {
  color: #9b2738;
  background: #fff0f1;
}

.notice--success {
  color: #176b55;
  background: #e7faf4;
}

.config-help {
  max-width: 680px;
  margin: 60px auto;
  padding: 30px;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 24px;
}

.config-help code {
  padding: 2px 6px;
  background: #f1ece4;
  border-radius: 5px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 920px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 70px;
    text-align: center;
  }

  .hero__copy > p:not(.eyebrow) {
    margin-right: auto;
    margin-left: auto;
  }

  .hero__art {
    width: min(440px, 100%);
    margin: 0 auto;
  }

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

  .dialog-layout,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .dialog-gallery {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .site-header,
  main,
  .site-footer,
  .admin-shell {
    width: min(100% - 24px, 1180px);
  }

  .site-header {
    padding: 15px 0;
  }

  .brand__icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 21px;
  }

  .brand strong {
    font-size: 16px;
  }

  .brand small,
  .header-link {
    display: none;
  }

  .hero {
    min-height: auto;
    gap: 25px;
    padding: 48px 20px 30px;
    border-radius: 27px;
    box-shadow: 6px 7px 0 var(--ink);
  }

  .hero h1 {
    font-size: clamp(34px, 10vw, 48px);
  }

  .hero__art {
    min-height: 320px;
    transform: scale(0.82);
    transform-origin: top center;
    margin-bottom: -55px;
  }

  .catalog {
    padding: 75px 0 60px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 5px;
  }

  .filter-panel {
    grid-template-columns: 1fr;
  }

  .filter-reset {
    min-height: 42px;
  }

  .app-grid {
    grid-template-columns: 1fr;
  }

  .app-card {
    box-shadow: 5px 6px 0 var(--ink);
  }

  .site-footer {
    align-items: start;
    flex-direction: column;
  }

  .dialog-layout {
    display: block;
  }

  .dialog-gallery {
    padding: 12px;
  }

  .dialog-gallery__main {
    height: 58vh;
  }

  .dialog-info {
    padding: 28px 20px 24px;
  }

  .admin-shell {
    margin-top: 25px;
  }

  .admin-heading,
  .admin-heading__user {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-heading__user {
    gap: 6px;
  }

  .panel,
  .auth-card {
    padding: 21px;
  }

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

  .form-field--full {
    grid-column: auto;
  }

  .image-previews {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
