.tool-workbench.tarot-draw-mounted {
  width: min(1280px, calc(100vw - 72px)) !important;
  max-width: 1280px !important;
}

.tarot-draw-page {
  overflow: auto !important;
}

.tarot-draw-mounted,
.tarot-draw-mounted * {
  box-sizing: border-box;
}

#tarotDrawMount {
  color: #091631;
}

.tarot-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  margin-top: 18px;
}

.tarot-panel,
.tarot-guide article {
  border: 1px solid rgba(190, 207, 239, 0.82);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 22px 58px rgba(34, 74, 145, 0.1);
}

.tarot-stage {
  position: relative;
  overflow: hidden;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 0%, rgba(113, 90, 255, 0.18), transparent 31%),
    radial-gradient(circle at 86% 12%, rgba(255, 193, 94, 0.18), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.96));
}

.tarot-stage::before {
  content: "";
  position: absolute;
  inset: 18px;
  pointer-events: none;
  border-radius: 24px;
  background:
    linear-gradient(120deg, transparent 0 47%, rgba(124, 97, 255, 0.12) 47.2% 47.8%, transparent 48%),
    radial-gradient(circle, rgba(43, 104, 255, 0.13) 1px, transparent 1.8px);
  background-size: auto, 32px 32px;
  opacity: 0.55;
}

.tarot-stage-head,
.tarot-cards,
.tarot-result,
.tarot-readings {
  position: relative;
  z-index: 1;
}

.tarot-stage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.tarot-stage-head span,
.tarot-question > span,
.tarot-section > span {
  color: #2d63bc;
  font-size: 13px;
  font-weight: 820;
}

.tarot-stage-head h2 {
  margin: 8px 0 8px;
  color: #07142f;
  font-size: 32px;
  line-height: 1.1;
}

.tarot-stage-head p {
  margin: 0;
  color: #61749a;
  font-size: 14px;
  line-height: 1.7;
}

.tarot-stage-head button,
.tarot-actions button,
.tarot-result button,
.tarot-chip-grid button,
.tarot-spreads button {
  border: 0;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.tarot-stage-head button {
  min-width: 118px;
  min-height: 42px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, #176dff, #765cff);
  font-size: 13px;
  font-weight: 850;
  box-shadow: 0 14px 30px rgba(42, 101, 232, 0.18);
}

.tarot-stage-head button:hover,
.tarot-actions button:hover,
.tarot-result button:hover,
.tarot-chip-grid button:hover,
.tarot-spreads button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(31, 76, 154, 0.13);
}

.tarot-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
  min-height: 360px;
  margin-top: 18px;
  border-radius: 24px;
  padding: 22px;
  background:
    linear-gradient(rgba(85, 126, 205, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(85, 126, 205, 0.06) 1px, transparent 1px),
    rgba(255, 255, 255, 0.62);
  background-size: 24px 24px, 24px 24px, auto;
  border: 1px solid rgba(190, 207, 239, 0.62);
}

.tarot-cards.single {
  grid-template-columns: minmax(240px, 320px);
  justify-content: center;
}

.tarot-card {
  position: relative;
  min-height: 310px;
  perspective: 1200px;
  animation: tarot-enter 420ms ease both;
  animation-delay: var(--delay, 0ms);
}

@keyframes tarot-enter {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.tarot-card-front,
.tarot-card-back {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 310px;
  overflow: hidden;
  border-radius: 24px;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  transition: transform 520ms cubic-bezier(.22, 1, .36, 1);
}

.tarot-card-back {
  border: 1px solid rgba(218, 226, 245, 0.82);
  color: #fff;
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.38), transparent 22%),
    linear-gradient(145deg, #171b4e, #5b45db 58%, #ff79ac);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 20px 34px rgba(66, 91, 170, 0.16);
}

.tarot-card-back::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 18px;
}

.tarot-card-back span {
  font-size: 56px;
  line-height: 1;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}

.tarot-card-back b {
  margin-top: 16px;
  font-size: 16px;
  letter-spacing: 0.04em;
}

.tarot-card-front {
  transform: rotateY(180deg);
  border: 1px solid rgba(194, 209, 237, 0.78);
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 195, 94, 0.18), transparent 28%),
    linear-gradient(160deg, #ffffff, #f8fbff);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.76),
    0 18px 35px rgba(31, 76, 154, 0.1);
  padding: 20px;
}

.tarot-card.flipped .tarot-card-back {
  transform: rotateY(-180deg);
}

.tarot-card.flipped .tarot-card-front {
  transform: rotateY(0deg);
}

.tarot-card-front small {
  color: #58719c;
  font-size: 12px;
  font-weight: 820;
}

.tarot-symbol {
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  margin: 16px 0 12px;
  border-radius: 26px;
  color: #fff;
  background:
    radial-gradient(circle at 26% 20%, rgba(255, 255, 255, 0.76), transparent 24%),
    linear-gradient(145deg, #176dff, #7b61ff 58%, #ff76a6);
  font-size: 42px;
  box-shadow: 0 16px 30px rgba(86, 93, 235, 0.2);
}

.tarot-card-front h3 {
  margin: 0;
  color: #07142f;
  font-size: 24px;
  line-height: 1.15;
}

.tarot-card-front p {
  margin: 6px 0 10px;
  color: #7182a3;
  font-size: 12px;
  font-weight: 760;
}

.tarot-card-front strong {
  border-radius: 999px;
  padding: 6px 11px;
  color: #285caa;
  background: #eef5ff;
  font-size: 12px;
}

.tarot-card-front div:last-child {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 13px;
}

.tarot-card-front em {
  border-radius: 999px;
  padding: 5px 8px;
  color: #5e4cb9;
  background: #f1efff;
  font-size: 12px;
  font-style: normal;
  font-weight: 760;
}

.tarot-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
  border: 1px solid rgba(190, 207, 239, 0.66);
  border-radius: 20px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.78);
}

.tarot-result h3 {
  margin: 0 0 6px;
  color: #0b1733;
  font-size: 17px;
}

.tarot-result p {
  margin: 0;
  color: #5d7199;
  font-size: 14px;
  line-height: 1.65;
}

.tarot-result button,
.tarot-actions button {
  min-height: 40px;
  border-radius: 13px;
  padding: 0 15px;
  color: #31527f;
  background: #eef5ff;
  font-size: 13px;
  font-weight: 820;
}

.tarot-readings {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.tarot-readings article {
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(190, 207, 239, 0.55);
}

.tarot-readings b,
.tarot-readings span {
  display: block;
}

.tarot-readings b {
  color: #0b1733;
  font-size: 14px;
}

.tarot-readings span {
  margin-top: 6px;
  color: #5d7199;
  font-size: 13px;
  line-height: 1.7;
}

.tarot-controls {
  padding: 18px;
}

.tarot-question {
  display: block;
}

.tarot-question textarea {
  width: 100%;
  min-height: 92px;
  margin-top: 8px;
  resize: vertical;
  border: 1px solid rgba(184, 203, 239, 0.9);
  border-radius: 16px;
  padding: 13px;
  outline: none;
  color: #0b1733;
  background: #fff;
  font-size: 13px;
  line-height: 1.6;
  font-weight: 720;
}

.tarot-question textarea:focus {
  border-color: #2a76ff;
  box-shadow: 0 0 0 3px rgba(42, 118, 255, 0.1);
}

.tarot-section {
  margin-top: 15px;
}

.tarot-section > span {
  display: block;
  margin-bottom: 8px;
}

.tarot-chip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.tarot-chip-grid button {
  min-height: 38px;
  border-radius: 13px;
  color: #52688f;
  background: #eef5ff;
  font-size: 13px;
  font-weight: 820;
}

.tarot-chip-grid button.active {
  color: #fff;
  background: linear-gradient(135deg, #176dff, #7464ff);
}

.tarot-spreads {
  display: grid;
  gap: 8px;
}

.tarot-spreads button {
  display: block;
  min-height: 62px;
  border: 1px solid rgba(190, 207, 239, 0.75);
  border-radius: 16px;
  padding: 10px 12px;
  color: #172540;
  text-align: left;
  background: rgba(255, 255, 255, 0.94);
}

.tarot-spreads button.active {
  border-color: rgba(56, 115, 255, 0.72);
  background:
    radial-gradient(circle at 12% 0%, rgba(123, 97, 255, 0.13), transparent 42%),
    #fff;
  box-shadow: 0 12px 26px rgba(42, 101, 232, 0.1);
}

.tarot-spreads b,
.tarot-spreads small {
  display: block;
}

.tarot-spreads b {
  font-size: 14px;
}

.tarot-spreads small {
  margin-top: 5px;
  color: #7384a4;
  font-size: 12px;
  font-weight: 720;
}

.tarot-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.tarot-actions button:first-child {
  color: #fff;
  background: linear-gradient(135deg, #176dff, #7b61ff);
  box-shadow: 0 12px 26px rgba(43, 98, 226, 0.18);
}

.tarot-history {
  margin-top: 16px;
  border-top: 1px solid rgba(196, 209, 234, 0.72);
  padding-top: 14px;
}

.tarot-history > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tarot-history h3 {
  margin: 0;
  color: #0b1733;
  font-size: 16px;
}

.tarot-history > div span {
  color: #7283a4;
  font-size: 12px;
  font-weight: 760;
}

.tarot-history ol {
  display: grid;
  gap: 9px;
  max-height: 270px;
  overflow: auto;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.tarot-history li {
  border-radius: 14px;
  padding: 11px;
  background: #f6f9ff;
}

.tarot-history li.empty {
  color: #7182a3;
  font-size: 13px;
}

.tarot-history li span,
.tarot-history li small,
.tarot-history li p {
  display: block;
}

.tarot-history li span {
  color: #7a8aaa;
  font-size: 11px;
  font-weight: 720;
}

.tarot-history li b {
  display: block;
  margin-top: 4px;
  color: #172540;
  font-size: 13px;
}

.tarot-history li small {
  margin-top: 3px;
  color: #62749a;
  font-size: 12px;
}

.tarot-history li p {
  margin: 5px 0 0;
  color: #4c5f84;
  font-size: 12px;
  line-height: 1.55;
}

.tarot-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.tarot-guide article {
  padding: 18px;
  border-radius: 20px;
}

.tarot-guide b,
.tarot-guide span {
  display: block;
}

.tarot-guide b {
  margin-bottom: 7px;
  color: #0b1733;
  font-size: 15px;
}

.tarot-guide span {
  color: #64779d;
  font-size: 13px;
  line-height: 1.7;
}

@media (max-width: 980px) {
  .tool-workbench.tarot-draw-mounted {
    width: min(100% - 28px, 1280px) !important;
  }

  .tarot-layout {
    grid-template-columns: 1fr;
  }

  .tarot-cards,
  .tarot-guide {
    grid-template-columns: 1fr;
  }

  .tarot-card,
  .tarot-card-front,
  .tarot-card-back {
    min-height: 280px;
  }
}

@media (max-width: 560px) {
  .tarot-stage,
  .tarot-controls {
    padding: 14px;
  }

  .tarot-stage-head,
  .tarot-result {
    display: grid;
  }

  .tarot-chip-grid,
  .tarot-actions {
    grid-template-columns: 1fr;
  }
}
