:root {
  color-scheme: light;
  --bg: #f4efe4;
  --bg-accent: #e2d1a8;
  --panel: rgba(255, 251, 242, 0.9);
  --panel-border: rgba(57, 41, 23, 0.14);
  --text: #2d2217;
  --muted: #655748;
  --brand: #154734;
  --brand-strong: #0c2e21;
  --highlight: #b24a2a;
  --success: #265d39;
  --warn: #8f5e09;
  --shadow: 0 24px 60px rgba(56, 33, 8, 0.14);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-display: "Avenir Next Condensed", "Gill Sans", "Trebuchet MS", sans-serif;
  --font-body: "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 244, 200, 0.95), transparent 34%),
    radial-gradient(circle at bottom right, rgba(193, 123, 67, 0.16), transparent 28%),
    linear-gradient(180deg, var(--bg) 0%, #efe6d6 100%);
}

body.intro-open {
  overflow: hidden;
}

body.modal-open {
  overflow: hidden;
}

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: #0a0a0a;
  overflow: hidden;
}

.intro-overlay[hidden] {
  display: none;
}

.intro-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.intro-video-blur {
  object-fit: cover;
  filter: blur(28px);
  transform: scale(1.08);
  opacity: 0.75;
}

.intro-stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  align-self: end;
  padding: 24px 24px 24px;
}

.intro-video-frame {
  position: relative;
  width: min(72vh, calc(100vw - 96px));
  height: min(72vh, calc(100vw - 96px));
  max-width: 92vw;
  max-height: 92vw;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.38);
}

.intro-video-main {
  object-fit: contain;
  background: #050505;
}

.intro-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(6, 12, 10, 0.12) 0%, rgba(6, 12, 10, 0.22) 48%, rgba(6, 12, 10, 0.72) 100%);
}

.intro-copy {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100% - 32px));
  align-self: start;
  margin: 0 auto 32px;
  padding: 0;
  text-align: center;
  color: #fff8ee;
  pointer-events: none;
}

.intro-button {
  min-height: 58px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #f2d58a, #f7e1a7);
  color: #12392b;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.26);
  transition: transform 140ms ease, box-shadow 140ms ease;
  pointer-events: auto;
}

.intro-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
}

.intro-button:focus-visible {
  outline: 2px solid rgba(255, 248, 238, 0.9);
  outline-offset: 4px;
}

.intro-line,
.intro-note {
  margin: 10px auto 0;
  max-width: 44rem;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.2;
  color: rgba(255, 248, 238, 0.88);
  text-wrap: balance;
  text-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

@media (max-width: 640px) {
  .intro-stage {
    padding: 20px 16px 16px;
  }

  .intro-video-frame {
    width: min(88vw, 88vh);
    height: min(88vw, 88vh);
  }

  .intro-copy {
    margin-bottom: 20px;
  }
}

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

button,
input,
textarea {
  font: inherit;
}

code {
  font-family: "SFMono-Regular", Consolas, monospace;
}

.page-shell {
  width: min(980px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.toolbar-label,
.section-heading h2,
.stage-toolbar h2,
.stage-toolbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.app-panel {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-panel {
  padding: 14px 16px;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(220px, 0.9fr);
  gap: 20px 30px;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-social-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--brand-strong);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.35;
  opacity: 0.84;
  transition: opacity 140ms ease, transform 140ms ease;
}

.footer-social-link:hover {
  opacity: 1;
  transform: translateX(2px);
}

.footer-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand-strong);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  opacity: 0.84;
  cursor: pointer;
  transition: opacity 140ms ease, transform 140ms ease;
}

.footer-link-button:hover {
  opacity: 1;
  transform: translateX(2px);
}

.footer-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.footer-icon svg {
  width: 100%;
  height: 100%;
}

.footer-cta-column {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
}

.footer-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0f4a36, #195a42);
  color: #fffaf0;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 14px 28px rgba(21, 71, 52, 0.18);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.footer-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(21, 71, 52, 0.24);
  background: linear-gradient(135deg, #0c3b2b, #154734);
}

.footer-cta-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.footer-cta-icon svg {
  width: 100%;
  height: 100%;
}

.footer-link-button-strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  opacity: 1;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 5vh 5vw;
  background: rgba(45, 34, 23, 0.45);
  backdrop-filter: blur(10px);
}

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

.modal-card {
  width: 90vw;
  height: 90vh;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: rgba(255, 251, 242, 0.98);
  border: 1px solid rgba(57, 41, 23, 0.14);
  box-shadow: 0 28px 72px rgba(56, 33, 8, 0.22);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(57, 41, 23, 0.1);
}

.modal-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.5vw, 2rem);
}

.modal-close {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(21, 71, 52, 0.08);
  color: var(--brand-strong);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.modal-content {
  flex: 1;
  overflow: auto;
  padding: 22px 20px 28px;
  line-height: 1.65;
}

.modal-content > :first-child {
  margin-top: 0;
}

.modal-content > :last-child {
  margin-bottom: 0;
}

.stage-toolbar,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.compact-toolbar {
  align-items: center;
}

.compact-toolbar h1 {
  flex: 1;
  text-align: center;
  font-size: clamp(1.25rem, 3vw, 2rem);
  line-height: 1.05;
}

.header-counters {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 78px;
  text-align: right;
}

.header-counters p {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-size: 0.76rem;
  line-height: 1.1;
  color: var(--muted);
}

.header-counters span {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.header-counters strong {
  font-size: 0.98rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.nav-button {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--brand-strong);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(56, 33, 8, 0.12);
  transition: transform 140ms ease, background 140ms ease;
}

.nav-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.96);
}

.image-frame {
  border-radius: calc(var(--radius-lg) - 8px);
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(15, 53, 39, 0.06), rgba(178, 74, 42, 0.1)),
    rgba(255, 255, 255, 0.76);
  min-height: 520px;
  display: grid;
  place-items: center;
  position: relative;
}

.image-frame img {
  width: 100%;
  height: min(72vh, 820px);
  object-fit: contain;
  transition: opacity 160ms ease;
}

.image-frame.is-loading img {
  opacity: 0.32;
}

.image-spinner {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 3px solid rgba(21, 71, 52, 0.14);
  border-top-color: rgba(21, 71, 52, 0.82);
  animation: image-spinner-rotate 0.72s linear infinite;
  z-index: 1;
}

.image-spinner[hidden] {
  display: none;
}

@keyframes image-spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

.image-context {
  margin-top: -4px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(21, 71, 52, 0.06);
  border: 1px solid rgba(21, 71, 52, 0.12);
  color: var(--text);
  line-height: 1.55;
}

.image-context p,
.image-context ul {
  margin: 0;
}

.image-context .context-label {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--brand-strong);
}

.image-context p + p,
.image-context p + ul,
.image-context ul + p,
.image-context ul + ul {
  margin-top: 10px;
}

.image-context ul {
  padding-left: 18px;
}

.image-context li + li {
  margin-top: 6px;
}

.image-context a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.12em;
}

.rating-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rating-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.action-side {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.rating-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 84px;
}

.score-pill {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  width: 112px;
  border-radius: 999px;
  background: rgba(21, 71, 52, 0.08);
  color: var(--brand-strong);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.score-pill strong {
  font-size: 1.5rem;
  line-height: 1;
  display: inline-block;
  width: 3.6ch;
  text-align: right;
}

.score-pill span {
  color: var(--muted);
  display: inline-block;
  width: 2.4ch;
  text-align: left;
}

.star-field {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.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;
}

.star-rating {
  --star-size: 44px;
  --star-gap: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--star-gap);
  padding: 18px 12px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(57, 41, 23, 0.1);
  overflow: hidden;
}

.star-button {
  position: relative;
  width: var(--star-size);
  height: var(--star-size);
  flex: 0 0 auto;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.star-button::before,
.star-button::after {
  content: "★";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: calc(var(--star-size) * 0.95);
  line-height: 1;
}

.star-button::before {
  color: rgba(87, 70, 32, 0.16);
}

.star-button::after {
  color: #f6bd18;
  width: calc(var(--fill, 0) * 100%);
  overflow: hidden;
  justify-content: start;
  text-shadow: 0 0 0 transparent;
  transition: width 70ms linear, text-shadow 90ms ease, transform 90ms ease;
}

.star-button.is-active::before {
  color: rgba(87, 70, 32, 0.22);
}

.star-button.is-preview::after {
  text-shadow: 0 0 14px rgba(246, 189, 24, 0.42);
  transform: translateY(-1px);
}

.star-button:focus-visible {
  outline: 2px solid rgba(178, 74, 42, 0.48);
  outline-offset: 4px;
  border-radius: 10px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-group span:first-child {
  font-weight: 700;
}

textarea {
  width: 100%;
}

textarea {
  resize: vertical;
  min-height: 94px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(57, 41, 23, 0.18);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

textarea:focus,
button:focus {
  outline: 2px solid rgba(178, 74, 42, 0.48);
  outline-offset: 2px;
}

.primary-button {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--highlight), #d46842);
  color: #fff9f2;
  box-shadow: 0 18px 28px rgba(178, 74, 42, 0.26);
}

.primary-button:disabled {
  background: rgba(87, 70, 32, 0.2);
  color: rgba(45, 34, 23, 0.55);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.save-button {
  white-space: nowrap;
}

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

.status-card {
  border-radius: var(--radius-md);
  padding: 12px 14px;
  line-height: 1.5;
  border: 1px solid transparent;
}

.status-card:empty {
  display: none;
}

.status-muted {
  background: rgba(57, 41, 23, 0.06);
  color: var(--muted);
}

.status-warn {
  background: rgba(213, 156, 45, 0.13);
  color: #704808;
  border-color: rgba(143, 94, 9, 0.24);
}

.status-ok {
  background: rgba(38, 93, 57, 0.12);
  color: var(--success);
  border-color: rgba(38, 93, 57, 0.2);
}

.status-error {
  background: rgba(178, 74, 42, 0.12);
  color: #8e3217;
  border-color: rgba(178, 74, 42, 0.24);
}

.captcha-slot {
  display: none;
  min-height: 0;
}

.captcha-slot.is-visible {
  display: block;
  width: 100%;
}

.captcha-slot > div {
  margin-left: auto;
}

.captcha-slot,
#connection-status,
#form-status {
  grid-column: 1 / -1;
}

@media (max-width: 960px) {
  .image-frame {
    min-height: 360px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 14px, 980px);
    padding-top: 10px;
  }

  .app-panel {
    padding: 12px;
  }

  .footer-panel {
    padding: 12px;
  }

  .stage-toolbar,
  .section-heading {
    flex-direction: column;
  }

  .rating-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "stars stars stars"
      "score . action";
    align-items: center;
    gap: 10px;
  }

  .rating-row > .rating-side {
    grid-area: score;
    width: auto;
    min-width: 0;
    align-self: center;
  }

  .rating-row > .star-field {
    grid-area: stars;
    grid-column: 1 / -1;
  }

  .action-side {
    grid-area: action;
    width: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
  }

  .captcha-slot > div {
    margin-left: 0;
  }

  .compact-toolbar {
    flex-direction: row;
    gap: 8px;
  }

  .compact-toolbar h1 {
    font-size: 1.05rem;
  }

  .header-counters {
    min-width: 62px;
  }

  .header-counters p {
    font-size: 0.66rem;
  }

  .header-counters strong {
    font-size: 0.88rem;
  }

  .image-frame {
    min-height: 280px;
  }

  .image-frame img {
    height: min(54vh, 460px);
  }

  .nav-button {
    width: 42px;
    height: 42px;
    font-size: 1.4rem;
    flex: 0 0 auto;
  }

  .save-button {
    width: auto;
  }

  .star-rating {
    --star-size: 24px;
    --star-gap: 2px;
    padding: 12px 4px;
  }

  .score-pill {
    align-self: flex-start;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .footer-cta-column {
    align-items: stretch;
  }

  .footer-cta {
    width: 100%;
  }
}
