:root {
  --tg-bg: #fff7eb;
  --tg-card: #fffdf8;
  --tg-card-strong: #ffffff;
  --tg-text: #2d2525;
  --tg-muted: #6e6461;
  --tg-line: rgba(76, 55, 38, 0.14);
  --tg-pink: #f65b82;
  --tg-pink-strong: #ef4775;
  --tg-gold: #d59a38;
  --tg-navy: #182c3d;
  --tg-green: #96d28c;
  --tg-yellow: #ffd867;
  --tg-purple: #d9b8f4;
  --tg-red: #ff8f97;
  --tg-shadow: 0 24px 70px rgba(72, 44, 32, 0.16);
  --tg-radius: 28px;
  --tg-sans: "Avenir Next", "Segoe UI", "Helvetica Neue", "Noto Sans", sans-serif;
  --tg-platform-bg: #fff7eb;
  --tg-platform-secondary-bg: #fffdf8;
  --tg-platform-text: #2d2525;
  --tg-platform-hint: #6e6461;
  --tg-platform-button: #f65b82;
  --tg-platform-button-text: #ffffff;
  --tg-platform-link: #d59a38;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--tg-bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--tg-text);
  font-family: var(--tg-sans);
  background:
    radial-gradient(circle at 10% 0%, rgba(246, 91, 130, 0.14), transparent 32%),
    radial-gradient(circle at 92% 12%, rgba(255, 216, 103, 0.2), transparent 30%),
    linear-gradient(180deg, #fff8ee 0%, #fff2e2 100%);
}

body.is-telegram-webview {
  color: var(--tg-platform-text);
  background:
    radial-gradient(circle at 10% 0%, rgba(246, 91, 130, 0.1), transparent 32%),
    linear-gradient(180deg, var(--tg-platform-bg) 0%, var(--tg-platform-secondary-bg) 100%);
}

body.is-telegram-webview .tg-game-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}

body.is-telegram-webview .tg-game-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 248, 236, 0.88)),
    var(--tg-platform-secondary-bg);
}

body.is-telegram-webview .tg-game-primary {
  color: var(--tg-platform-button-text);
  background: var(--tg-platform-button);
}

body.is-telegram-webview .tg-game-link-button,
body.is-telegram-webview .tg-game-share-links a {
  color: var(--tg-platform-link);
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.tg-game-shell {
  width: min(100% - 24px, 440px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 0 24px;
  display: grid;
  align-items: center;
}

.tg-game-card {
  position: relative;
  overflow: hidden;
  min-height: min(760px, calc(100vh - 32px));
  border: 1px solid var(--tg-line);
  border-radius: var(--tg-radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 248, 236, 0.96)),
    var(--tg-card);
  box-shadow: var(--tg-shadow);
}

.tg-game-view {
  min-height: min(760px, calc(100vh - 32px));
  padding: 22px;
  display: flex;
  flex-direction: column;
}

.tg-game-start {
  justify-content: space-between;
  text-align: center;
}

.tg-game-kicker {
  margin: 0;
  color: var(--tg-gold);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.tg-game-title {
  margin: 10px auto 0;
  max-width: 360px;
  color: #503337;
  font-size: clamp(2.25rem, 13vw, 3.35rem);
  font-weight: 950;
  line-height: 0.96;
  letter-spacing: 0;
}

.tg-game-title span {
  color: var(--tg-pink);
}

.tg-game-subtitle {
  max-width: 330px;
  margin: 18px auto 0;
  color: #3c3333;
  font-size: 1.05rem;
  font-weight: 760;
  line-height: 1.38;
}

.tg-game-microcopy,
.tg-game-footnote,
.tg-game-result-footer {
  margin: 0;
  color: var(--tg-muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.tg-game-microcopy {
  margin: 18px auto 0;
  max-width: 340px;
  padding: 14px;
  border: 1px solid rgba(213, 154, 56, 0.26);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
}

.tg-game-start-actions {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.tg-game-primary,
.tg-game-secondary,
.tg-game-answer,
.tg-game-back,
.tg-game-share-close,
.tg-game-share-url button {
  appearance: none;
  border: 0;
  cursor: pointer;
}

.tg-game-primary,
.tg-game-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  width: 100%;
  padding: 0 18px;
  border-radius: 16px;
  font-size: 1rem;
  font-weight: 900;
}

.tg-game-primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--tg-pink), var(--tg-pink-strong));
  box-shadow: 0 14px 28px rgba(246, 91, 130, 0.24);
}

.tg-game-secondary {
  border: 1.5px solid rgba(246, 91, 130, 0.48);
  color: var(--tg-pink-strong);
  background: rgba(255, 255, 255, 0.74);
}

.tg-game-link-button {
  display: inline-flex;
  justify-content: center;
  width: 100%;
  padding: 4px 8px;
  border: 0;
  color: #8c6a50;
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.tg-game-link-button:hover,
.tg-game-link-button:focus-visible {
  color: var(--tg-pink);
  outline: none;
}

.tg-game-illustration {
  position: relative;
  width: min(230px, 74vw);
  height: 190px;
  margin: 20px auto 0;
}

.tg-game-washer {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 146px;
  height: 136px;
  transform: translateX(-50%);
  border: 3px solid #302a2a;
  border-radius: 18px;
  background: #fff8eb;
  box-shadow: 0 12px 0 rgba(213, 154, 56, 0.16);
}

.tg-game-washer::before {
  content: "";
  position: absolute;
  left: 28px;
  top: 40px;
  width: 82px;
  height: 82px;
  border: 10px solid #89c3cf;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--tg-pink) 0 18px, transparent 19px),
    #274253;
}

.tg-game-washer::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 16px;
  width: 106px;
  height: 10px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 88px 5px, #302a2a 0 5px, transparent 6px),
    radial-gradient(circle at 68px 5px, #302a2a 0 5px, transparent 6px),
    linear-gradient(#302a2a, #302a2a) left center / 42px 3px no-repeat;
}

.tg-game-basket {
  position: absolute;
  left: 8px;
  bottom: 6px;
  width: 70px;
  height: 54px;
  border: 3px solid #302a2a;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background:
    linear-gradient(90deg, transparent 31%, rgba(48, 42, 42, 0.28) 32% 34%, transparent 35%),
    linear-gradient(90deg, transparent 65%, rgba(48, 42, 42, 0.28) 66% 68%, transparent 69%),
    #ffd986;
}

.tg-game-basket::before {
  content: "";
  position: absolute;
  left: 4px;
  top: -22px;
  width: 62px;
  height: 28px;
  border-radius: 18px 18px 0 0;
  background:
    radial-gradient(circle at 18px 15px, #ff8f97 0 12px, transparent 13px),
    radial-gradient(circle at 34px 12px, #98d08e 0 12px, transparent 13px),
    radial-gradient(circle at 48px 15px, #d9b8f4 0 12px, transparent 13px);
}

.tg-game-heart {
  position: absolute;
  right: 18px;
  top: 2px;
  width: 42px;
  height: 42px;
  transform: rotate(-10deg);
}

.tg-game-heart::before {
  content: "♡";
  color: #ff8f97;
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1;
}

.tg-game-topline {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 10px;
}

.tg-game-back {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 999px;
  color: #352c2c;
  background: rgba(255, 255, 255, 0.76);
  font-size: 1.35rem;
}

.tg-game-step {
  text-align: center;
  font-weight: 900;
}

.tg-game-progress {
  height: 8px;
  margin: 14px 0 20px;
  overflow: hidden;
  border-radius: 999px;
  background: #ece4dd;
}

.tg-game-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--tg-pink), #ff7598);
  transition: width 180ms ease;
}

.tg-game-zone {
  display: inline-flex;
  align-self: center;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  padding: 6px 12px;
  border-radius: 999px;
  color: #8b6220;
  background: rgba(255, 216, 103, 0.22);
  font-size: 0.78rem;
  font-weight: 900;
}

.tg-game-question-icon {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  margin: 0 auto 16px;
  border: 1px solid rgba(213, 154, 56, 0.38);
  border-radius: 50%;
  background: #fff2d8;
  color: #503337;
  font-size: 1.8rem;
  font-weight: 950;
}

.tg-game-question h1,
.tg-game-result h1 {
  margin: 0 auto;
  max-width: 340px;
  color: #2d2525;
  text-align: center;
  font-size: clamp(1.35rem, 6.3vw, 2.05rem);
  line-height: 1.12;
  letter-spacing: 0;
}

.tg-game-question-note {
  max-width: 320px;
  margin: 10px auto 18px;
  color: var(--tg-muted);
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.4;
}

.tg-game-answers {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.tg-game-answer {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 64px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--tg-line);
  border-radius: 15px;
  color: var(--tg-text);
  background: rgba(255, 255, 255, 0.84);
  text-align: left;
  box-shadow: 0 7px 18px rgba(70, 47, 33, 0.06);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.tg-game-answer:hover,
.tg-game-answer:focus-visible {
  border-color: rgba(246, 91, 130, 0.42);
  background: #ffffff;
  outline: none;
  transform: translateY(-1px);
}

.tg-game-answer.is-selected {
  border-color: rgba(246, 91, 130, 0.64);
  background: rgba(255, 242, 246, 0.96);
}

.tg-game-answer-letter {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: #25352f;
  font-size: 0.9rem;
  font-weight: 950;
}

.tg-game-answer-letter-a {
  background: var(--tg-green);
}

.tg-game-answer-letter-b {
  background: var(--tg-yellow);
}

.tg-game-answer-letter-c {
  background: var(--tg-purple);
}

.tg-game-answer-letter-d {
  background: var(--tg-red);
}

.tg-game-answer-text {
  color: #352e2e;
  font-size: 0.93rem;
  font-weight: 760;
  line-height: 1.28;
}

.tg-game-hint {
  margin: 16px 0 0;
  color: #897b70;
  text-align: center;
  font-size: 0.86rem;
  line-height: 1.35;
}

.tg-game-result {
  gap: 14px;
  text-align: center;
}

.tg-game-confetti {
  color: var(--tg-gold);
  font-size: 1.8rem;
  letter-spacing: 0.35em;
}

.tg-game-result-card {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding: 18px;
  border-radius: 22px;
  color: #352a3b;
  background: linear-gradient(135deg, #e7c6f4, #c9abea);
}

.tg-game-result-card h2 {
  margin: 0;
  font-size: clamp(1.35rem, 6vw, 1.85rem);
  line-height: 1.12;
}

.tg-game-result-card p {
  margin: 0;
  color: rgba(53, 42, 59, 0.86);
  font-size: 0.94rem;
  font-weight: 680;
  line-height: 1.35;
}

.tg-game-result-card-partner {
  background: linear-gradient(135deg, #d4f2c7, #bfe7b5);
}

.tg-game-result-card-negotiation {
  background: linear-gradient(135deg, #e6c4f7, #c9abea);
}

.tg-game-result-card-emotional {
  background: linear-gradient(135deg, #ffd4c8, #ffc1b5);
}

.tg-game-result-card-leader {
  background: linear-gradient(135deg, #ffe5a8, #f5c773);
}

.tg-game-result-card-unsynced {
  background: linear-gradient(135deg, #dceeff, #c8def1);
}

.tg-game-result-blocks {
  display: grid;
  gap: 10px;
}

.tg-game-result-block {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
  padding: 13px;
  border: 1px solid rgba(76, 55, 38, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  text-align: left;
}

.tg-game-result-block b {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: #73b96a;
}

.tg-game-result-block.is-warning b {
  background: var(--tg-gold);
}

.tg-game-result-block strong {
  display: block;
  color: #302b2b;
  font-size: 0.88rem;
}

.tg-game-result-block p {
  margin: 4px 0 0;
  color: var(--tg-muted);
  font-size: 0.88rem;
  line-height: 1.36;
}

.tg-game-result-actions {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.tg-game-score-details {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0;
}

.tg-game-score-details span {
  padding: 5px 8px;
  border-radius: 999px;
  color: #655a54;
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.72rem;
  font-weight: 800;
}

.tg-game-share-modal[hidden] {
  display: none;
}

.tg-game-share-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
}

.tg-game-share-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 28, 29, 0.58);
  backdrop-filter: blur(4px);
}

.tg-game-share-card {
  position: relative;
  z-index: 1;
  width: min(100%, 390px);
  padding: 22px;
  border-radius: 24px;
  background: #fffdf8;
  box-shadow: var(--tg-shadow);
  text-align: center;
}

.tg-game-share-close {
  position: absolute;
  right: 14px;
  top: 14px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: #443737;
  background: #f0e8dc;
  font-size: 1.5rem;
}

.tg-game-share-card h2 {
  margin: 8px 0 0;
  font-size: 1.45rem;
  line-height: 1.15;
}

.tg-game-share-copy {
  margin: 12px 0 0;
  color: var(--tg-muted);
  line-height: 1.45;
  white-space: pre-line;
}

.tg-game-share-url {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 16px;
}

.tg-game-share-url input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--tg-line);
  border-radius: 12px;
  padding: 12px;
  color: #443737;
  background: #fff8ee;
}

.tg-game-share-url button {
  padding: 0 12px;
  border-radius: 12px;
  color: #ffffff;
  background: var(--tg-navy);
  font-weight: 850;
}

.tg-game-share-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.tg-game-share-links a {
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--tg-navy);
  background: #f4ecde;
  font-size: 0.86rem;
  font-weight: 850;
}

@media (min-width: 720px) {
  .tg-game-shell {
    width: min(100% - 48px, 520px);
    padding: 28px 0;
  }

  .tg-game-card,
  .tg-game-view {
    min-height: 760px;
  }
}

@media (max-width: 374px) {
  .tg-game-shell {
    width: min(100% - 16px, 440px);
  }

  .tg-game-view {
    padding: 16px;
  }

  .tg-game-title {
    font-size: 2.1rem;
  }

  .tg-game-question h1,
  .tg-game-result h1 {
    font-size: 1.25rem;
  }

  .tg-game-answer {
    min-height: 58px;
  }
}
