:root {
  --blotter: #0c121c;
  --blotter-lift: #141c2a;
  --ink: #e8e2d4;
  --muted: #9aa3b2;
  --brass: #c9a46a;
  --brass-deep: #a67c42;
  --paper: #f2ead8;
  --paper-ink: #1a1712;
  --seal: #8b3a3a;
  --line: rgba(232, 226, 212, 0.14);
  --display: "Spectral", "Times New Roman", serif;
  --sans: "IBM Plex Sans", "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.5;
  background:
    radial-gradient(900px 480px at 72% -8%, rgba(201, 164, 106, 0.16), transparent 55%),
    radial-gradient(700px 420px at 8% 40%, rgba(255, 255, 255, 0.03), transparent 50%),
    var(--blotter);
}
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brass); text-underline-offset: 3px; }
[hidden] { display: none !important; }

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: var(--paper);
  color: var(--paper-ink);
  padding: 8px 12px;
  z-index: 20;
}
.skip:focus { top: 12px; }

.blot {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.35;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 23px, rgba(255,255,255,0.015) 24px),
    repeating-linear-gradient(90deg, transparent, transparent 23px, rgba(255,255,255,0.01) 24px);
}
.lamp-cone {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background: radial-gradient(520px 340px at 58% 28%, rgba(242, 234, 216, 0.12), transparent 70%);
  animation: lamp 8s var(--ease) infinite alternate;
}

.mast, main, .foot { position: relative; z-index: 1; }

.mast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.brand-mark {
  width: 34px;
  height: 48px;
  border-radius: 4px;
  border: 1px solid var(--brass);
  background:
    linear-gradient(160deg, rgba(201,164,106,0.25), transparent 50%),
    var(--blotter-lift);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(201,164,106,0.45);
}
.brand-name {
  display: block;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.brand-sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 0.92rem;
}
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--ink); }

.ticket {
  width: min(1120px, calc(100% - 40px));
  margin: 18px auto 0;
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 0;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 40%), var(--blotter-lift);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 14px 100%, 0 calc(100% - 14px));
}
.ticket-copy { padding: 36px 40px 40px; }
.ticket-stub {
  padding: 28px 28px 32px;
  border-left: 1px dashed rgba(201,164,106,0.35);
  background:
    radial-gradient(circle at 90% 12%, rgba(139,58,58,0.18), transparent 40%),
    rgba(0,0,0,0.18);
}
.kicker {
  margin: 0 0 12px;
  color: var(--brass);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
}
h1 {
  margin: 0 0 14px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.1rem, 4.4vw, 3.35rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: 16ch;
}
.lead { margin: 0; color: var(--muted); max-width: 46ch; }
.ticket-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}
.go, .deal {
  appearance: none;
  border: 0;
  text-decoration: none;
  background: var(--paper);
  color: var(--paper-ink);
  padding: 13px 18px;
  font-weight: 700;
  border-radius: 2px;
  transition: transform 0.35s var(--ease), background 0.35s var(--ease);
}
.go:hover, .deal:hover { transform: translateY(-1px); background: #fff6e6; }
.ghost {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 12px 16px;
  border-radius: 2px;
}
.ghost:hover { border-color: var(--brass); color: var(--brass); }
.stub-label {
  margin: 0;
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 700;
}
.stub-note { margin: 8px 0 18px; color: var(--muted); font-size: 0.95rem; }
.stub-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.stub-list li {
  padding-left: 28px;
  position: relative;
  color: var(--muted);
}
.stub-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 10px;
  height: 10px;
  background: var(--seal);
  transform: rotate(45deg);
}

.desk-wrap {
  width: min(1120px, calc(100% - 40px));
  margin: 28px auto 0;
}
.stamps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.stamps button {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.22);
  color: var(--muted);
  padding: 9px 13px;
  border-radius: 2px;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease), background 0.3s var(--ease);
}
.stamps button[aria-selected="true"] {
  color: var(--paper);
  background: transparent;
  border-color: var(--brass);
  box-shadow: inset 0 0 0 1px rgba(201,164,106,0.35);
  font-weight: 600;
}
.stamps button:focus-visible,
.deal:focus-visible,
.ghost:focus-visible,
.suits button:focus-visible,
.catalog button:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

.desk {
  position: relative;
  padding: 28px 28px 32px;
  border: 1px solid var(--line);
  background:
    radial-gradient(640px 360px at 50% 18%, rgba(242, 234, 216, 0.14), transparent 65%),
    linear-gradient(180deg, #182233, #101826 70%);
  overflow: hidden;
}
.desk::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(201,164,106,0.12);
  pointer-events: none;
}
.desk > * { position: relative; z-index: 1; }

.ask { max-width: 640px; margin-bottom: 18px; }
.ask label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
textarea, .ask input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 12px 0;
}
textarea { resize: vertical; min-height: 88px; }
textarea:focus-visible, .ask input:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 4px;
}
textarea::placeholder, .ask input::placeholder { color: rgba(154,163,178,0.75); }

.suits { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 14px; }
.suits button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 4px 0;
  color: var(--muted);
  border-bottom: 1px solid transparent;
}
.suits button[aria-pressed="true"] {
  color: var(--ink);
  border-bottom-color: var(--brass);
}
.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 16px 12px;
  max-width: 860px;
  margin-bottom: 8px;
}
.catalog button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--ink);
  text-align: center;
}
.catalog button img {
  width: 100%;
  aspect-ratio: 2 / 3.45;
  object-fit: contain;
  display: block;
  background: #f3e6c8;
  border-radius: 4px;
  box-shadow: 0 10px 22px rgba(0,0,0,0.35);
}
.catalog button span {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  line-height: 1.2;
}
.catalog button.is-on span,
.catalog button:hover span { color: var(--brass); }
.catalog button.is-on img { outline: 2px solid var(--brass); outline-offset: 2px; }
.choices { display: flex; flex-wrap: wrap; gap: 12px 18px; max-width: 640px; }
.choices button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--paper);
  border-bottom: 1px solid var(--brass);
  padding: 4px 0;
}

.lamp { min-height: 180px; padding: 10px 0 8px; }
.spread {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 12px;
  align-items: flex-start;
}
.place { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.place-label {
  max-width: 7.5rem;
  color: var(--brass);
  font-size: 0.78rem;
  line-height: 1.2;
  text-align: center;
}
.card.is-shuffling {
  width: 78px;
  height: 134px;
  animation: riffle 0.48s var(--ease) both;
}
.spread.is-cross {
  --card-h: 228px;
  align-items: start;
  gap: 22px 36px;
}
.cross-board {
  display: grid;
  grid-template-columns: auto auto auto;
  grid-template-areas:
    ". above ."
    "left heart right"
    ". below .";
  gap: 12px 64px;
  justify-content: center;
  align-items: start;
}
.slot-above { grid-area: above; }
.slot-left { grid-area: left; }
.slot-heart { grid-area: heart; position: relative; }
.slot-right { grid-area: right; }
.slot-below { grid-area: below; }
.place.is-across {
  position: absolute;
  left: 50%;
  top: calc(var(--card-h) / 2);
  z-index: 2;
  transform: translate(-50%, -50%);
}
.card.is-across { transform: rotate(90deg); }
.cross-staff { display: flex; flex-direction: column; gap: 10px; }
.card {
  width: 132px;
  height: 228px;
  perspective: 800px;
  background: transparent;
  border: 0;
  padding: 0;
}
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.55s var(--ease);
}
.card.is-open .card-inner { transform: rotateY(180deg); }
.card-back, .card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 6px;
}
.card-back {
  background:
    linear-gradient(var(--blotter-lift), var(--blotter-lift)) padding-box,
    linear-gradient(160deg, var(--brass), var(--seal)) border-box;
  border: 1px solid transparent;
  box-shadow: 0 12px 22px rgba(0,0,0,0.35);
}
.card-back::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(242, 234, 216, 0.45);
  border-radius: 3px;
}
.card-back::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: var(--seal);
}
.card-face {
  transform: rotateY(180deg);
  background: #f3e6c8;
  overflow: hidden;
  box-shadow: 0 12px 22px rgba(0,0,0,0.35);
}
.card-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card.is-rev .card-face img { transform: rotate(180deg); }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 10px;
}
.deal:disabled { opacity: 0.55; cursor: wait; }
.status { margin: 0; color: var(--muted); }
.status.is-bad { color: #f0c2b4; }

.ledger, .howto, .journal, .faq {
  width: min(1120px, calc(100% - 40px));
  margin: 40px auto 0;
}
.ledger-head, .journal-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 8px;
}
.ledger-head h2, .howto h2, .journal-head h2, .faq h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  font-weight: 700;
}
.ledger-head p, .journal-head p { margin: 0; color: var(--muted); max-width: 42ch; }

.read {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 760px;
  background: rgba(0,0,0,0.18);
  border: 1px solid var(--line);
}
.read li {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 10px 16px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}
.read li:first-child { border-top: 0; }
.read .pos {
  color: var(--brass);
  font-size: 0.95rem;
  line-height: 1.25;
}
.read strong { font-family: var(--display); font-weight: 700; }
.read p { margin: 4px 0 0; }
.read .scene { color: var(--muted); font-size: 0.92rem; }
.read li.together { grid-template-columns: 1fr; }
.caution {
  margin: 16px 0 0;
  max-width: 48ch;
  color: var(--muted);
  font-size: 0.95rem;
}

.howto-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.howto-grid article {
  padding: 18px 18px 20px;
  border: 1px solid var(--line);
  background: var(--blotter-lift);
}
.howto-grid .n {
  display: block;
  color: var(--brass);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}
.howto-grid h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.25rem;
}
.howto-grid p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.hist {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.16);
}
.hist:empty::before {
  content: "Пока пусто. Разложите карты и нажмите «В журнал».";
  display: block;
  padding: 16px 18px;
  color: var(--muted);
}
.hist li {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}
.hist li:first-child { border-top: 0; }
.hist time {
  display: block;
  color: var(--brass);
  font-size: 0.82rem;
  margin-bottom: 4px;
}
.hist p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.faq details {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 600;
}
.faq details p {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 58ch;
}

.foot {
  margin-top: 56px;
  border-top: 1px solid var(--line);
  background: rgba(0,0,0,0.22);
}
.foot-in {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 0.92rem;
}
.foot-brand {
  margin: 0 0 8px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
}
.foot p { margin: 0 0 8px; }
.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
}
.noscript {
  margin: 0;
  padding: 16px;
  background: var(--paper);
  color: var(--paper-ink);
}

.rise {
  opacity: 0;
  transform: translateY(18px);
  filter: blur(4px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease), filter 0.7s var(--ease);
}
.rise.is-in {
  opacity: 1;
  transform: none;
  filter: none;
}

@media (max-width: 900px) {
  .ticket { grid-template-columns: 1fr; }
  .ticket-stub { border-left: 0; border-top: 1px dashed rgba(201,164,106,0.35); }
  .ticket-copy { padding: 28px 22px; }
  .mast { width: calc(100% - 28px); flex-direction: column; align-items: flex-start; }
  .desk-wrap, .ledger, .howto, .journal, .faq, .foot-in { width: calc(100% - 28px); }
  .desk { padding: 20px 16px 24px; }
  .howto-grid { grid-template-columns: 1fr; }
  .read li { grid-template-columns: 1fr; gap: 4px; }
  .card { width: 104px; height: 180px; }
  .spread.is-cross { --card-h: 148px; }
  .spread.is-cross .card { width: 86px; height: 148px; }
  .cross-board { gap: 8px 36px; }
  .cross-staff { flex-direction: row; flex-wrap: wrap; }
  h1 { max-width: none; }
}

@keyframes riffle {
  0% { transform: translateY(8px); }
  45% { transform: translateY(-14px) rotate(-6deg); }
  100% { transform: translateY(0); }
}
@keyframes lamp {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card-inner, .rise { transition: none; }
  .lamp-cone { animation: none; }
  .rise { opacity: 1; transform: none; filter: none; }
}
