:root {
  --bg: #ece9e4;
  --text: #2a2a2a;
  --muted: #6b6560;
  --accent: #ff2a32;
  --picker-active: #ff2a32;
  --shadow-light: #ffffff;
  --shadow-dark: #c8c4bf;
  --radius: 20px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.45;
}

body.page-portal.page-no-bg {
  background-image: none;
}

body.page-portal {
  background-color: #ece9e4;
}

body.page-portal:not(.page-no-bg) .page {
  padding-top: 0;
}

.portal-hero {
  margin: 0 -16px clamp(-52px, -11vw, -76px);
  line-height: 0;
}

.portal-hero-img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
}

body.page-portal:not(.page-no-bg) .nav-back {
  margin: 0 0 6px 4px;
  position: relative;
  z-index: 1;
}

body.page-portal:not(.page-no-bg) .portal-shell,
body.page-portal:not(.page-no-bg) .portal-panel {
  position: relative;
  z-index: 1;
}

.package-pick-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 14px;
}

.package-pick-list .package-pick {
  margin-bottom: 0;
}

.package-pick-list .package-pick.is-selected {
  box-shadow: 6px 6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light);
  color: var(--text);
}

body.page-portal.page-no-bg .page,
body.page-portal.page-scheme-compact .page {
  padding-top: 8px;
}

.portal-shell {
  margin-bottom: 12px;
}

.portal-panel {
  margin-bottom: 8px;
}

.bot-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.bot-nav--row {
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
}

.bot-nav--row .btn-bot--compact {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  padding: 12px 8px;
  font-size: 0.82rem;
  text-align: center;
}

.bot-nav .btn-bot,
.bot-nav .btn-bot--secondary {
  margin-top: 0;
}

body.page-scheme-bg {
  background-position: center 28%;
}

.meta-row--icon-end {
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.meta-row--icon-end span {
  flex: 1;
  min-width: 0;
}

.meta-row--icon-end .inline-icon {
  flex-shrink: 0;
  margin: 0;
}

.free-limit-note {
  margin-top: -8px;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.calc-snapshot {
  margin: 8px 0;
  font-size: 0.95rem;
}

.intro-web .schema-icon {
  display: inline-block;
  width: 22px;
  height: 22px;
  vertical-align: -5px;
  margin-right: 4px;
  color: var(--text);
}

.page {
  max-width: 420px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}

.card {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 8px 8px 20px var(--shadow-dark), -8px -8px 20px var(--shadow-light);
  padding: 20px;
  margin-bottom: 16px;
}

.card.inset {
  box-shadow: inset 6px 6px 14px var(--shadow-dark), inset -6px -6px 14px var(--shadow-light);
}

h1 {
  font-size: 1.6rem;
  margin: 0 0 8px;
  text-align: center;
}

.sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.hero-img {
  width: 100%;
  border-radius: 16px;
  display: block;
  margin-bottom: 16px;
}

.img-blend {
  background: transparent;
}

.btn-bot {
  margin-top: 14px;
  margin-bottom: 0;
}

.btn-bot--secondary {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.price-hint {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
  margin: 10px 0 0;
}

.card-picker {
  margin: 8px 0 0;
}

.card-slot {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.card-slot:last-child {
  border-bottom: none;
}

.slot-title {
  font-weight: 600;
  margin: 0 0 6px;
}

.slot-summary {
  min-height: 1.25em;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 8px;
}

.picker-label {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 8px 0 6px;
}

.picker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.picker-suits {
  display: block;
  width: 100%;
}

.picker-suit-cross {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}

.picker-suit-row--top,
.picker-suit-row--bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.picker-suit-row--top .picker-chip,
.picker-suit-row--bottom .picker-chip {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.picker-suit-row--mid {
  display: flex;
  justify-content: center;
  width: 100%;
}

.picker-chip-major-suite {
  width: min(36vw, 118px);
  aspect-ratio: 1;
  border-radius: 50%;
  white-space: normal;
  line-height: 1.2;
  text-align: center;
  padding: 10px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.picker-ranks-major .picker-chip-major-world {
  grid-column: 2;
}

.picker-ranks-minor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.picker-ranks-minor-nums {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.picker-ranks-minor-courts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.picker-ranks-minor-nums .picker-chip,
.picker-ranks-minor-courts .picker-chip {
  width: 100%;
  padding-left: 6px;
  padding-right: 6px;
  font-size: 0.78rem;
}

.picker-ranks-major {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.picker-ranks-major .picker-chip {
  width: 100%;
  font-size: 0.76rem;
  line-height: 1.2;
  white-space: normal;
  padding: 8px 4px;
}

.picker-positions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.picker-positions .picker-chip {
  width: 100%;
  text-align: center;
  border-radius: 14px;
}

.picker-chip {
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--bg);
  box-shadow: inset 3px 3px 8px var(--shadow-dark), inset -3px -3px 8px var(--shadow-light);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
}

.picker-chip.active {
  box-shadow: 4px 4px 10px var(--shadow-dark), -4px -4px 10px var(--shadow-light);
  font-weight: normal;
  color: var(--picker-active);
}

.spread-scheme-img {
  margin: 14px 0 18px;
  text-align: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.spread-scheme-img img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
}

.add-card-row {
  display: block;
  margin-top: 12px;
  margin-bottom: 8px;
}

.add-card-row .btn-primary {
  width: 100%;
}

.question-wrap {
  display: block;
  margin-top: 14px;
}

.meta-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 10px 0;
  font-size: 0.92rem;
}

.inline-icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  color: var(--text);
  margin-top: 2px;
}

.history-meta {
  margin: 0 0 4px;
}

.history-h {
  margin: 14px 0 8px;
}

.nav-back {
  display: inline-block;
  margin: 0 0 12px 4px;
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
}

.nav-back:hover {
  color: var(--text);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.package-list {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
}

.package-offer {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.package-offer:last-child {
  border-bottom: none;
}

.package-list--compact {
  margin-bottom: 10px;
}

.packages-h {
  margin: 14px 0 8px;
}

.packages-h:first-child {
  margin-top: 0;
}

.packages-copy {
  margin-bottom: 8px;
}

.packages-copy .package-select-label {
  display: block;
  margin: 14px 0 6px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.packages-copy select {
  width: 100%;
  margin-top: 4px;
  min-height: 52px;
  text-align: center;
  font-weight: normal;
  color: var(--text);
  box-shadow: inset 4px 4px 12px var(--shadow-dark), inset -4px -4px 12px var(--shadow-light);
}

.packages-copy select option {
  font-weight: normal;
  color: var(--text);
}

@media (max-width: 640px) {
  .packages-copy select {
    -webkit-appearance: menulist;
    appearance: menulist;
    font-size: 16px;
    line-height: 1.4;
    padding: 12px 10px;
    background-color: var(--bg);
    position: relative;
    z-index: 3;
    touch-action: manipulation;
  }

  .page .portal-panel {
    margin-bottom: max(20px, env(safe-area-inset-bottom, 20px));
  }

  .page .portal-panel form:has(#package-select) {
    padding-bottom: 12px;
  }
}

.note {
  margin-top: 12px;
  text-align: center;
}

.tile-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
  width: 100%;
}

.tile-row--trio {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tile {
  aspect-ratio: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  border-radius: 14px;
  background: var(--bg);
  box-shadow: 5px 5px 12px var(--shadow-dark), -5px -5px 12px var(--shadow-light);
  padding: 6px 2px;
  border: none;
  cursor: pointer;
  font: inherit;
}

.tile .icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.portal-shell .sub {
  margin-bottom: 16px;
}

.tile-row--inset {
  margin-bottom: 14px;
}

.tile-icon {
  width: 30px;
  height: 30px;
  margin-bottom: 6px;
  color: var(--text);
}

.tile-label {
  font-size: 0.78rem;
  line-height: 1.2;
  font-weight: 500;
  hyphens: manual;
  padding: 0 2px;
}

.tile-row--trio .tile {
  max-width: none;
}

.consent-accept {
  width: 100%;
  margin-top: 12px;
}

.calc-recap {
  margin: 0 0 10px;
}

.calc-recap-h {
  margin: 0 0 8px;
  text-align: center;
}

.calc-recap-body {
  font-size: 0.9rem;
}

.menu-stack {
  margin-top: 4px;
}

.menu-item.disabled {
  color: var(--muted);
}

.tile.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.promo-link-wrap {
  text-align: center;
  margin: 18px 0 16px;
}

.promo-link {
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.promo-link:hover {
  color: #1a5fb4;
}

.legal--inset {
  box-shadow: none;
  padding: 0;
  margin: 0;
}

.legal-hint {
  margin: 12px 0 0;
  font-size: 0.78rem;
  text-align: center;
  color: var(--muted);
}

.chk-square {
  appearance: none;
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 2px 0 0;
  border-radius: 2px;
  background: var(--bg);
  box-shadow:
    inset 3px 3px 6px var(--shadow-dark),
    inset -3px -3px 6px var(--shadow-light);
  cursor: pointer;
  position: relative;
}

.chk-square:checked {
  box-shadow:
    inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
}

.chk-square:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--text);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.tile:disabled,
.menu-item.disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

.menu-item {
  display: block;
  width: 100%;
  text-align: center;
  padding: 14px 16px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: inset 4px 4px 12px var(--shadow-dark), inset -4px -4px 12px var(--shadow-light);
  color: var(--text);
  text-decoration: none;
  border: none;
  font: inherit;
  cursor: pointer;
}

.menu-item.active,
.menu-item:not(.disabled):hover {
  box-shadow: 6px 6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light);
}

.legal {
  font-size: 0.82rem;
  color: var(--muted);
}

.legal label {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: flex-start;
}

.legal a {
  color: #1a5fb4;
}

.hd-bodygraph-wrap {
  margin: 0 auto 16px auto;
  max-width: 520px;
}

.hd-bodygraph {
  width: 100%;
  height: auto;
  display: block;
  background: transparent;
}

.hd-download {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: center;
  margin: 0 0 18px 0;
}

.hd-download-btn {
  display: inline-block;
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 10px;
  text-align: center;
  white-space: nowrap;
  border-radius: 999px;
  font-size: 0.88rem;
  color: #181818;
  text-decoration: none;
  background: #ece9e4;
  box-shadow: 4px 4px 10px #d8d5d0, -4px -4px 10px #ffffff;
  border: none;
}

.hd-download-btn:hover {
  color: #ff2a32;
  box-shadow: inset 3px 3px 8px #d8d5d0, inset -3px -3px 8px #ffffff;
}

.matrix-wrap {
  margin: 0 0 12px 0;
}

.site-footer {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid #ddd9d4;
}

.footer-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px 10px;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: inset 4px 4px 12px var(--shadow-dark), inset -4px -4px 12px var(--shadow-light);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-contact:hover {
  box-shadow: 6px 6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light);
}

.footer-icon {
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
}

.footer-email {
  color: var(--muted);
}

.footer-legal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.footer-legal a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-dot {
  margin: 0 6px;
  opacity: 0.65;
}

.login-entry {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.login-entry:hover {
  color: #c91f26;
}

.auth-hint {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 0;
}

.auth-book {
  width: min(100%, 420px);
  margin: 0 auto;
  position: relative;
}

.auth-tabs--pair {
  display: flex;
  align-items: flex-end;
  width: 100%;
  gap: 4px;
  position: relative;
  z-index: 1;
}

.auth-tab {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  padding: 10px 8px 12px;
  border-radius: 14px 14px 0 0;
  text-decoration: none;
  color: var(--muted);
  background: var(--bg);
  font-size: clamp(0.8rem, 3.6vw, 0.92rem);
  font-weight: 400;
  line-height: 1.2;
  box-shadow:
    inset 3px 3px 8px var(--shadow-dark),
    inset -2px -2px 6px var(--shadow-light);
  transform: translateY(5px);
  position: relative;
  z-index: 1;
  transition: transform 0.15s ease, color 0.15s ease;
}

.auth-tab.active {
  color: var(--accent);
  font-weight: 400;
  transform: translateY(0);
  z-index: 2;
  padding-bottom: 14px;
  box-shadow:
    5px -3px 10px var(--shadow-dark),
    -3px -2px 8px var(--shadow-light);
}

.page-login--tabbed {
  position: relative;
  z-index: 2;
  border-radius: 0 0 18px 18px;
  margin-top: -2px;
}

.user-session {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 6px 12px;
}

.logout-link {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: 0.92rem;
}

.logout-link:hover {
  color: var(--text);
}

.field-hint {
  margin: -6px 0 4px 4px;
  font-size: 0.82rem;
  color: var(--muted);
}

.admin-form {
  margin: 0;
  padding: 0;
}

.admin-form-btn {
  width: 100%;
  border: none;
  cursor: pointer;
  font: inherit;
  text-align: center;
}

.admin-textarea,
.admin-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: none;
  background: var(--bg);
  box-shadow: inset 4px 4px 12px var(--shadow-dark), inset -4px -4px 12px var(--shadow-light);
  font: inherit;
  box-sizing: border-box;
}

.admin-stats-page .admin-stats-body {
  font-size: 0.92rem;
  line-height: 1.45;
  text-align: left;
}

.admin-stats-page .admin-stats-body table {
  width: 100%;
  margin: 8px 0;
}

.password-wrap {
  position: relative;
  display: block;
}

.password-wrap input {
  width: 100%;
  padding-right: 46px;
  box-sizing: border-box;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  padding: 6px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  box-shadow: none;
}

.password-toggle:hover {
  color: var(--text);
}

.password-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
  margin: 0 auto;
}

.legal-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.85rem;
  color: var(--muted);
}

.login-forgot {
  text-align: right;
  font-size: 0.88rem;
}

.login-forgot a {
  color: var(--muted);
}

.menu-item--admin {
  margin-bottom: 12px;
  text-align: center;
  font-weight: 600;
}

.form-error {
  color: var(--accent);
  font-size: 0.9rem;
  margin: 0 0 12px;
}

.login-arrow {
  display: inline-block;
  margin-left: 4px;
}

.login-via-label {
  font-weight: 600;
  margin: 12px 0 8px;
}

.login-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-messenger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-tg-widget {
  display: flex;
  justify-content: center;
  margin: 8px 0;
}

.login-hint {
  font-size: 0.88rem;
  color: var(--muted);
}

.login-register-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.messenger-icon {
  width: 1.6rem;
  height: 1.6rem;
  flex-shrink: 0;
}

.messenger-icon--max circle {
  fill: #4b5cff;
}

.messenger-icon--max path {
  fill: #ffffff;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
}

.form-field input {
  padding: 12px 14px;
  border-radius: 999px;
  border: none;
  background: var(--bg);
  box-shadow: inset 4px 4px 12px var(--shadow-dark), inset -4px -4px 12px var(--shadow-light);
  font: inherit;
}

.page-login .nav-back {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.matrix-chart {
  width: 100%;
  height: auto;
  display: block;
  background: transparent;
}

.matrix-hint {
  margin: 6px 0 14px 0;
  text-align: center;
}

.matrix-toggle-link {
  color: #181818;
  text-decoration: none;
}

.matrix-toggle-link:hover {
  color: #ff2a32;
}

.field-example {
  margin: -4px 0 8px 0;
  font-size: 0.82rem;
  color: #7d786f;
}

.page-matrix .result-actions .btn-accent {
  color: #181818;
  box-shadow: 6px 6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light);
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: 6px 6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light);
  font-size: 1rem;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  margin-top: 12px;
}

.btn-accent {
  background: linear-gradient(145deg, #f5f2ee, #e0dcd6);
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 14px;
  margin: 8px 0 12px;
  background: var(--bg);
  box-shadow: inset 4px 4px 10px var(--shadow-dark), inset -4px -4px 10px var(--shadow-light);
  font: inherit;
}

.result-body {
  white-space: pre-wrap;
}

.price {
  font-weight: 600;
  text-align: center;
  margin: 12px 0;
}

.site-disclaimer {
  margin: 14px 0 0;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.4;
}

.dream-menu-icon {
  margin-bottom: 12px;
}

.tile.tile--static {
  pointer-events: none;
  text-decoration: none;
  color: inherit;
}