@font-face{font-family:Plex;src:url("fonts/ibm-plex-sans-cyrillic-400-normal.woff2") format("woff2");font-weight:400;font-display:swap;unicode-range:U+0400-052F,U+2DE0-2DFF,U+A640-A69F}
@font-face{font-family:Plex;src:url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");font-weight:400;font-display:swap;unicode-range:U+0000-024F,U+2000-206F,U+20A0-20CF,U+2100-214F}
@font-face{font-family:Plex;src:url("fonts/ibm-plex-sans-cyrillic-600-normal.woff2") format("woff2");font-weight:600;font-display:swap;unicode-range:U+0400-052F,U+2DE0-2DFF,U+A640-A69F}
@font-face{font-family:Plex;src:url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");font-weight:600;font-display:swap;unicode-range:U+0000-024F,U+2000-206F,U+20A0-20CF,U+2100-214F}
@font-face{font-family:Plex;src:url("fonts/ibm-plex-sans-cyrillic-700-normal.woff2") format("woff2");font-weight:700;font-display:swap;unicode-range:U+0400-052F,U+2DE0-2DFF,U+A640-A69F}
@font-face{font-family:Plex;src:url("fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2");font-weight:700;font-display:swap;unicode-range:U+0000-024F,U+2000-206F,U+20A0-20CF,U+2100-214F}

@font-face{font-family:Nunito;src:url("fonts/nunito-sans-cyrillic-700-normal.woff2") format("woff2");font-weight:700;font-display:swap;unicode-range:U+0400-052F,U+2DE0-2DFF,U+A640-A69F}
@font-face{font-family:Nunito;src:url("fonts/nunito-sans-latin-700-normal.woff2") format("woff2");font-weight:700;font-display:swap;unicode-range:U+0000-024F,U+2000-206F,U+2100-214F}
@font-face{font-family:Nunito;src:url("fonts/nunito-sans-cyrillic-900-normal.woff2") format("woff2");font-weight:900;font-display:swap;unicode-range:U+0400-052F,U+2DE0-2DFF,U+A640-A69F}
@font-face{font-family:Nunito;src:url("fonts/nunito-sans-latin-900-normal.woff2") format("woff2");font-weight:900;font-display:swap;unicode-range:U+0000-024F,U+2000-206F,U+2100-214F}

:root {
  color-scheme: light;
  --canvas: #f9f7f5;
  --paper: #fff;
  --ink: #231c33;
  --muted: #625b6e;
  --line: #ded8e2;
  --field-line: #81778c;
  --accent: #5125ba;
  --accent-light: #f2ecff;
  --stone: #edeae6;
  --stone-hover: #e2ded9;
  --mint: #b3f4e0;
  --mint-hover: #94e7cf;
  --action-ink: #231c33;
  --article-ink: #423b36;
  --code-background: #ece7dd;
  --scenario-hover: #fbf9ff;
  --edition-background: #e5f4ed;
  --message-ink: #7e283e;
  --footer-background: #231c33;
  --footer-ink: #fff;
  --radius: 26px;
  --surface-shadow: 0 12px 34px rgba(35, 28, 51, .09);
  font-family: Plex, Arial, sans-serif;
  line-height: 1.6;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #191522;
  --paper: #252033;
  --ink: #f4eff9;
  --muted: #c8bed4;
  --line: #4f445e;
  --field-line: #a699b6;
  --accent: #d4bbff;
  --accent-light: #362750;
  --stone: #342c42;
  --stone-hover: #493c5a;
  --article-ink: #e1d9eb;
  --code-background: #403551;
  --scenario-hover: #30263f;
  --edition-background: #253b3a;
  --message-ink: #ffb9c8;
  --footer-background: #110e17;
  --footer-ink: #f4eff9;
  --surface-shadow: 0 12px 34px rgba(0,0,0,.25);
}

*,*::before,*::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
body, button, input, select { font-size: 16px; }
input,select,button { font-family: inherit; }
button,a,input,select,summary { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: #d8caff; color: var(--action-ink); }
h1,h2,h3 { font-family: Nunito, Plex, sans-serif; line-height: 1.17; font-weight: 900; margin: 0; overflow-wrap: anywhere; letter-spacing: -.025em; }
h1 { font-size: clamp(2rem, 3.6vw, 2.75rem); }
h2 { font-size: clamp(1.625rem, 3vw, 2.5rem); }
h3 { font-size: 1.375rem; line-height: 1.25; }
p { margin: .7rem 0 1rem; }

.wrap { width: min(1160px, calc(100% - 64px)); margin-inline: auto; }
.main { padding-block: 30px 64px; min-height: 66vh; }
.skip, .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { width: auto; height: auto; clip-path: none; z-index: 5; inset: 12px auto auto 12px; background: var(--paper); padding: 10px; }

.header { padding-top: 18px; }
.header-inner { width: min(1200px,calc(100% - 40px)); min-height: 72px; display: flex; flex-wrap: wrap; align-items: center; gap: 26px; padding: 10px 22px; border-radius: 40px; background: var(--paper); box-shadow: 0 10px 30px rgba(35, 28, 51, .11); }
.brand { display: inline-flex; align-items: center; gap: 7px; font: 900 26px/1 Nunito, Plex, sans-serif; letter-spacing: -.03em; text-decoration: none; color: var(--accent); white-space: nowrap; }
.brand-mark { flex: none; width: 32px; height: 32px; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 21px; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none; font-size: .875rem; font-weight: 700; }
.nav a:hover,.nav a.active,.nav a[aria-current] { color: var(--accent); text-decoration: underline; text-underline-offset: 8px; }
.header-actions { display: flex; gap: 8px; margin-left: auto; }
.header-cta { white-space: nowrap; }
.search-trigger,.mobile-menu { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; background: var(--stone); color: var(--ink); border-radius: 999px; padding: 7px 16px; cursor: pointer; font-size: .94rem; font-weight: 700; }
.search-trigger:hover,.mobile-menu:hover { background: var(--stone-hover); }
.search-icon { position: relative; display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid currentColor; margin-right: 3px; }
.search-icon::after { content: ''; width: 6px; height: 1.5px; background: currentColor; position: absolute; top: 9px; left: 8px; transform: rotate(46deg); transform-origin: left; }
.mobile-menu { display: none; }

.hero { display: grid; grid-template-columns: 1.42fr 1fr; min-height: 380px; border-radius: var(--radius); background: var(--paper); box-shadow: var(--surface-shadow); }
.hero-copy { position: relative; z-index: 1; padding: 50px 0 46px 52px; align-self: center; }
.hero h1 { font-size: clamp(2.375rem,4.45vw,4rem); max-width: 650px; line-height: 1.07; letter-spacing: -.03em; }
.hero p { max-width: 55ch; margin: 21px 0 0; font-size: 1.125rem; line-height: 1.55; }
.hero-actions { margin-top: 24px; }
.hero-art { position: relative; min-height: 285px; }
.hero-card { position: absolute; width: clamp(132px,18.4vw,266px); aspect-ratio: 1.04; top: 50%; left: 50%; display: grid; place-items: center; border-radius: 22px; }
.hero-card-back { border: 1px solid #aa88ea; background: #e2d5fb; transform: translate(-32%,-47%) rotate(12deg); }
.hero-card-front { color: var(--accent); border: 1px solid #9d7bd1; background: linear-gradient(145deg,#efe1ff,#d5eaff); transform: translate(-67%,-51%) rotate(-9deg); box-shadow: 0 14px 32px rgba(35,28,51,.12); }
:root[data-theme="dark"] .hero-card-back { background: #513776; }
:root[data-theme="dark"] .hero-card-front { background: linear-gradient(145deg,#493465,#34445f); }
.card-seal { display: grid; place-items: center; width: 45%; aspect-ratio: 1; border: 1px solid #a178d3; border-radius: 50%; font: clamp(34px,5.35vw,78px)/1 Arial,sans-serif; }

.section { margin-block: 36px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.scenario-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.scenario { position: relative; display: block; min-height: 166px; background: var(--paper); border-radius: 24px; box-shadow: 0 8px 24px rgba(35,28,51,.08); padding: 24px 42px 22px 25px; text-decoration: none; color: var(--ink); }
.scenario::before { content: ''; display: block; width: 30px; height: 4px; border-radius: 9px; margin-bottom: 21px; background: #a58be8; }
.scenario:hover { background: var(--scenario-hover); }
.scenario:hover h3 { color: var(--accent); }
.scenario p { margin-bottom: 4px; color: var(--muted); }
.scenario-arrow { position: absolute; right: 22px; top: 22px; color: var(--accent); }
.directory-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 24px; }
.directory-link { border-top: 1px solid var(--line); padding: 16px 4px; display: flex; justify-content: space-between; gap: 8px; text-decoration: none; }
.directory-link small { display: block; margin-top: 5px; color: var(--muted); }
.directory-link:hover strong { text-decoration: underline; }

.actions { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; }
.button, .tool button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px; border: 1px solid transparent; border-radius: 999px; background: var(--mint); color: var(--action-ink); line-height: 1.25; font-weight: 700; text-decoration: none; cursor: pointer; }
.button:hover,.tool button:hover { background: var(--mint-hover); }
.button.button-secondary,.tool button.secondary { background: var(--stone); color: var(--ink); }
.button.button-secondary:hover,.tool button.secondary:hover { background: var(--stone-hover); }
.button.button-ghost { border-color: var(--field-line); background: var(--paper); color: var(--ink); }
.button.button-ghost:hover { background: var(--stone); }
.text-link { font-weight: 600; }
.tool button:disabled { opacity: .6; cursor: default; }

.crumbs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 10px; color: var(--muted); font-size: .92rem; margin-bottom: 22px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.page-head { padding: 32px 40px; border-radius: var(--radius); background: var(--paper); box-shadow: var(--surface-shadow); }
.page-head .lead { font-size: clamp(1.05rem,2.2vw,1.2rem); max-width: 71ch; color: var(--muted); margin: 17px 0 0; }
.reading { max-width: 760px; overflow-wrap: anywhere; }
.reading h2 { margin-top: 1.4em; }
.reading h3 { margin-top: 1.2em; }
.reading p,.reading li { color: var(--article-ink); }
.reading li { margin: .35em 0; }
.reading code { background: var(--code-background); padding: 1px 4px; }
.link-list { margin: 14px 0 0; padding: 0; list-style: none; }
.link-list li { border-top: 1px solid var(--line); }
.link-list li a { display: flex; min-height: 44px; align-items: center; text-decoration: none; padding: 7px 3px; overflow-wrap: anywhere; }
.link-list li a:hover { text-decoration: underline; }
.link-list.multi { display: grid; gap: 0 20px; grid-template-columns: repeat(3,minmax(0,1fr)); }
.archives details { border-top: 1px solid var(--line); }
.archives details:last-child { border-bottom: 1px solid var(--line); }
.archives summary { padding: 12px 1px; cursor: pointer; font-weight: 600; }
.archives summary small { color: var(--muted); margin-left: 8px; font-weight: 400; }
.archives details .link-list { margin: 0 0 12px 18px; }

.tool { max-width: 900px; background: var(--paper); border-radius: var(--radius); box-shadow: 0 8px 26px rgba(35,28,51,.08); padding: 24px 28px; }
.tool-form { margin-top: 18px; }
label { display: block; font-weight: 600; min-width: 0; }
input, select { display: block; width: 100%; min-height: 45px; padding: 9px 11px; margin-top: 5px; border: 1px solid var(--field-line); border-radius: 12px; color: var(--ink); background: var(--paper); }
select { padding-right: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tool-form .actions { margin-top: 18px; }
.tool-intro { display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; }
.tool-meta,.positions { color: var(--muted); font-size: .98rem; }
.positions { margin-bottom: 10px; }
.spread-scheme { margin-bottom: 12px; }
.spread-scheme ol { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 8px; padding-left: 28px; }
.spread-scheme li { padding: 6px 8px; background: var(--stone); border-radius: 8px; }
.reading-copy { margin-top: 12px; }
.reading-copy textarea { display: block; width: 100%; min-height: 7em; }
.reading-copy textarea[hidden] { display: none; }
.draw-stage { padding: 0 6px; }
.mini-back { display: grid; place-items: center; width: 46px; height: 68px; color: var(--accent); border: 1px solid #9d7bd1; outline: 1px solid #a178d3; outline-offset: -5px; background: #e8ddfc; border-radius: 8px; transform: rotate(9deg); font: 26px Arial,sans-serif; }
:root[data-theme="dark"] .mini-back { background: var(--accent-light); }
.tool-output:not(:empty) { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.question-text { color: var(--muted); overflow-wrap: anywhere; }
.result-grid { display: grid; gap: 12px; margin-top: 14px; }
.reading-card,.pair-result { background: var(--accent-light); border: 1px solid #b8a5e4; border-radius: 16px; padding: 15px; }
.reading-card { display: flex; align-items: flex-start; gap: 13px; }
.reading-mark { display: grid; place-items: center; flex: 0 0 46px; height: 67px; color: var(--accent); border: 1px solid #b8a5e4; outline: 1px solid #b8a5e4; outline-offset: -5px; border-radius: 8px; background: var(--paper); font-size: 24px; }
.reading-mark.suit-minor { background: var(--edition-background); }
.reading-details { min-width: 0; }
.result-role { font-size: .87rem; color: var(--muted); font-weight: 600; overflow-wrap: anywhere; }
.result-orientation { font-size: .86rem; color: var(--muted); margin: 4px 0; }
.reading-details h3 { margin: 3px 0; }
.reading-details p { margin-bottom: 7px; }
.message { border-left: 3px solid #a5575d; padding-left: 12px; color: var(--message-ink); }
.own-row { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 10px; margin: 14px 0; min-width: 0; border: 1px solid var(--line); padding: 12px; border-radius: 12px; }
.own-row legend { padding-inline: 5px; color: var(--accent); font-weight: 600; }
.compact-field { max-width: 150px; margin-top: 14px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.filters button { min-height: 43px; border-radius: 22px; padding: 6px 13px; border: 1px solid var(--line); background: var(--paper); color: var(--accent); cursor: pointer; }
.filters button:hover { background: var(--accent-light); }
.filters button[aria-pressed="true"] { background: var(--mint); color: var(--action-ink); border-color: var(--mint); }
.filters button:disabled { cursor: wait; opacity: .7; }
.spread-count { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.spread-count select { width: auto; margin: 0; }
.spread-count select:disabled { opacity: .7; }
.catalog-list { padding: 0; list-style: none; display: grid; gap: 0 24px; grid-template-columns: repeat(3,minmax(0,1fr)); }
.catalog-list li { border-top: 1px solid var(--line); padding: 12px 0; }
.catalog-list a { font-weight: 600; display: inline-flex; align-items: center; min-height: 32px; }
.catalog-list small { color: var(--muted); display: block; }
.card-filters { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: end; }
.inline-search { flex: 1 1 240px; max-width: 375px; }
.filter-status:empty { display: none; }
.card-catalog { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 22px; margin-top: 24px; }
.card-list-group { padding: 16px; border: 1px solid var(--line); background: var(--paper); border-radius: 22px; }
.card-list-group span { color: var(--accent); }

.footer { background: var(--footer-background); color: var(--footer-ink); }
.footer-inner { padding-block: 25px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.footer .brand,.footer a { color: var(--footer-ink); }
.footer p { font-size: .9rem; margin: 9px 0 0; }
.footer nav { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.footer :focus-visible { outline-color: var(--mint); }
.theme-choice { flex: 0 0 auto; font-size: .9rem; }

dialog { width: min(580px,calc(100% - 28px)); max-height: min(84vh,780px); padding: 0; border: 1px solid var(--line); color: var(--ink); background: var(--paper); border-radius: var(--radius); box-shadow: var(--surface-shadow); }
dialog::backdrop { background: #28193299; }
.dialog-inner { padding: 20px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; background: var(--stone); border: 1px solid transparent; color: var(--ink); border-radius: 50%; cursor: pointer; font-size: 23px; }
.icon-button:hover { background: var(--accent-light); }
.search-status { font-size: .9rem; color: var(--muted); }
.search-hit { border-top: 1px solid var(--line); text-decoration: none; display: flex; padding: 10px 3px; gap: 12px; justify-content: space-between; align-items: baseline; }
.search-hit small { color: var(--muted); flex-shrink: 0; }
.search-hit:hover { text-decoration: underline; }

@media (max-width: 1020px) {
  .header-inner { gap: 18px; }
  .nav { gap: 13px; }
  .header-cta { display: none; }
  .hero-copy { padding-left: 39px; }
}

@media (max-width: 760px) {
  .wrap { width: calc(100% - 32px); }
  .main { padding-top: 19px; padding-bottom: 34px; }
  .header { padding-top: 10px; }
  .header-inner { width: calc(100% - 24px); min-height: 62px; gap: 8px; position: relative; flex-wrap: wrap; padding: 8px 13px; border-radius: 22px; }
  .brand { font-size: 23px; }
  .mobile-menu { display: inline-flex; }
  .nav { display: none; flex-basis: 100%; order: 3; flex-direction: column; align-items: stretch; gap: 0; border-top: 1px solid var(--line); }
  .nav.is-open { display: flex; }
  .nav a { padding: 8px 3px; }
  .header-actions { padding: 0; }
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .hero-copy { padding: 28px 24px 0; }
  .hero h1 { font-size: clamp(2.125rem,8.6vw,2.875rem); }
  .hero p { margin: 15px 0 0; font-size: 1rem; }
  .hero-art { min-height: 160px; }
  .hero-card { left: auto; right: clamp(38px,14%,82px); width: 98px; aspect-ratio: .76; border-radius: 20px; }
  .hero-card-back { transform: translate(18%,-47%) rotate(12deg); }
  .hero-card-front { transform: translate(-14%,-51%) rotate(-9deg); }
  .card-seal { width: 52%; font-size: 38px; }
  .hero-actions { margin-top: 20px; }
  .page-head { padding: 24px; }
  .section { margin-block: 26px; }
  .section-head { margin-bottom: 14px; }
  .scenario-grid,.catalog-list,.link-list.multi,.card-catalog { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .scenario { min-height: 0; }
  .tool { padding: 20px; }
  .footer-inner { flex-wrap: wrap; }
}

@media (max-width: 475px) {
  .search-icon { display: none; }
  .search-trigger,.mobile-menu { padding-inline: 13px; }
  .section-head { flex-wrap: wrap; gap: 8px; }
  .scenario-grid,.catalog-list,.card-catalog,.link-list.multi,.directory-grid,.form-grid,.own-row { grid-template-columns: 1fr; }
  .scenario { padding: 20px 39px 18px 22px; }
  .scenario::before { margin-bottom: 14px; }
  .reading-card { padding: 12px; gap: 9px; }
  .search-hit { flex-wrap: wrap; gap: 3px; }
}
