:root {
  --ink: #22312e;
  --ink-soft: #5c6e69;
  --paper: #eef5f2;
  --white: #ffffff;
  --line: #dce8e3;
  --brand: #2ba191;
  --brand-deep: #194741;
  --brand-ink: #0a2b28;
  --gold: #e3a93d;
  --gold-soft: #f3e6c4;
  --font: "Vazirmatn", Tahoma, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background: #e8eeeb;
  color: var(--ink);
  font-family: var(--font);
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 40px 18px;
  background: var(--brand-ink);
  color: #edf6f3;
  border-bottom: 1px solid rgba(227, 169, 61, 0.18);
}

.brand { min-width: 0; }

.brand-kicker {
  margin: 0 0 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: #9cb8b0;
}

.brand h1 {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.brand p {
  margin: 8px 0 0;
  max-width: 42em;
  font-size: 0.92rem;
  line-height: 1.85;
  color: #b7cdc6;
}

.badge {
  flex: 0 0 auto;
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(43, 161, 145, 0.45);
  background: rgba(43, 161, 145, 0.18);
  color: #edf6f3;
  font-size: 0.78rem;
  font-weight: 700;
}

.film {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  padding: 12px 40px;
  background: #0d3330;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.film button {
  position: relative;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(243, 230, 196, 0.18);
  border-radius: 10px;
  overflow: hidden;
  background: #071614;
  cursor: pointer;
  aspect-ratio: 16 / 10;
}

.film button.is-on,
.film button:hover {
  border-color: var(--gold);
}

.film img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.film b {
  position: absolute;
  right: 8px;
  bottom: 7px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}

.stage {
  background: var(--paper);
  padding: 20px 40px 8px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1280px;
  margin: 0 auto 14px;
  padding: 10px 16px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.toolbar strong {
  font-size: 0.92rem;
  font-weight: 700;
}

.toolbar .meta {
  margin-right: 8px;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.live-hint {
  margin: 6px 0 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: #c4922e;
  animation: live-blink 1.35s ease-in-out infinite;
}

@keyframes live-blink {
  0%, 100% { opacity: 1; color: #e3a93d; }
  50% { opacity: 0.35; color: #c4922e; }
}

.tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.seg {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.seg button, .tools a {
  height: 34px;
  padding: 0 12px;
  border: 0;
  background: var(--white);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.seg button + button { border-right: 1px solid var(--line); }

.seg button.is-on {
  background: var(--brand-ink);
  color: #edf6f3;
}

.tools a {
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--brand-deep);
}

.preview-row {
  display: grid;
  grid-template-columns: 1fr 52px;
  gap: 14px;
  max-width: 1280px;
  margin: 0 auto;
  align-items: stretch;
}

.viewport {
  min-width: 0;
}

.frame {
  position: relative;
  width: 100%;
  height: calc(100vh - 80px);
  min-height: 1100px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 40px -24px rgba(25, 71, 65, 0.45);
  transition: width 0.25s ease;
}

.frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #f2f6f4;
}

.viewport[data-device="tablet"] .frame { width: min(768px, 100%); }
.viewport[data-device="mobile"] .frame {
  width: min(390px, 100%);
  height: 844px;
  min-height: 844px;
}

.busy {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(242, 246, 244, 0.72);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--brand-deep);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.frame.is-busy .busy { opacity: 1; }

.scroll-hint {
  position: relative;
  display: block;
  min-height: 1100px;
  height: 100%;
  padding: 0;
  background: var(--brand-ink);
  border: 1px solid rgba(227, 169, 61, 0.28);
  border-radius: 14px;
  color: #edf6f3;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.scroll-hint:hover {
  border-color: var(--gold);
  background: #0f3a36;
}

.scroll-hint span {
  position: absolute;
  left: 50%;
  writing-mode: vertical-rl;
  transform: translateX(-50%) rotate(180deg);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
  pointer-events: none;
}

.scroll-hint-t { top: 28px; }
.scroll-hint-m { top: 50%; margin-top: 0; transform: translate(-50%, -50%) rotate(180deg); }
.scroll-hint-b { bottom: 28px; top: auto; }

.foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px 18px;
  background: var(--brand-ink);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: #9cb8b0;
  font-size: 0.78rem;
}

.foot strong {
  color: #edf6f3;
  font-weight: 700;
}

.foot span::before {
  content: "·";
  margin-left: 10px;
  color: rgba(227, 169, 61, 0.55);
}

.catalog {
  padding: 48px 40px 72px;
  background: #f7faf8;
  border-top: 1px solid var(--line);
}

.catalog-head {
  max-width: 1280px;
  margin: 0 auto 28px;
}

.catalog-head .idx {
  display: block;
  margin-bottom: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold);
}

.catalog-head h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--brand-ink);
}

.catalog-head p {
  margin: 8px 0 0;
  max-width: 40em;
  font-size: 0.95rem;
  line-height: 1.9;
  color: var(--ink-soft);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  max-width: 1280px;
  margin: 0 auto;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 18px 18px 16px;
  text-align: right;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  border-color: rgba(43, 161, 145, 0.55);
  box-shadow: 0 14px 28px -20px rgba(25, 71, 65, 0.35);
  transform: translateY(-2px);
}

.card.is-on {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.card em {
  font-style: normal;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold);
}

.card small {
  font-size: 0.7rem;
  font-weight: 600;
  color: #8fa19b;
}

.card strong {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--brand-deep);
  line-height: 1.45;
}

.card span {
  font-size: 0.84rem;
  line-height: 1.85;
  color: var(--ink-soft);
}

.card-group {
  display: contents;
}

.group-label {
  grid-column: 1 / -1;
  margin: 18px 0 2px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--brand);
}

.group-label:first-child { margin-top: 0; }

@media (max-width: 1100px) {
  .grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 960px) {
  .film { grid-template-columns: repeat(3, 1fr); }
  .top, .stage, .catalog, .film { padding-left: 20px; padding-right: 20px; }
  .preview-row { grid-template-columns: 1fr; }
  .scroll-hint {
    min-height: 0;
    height: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .scroll-hint span {
    position: static;
    left: auto;
    top: auto;
    bottom: auto;
    writing-mode: horizontal-tb;
    transform: none;
    margin: 0;
  }
  .frame {
    height: 80vh;
    min-height: 720px;
  }
}

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .top { flex-direction: column; align-items: flex-start; }
}
