.cbt-play-app {
  --cbt-bg: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
  --cbt-surface: rgba(255, 255, 255, 0.92);
  --cbt-surface-soft: rgba(244, 248, 253, 0.82);
  --cbt-border: rgba(74, 105, 143, 0.14);
  --cbt-accent: #3d7cf1;
  --cbt-accent-strong: #2a5fc4;
  --cbt-ink: #1f2f45;
  --cbt-muted: #5f7088;
  --cbt-success: #2f8a56;
  --cbt-warn: #bf6f26;
  min-height: 0;
  height: 100%;
  max-height: 100dvh;
  padding: 14px 14px calc(18px + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(circle at top right, rgba(130, 190, 255, 0.2), transparent 34%),
    radial-gradient(circle at top left, rgba(220, 238, 255, 0.86), transparent 28%),
    var(--cbt-bg);
  color: var(--cbt-ink);
  overflow: hidden;
}

.cbt-play-app--immersive {
  min-height: 0;
  height: 100%;
}

.cbt-play-app__viewport-shell {
  display: flex;
  flex-direction: column;
  max-width: 1120px;
  height: 100%;
  min-height: 0;
  gap: 10px;
  margin: 0 auto;
}

.cbt-play-app__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--cbt-border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 16px 36px rgba(46, 86, 138, 0.08);
}

.cbt-play-app__topbar-group,
.cbt-play-app__topbar-status,
.cbt-play-app__section-actions,
.cbt-play-app__result-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.cbt-play-app__content-card {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px;
  border: 1px solid var(--cbt-border);
  background: var(--cbt-surface);
  border-radius: 28px;
  box-shadow: 0 16px 40px rgba(46, 86, 138, 0.08);
  overflow: hidden;
}

.cbt-play-app--immersive .cbt-play-app__content-card,
.cbt-play-app--immersive .cbt-play-app__stack--fill {
  display: flex;
  flex-direction: column;
}

.cbt-play-app__action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.cbt-play-app__action-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 18px;
  border: 1px solid rgba(74, 105, 143, 0.12);
  border-radius: 24px;
  background: rgba(247, 250, 255, 0.92);
  text-align: left;
  cursor: pointer;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.cbt-play-app__action-card:hover {
  transform: translateY(-1px);
  border-color: rgba(61, 124, 241, 0.28);
  box-shadow: 0 16px 32px rgba(46, 86, 138, 0.08);
}

.cbt-play-app__action-card--primary {
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.98), rgba(248, 251, 255, 0.98));
  border-color: rgba(61, 124, 241, 0.2);
}

.cbt-play-app__action-card-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.cbt-play-app__hero--compact {
  padding: 20px;
}

.cbt-play-app__panel--section-head {
  padding: 14px 16px;
}

.cbt-play-app__stack--results {
  min-height: 100%;
}

.cbt-play-app__card-scroll {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.cbt-play-app__stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: min-content;
}

.cbt-play-app__hero,
.cbt-play-app__panel {
  border: 1px solid var(--cbt-border);
  background: var(--cbt-surface);
  border-radius: 28px;
  box-shadow: 0 16px 40px rgba(46, 86, 138, 0.08);
}

.cbt-play-app__hero {
  padding: 24px;
}

.cbt-play-app__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(61, 124, 241, 0.1);
  color: var(--cbt-accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cbt-play-app__hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.cbt-play-app__workspace {
  padding: 18px;
  border-radius: 32px;
  border: 1px solid rgba(74, 105, 143, 0.12);
  background: rgba(251, 253, 255, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.cbt-play-app__workspace-body {
  margin-top: 14px;
}

.cbt-play-app__solver-scroll {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.cbt-play-app__hero-copy {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cbt-play-app__hero-copy h2.ant-typography {
  margin: 0;
  color: var(--cbt-ink);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.08;
}

.cbt-play-app__hero-copy .ant-typography {
  color: var(--cbt-muted);
}

.cbt-play-app__hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cbt-play-app__hero-points .ant-tag {
  margin: 0;
  border-radius: 999px;
  padding-inline: 12px;
  border-color: rgba(61, 124, 241, 0.14);
  color: var(--cbt-accent-strong);
  background: rgba(239, 246, 255, 0.95);
}

.cbt-play-app__hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.cbt-play-app__metric {
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 247, 255, 0.94));
  border: 1px solid rgba(74, 105, 143, 0.1);
}

.cbt-play-app__metric-value {
  display: block;
  font-size: 24px;
  font-weight: 800;
  color: var(--cbt-ink);
}

.cbt-play-app__metric-label {
  display: block;
  margin-top: 4px;
  color: var(--cbt-muted);
  font-size: 12px;
}

.cbt-play-app__option-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0 0;
  border-top: 1px solid rgba(74, 105, 143, 0.12);
}

.cbt-play-app__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.cbt-play-app__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.cbt-play-app__field--full {
  grid-column: 1 / -1;
}

.cbt-play-app__field-label {
  color: var(--cbt-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.cbt-play-app__toolbar,
.cbt-play-app__option-line,
.cbt-play-app__summary-row,
.cbt-play-app__history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.cbt-play-app__summary-row {
  justify-content: space-between;
}

.cbt-play-app__solver-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.cbt-play-app__subject-picker {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.cbt-play-app__resume-banner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 0 0 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(74, 105, 143, 0.12);
}

.cbt-play-app__resume-section {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(74, 105, 143, 0.12);
}

.cbt-play-app__resume-list {
  display: grid;
  gap: 12px;
}

.cbt-play-app__resume-card {
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid rgba(74, 105, 143, 0.12);
  background: rgba(247, 250, 255, 0.92);
}

.cbt-play-app__resume-meta {
  margin-top: 4px;
}

.cbt-play-app__subject-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}

.cbt-play-app__subject-actions .ant-typography {
  margin: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.cbt-play-app__sheet,
.cbt-play-app__question,
.cbt-play-app__history-card,
.cbt-play-app__wrong-card {
  padding: 18px 0;
  border-radius: 0;
  border: 0;
  border-top: 1px solid rgba(74, 105, 143, 0.12);
  background: transparent;
  box-shadow: none;
}

.cbt-play-app__stack > :first-child.cbt-play-app__sheet,
.cbt-play-app__stack > :first-child.cbt-play-app__panel,
.cbt-play-app__stack > :first-child.cbt-play-app__question,
.cbt-play-app__stack > :first-child.cbt-play-app__history-card,
.cbt-play-app__stack > :first-child.cbt-play-app__wrong-card {
  border-top: 0;
  padding-top: 0;
}

.cbt-play-app__question {
  padding-bottom: 6px;
}

.cbt-play-app__question-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cbt-play-app__question-body {
  margin-top: 18px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.55;
  color: var(--cbt-ink);
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.cbt-play-app__choice-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}

.cbt-play-app__choice-button {
  justify-content: flex-start;
  min-height: 64px;
  white-space: normal;
  text-align: left;
  border-radius: 20px;
  border-width: 1px;
  color: var(--cbt-ink);
  font-weight: 600;
  padding: 14px 16px;
}

.cbt-play-app__choice-button > span:last-child {
  flex: 1;
  min-width: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.cbt-play-app__choice-button.ant-btn-default {
  border-color: rgba(74, 105, 143, 0.14);
  background: rgba(255, 255, 255, 0.96);
}

.cbt-play-app__choice-button.ant-btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, #3d7cf1, #6aa5ff);
}

.cbt-play-app__choice-prefix {
  display: inline-flex;
  width: 28px;
  color: var(--cbt-accent);
  font-weight: 800;
}

.cbt-play-app__meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cbt-play-app__meta-strip .ant-tag {
  margin: 0;
  border-radius: 999px;
}

.cbt-play-app__question-feedback {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(242, 247, 255, 0.95);
  border: 1px solid rgba(61, 124, 241, 0.14);
}

.cbt-play-app__subject-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.cbt-play-app__subject-stat {
  padding: 14px 0 10px;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid rgba(74, 105, 143, 0.1);
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cbt-play-app__subject-stat-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 8px;
}

.cbt-play-app__subject-stat-head .ant-typography {
  min-width: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.cbt-play-app__subject-stat-rate {
  font-size: 26px;
  font-weight: 800;
  color: var(--cbt-accent-strong);
  line-height: 1;
}

.cbt-play-app__subject-start {
  margin-top: auto;
}

.cbt-play-app__wrong-card,
.cbt-play-app__history-card {
  padding: 16px;
}

.cbt-play-app__sticky-bar {
  position: sticky;
  bottom: 12px;
  z-index: 4;
}

.cbt-play-app__sticky-inner {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border-radius: 24px;
  border: 1px solid rgba(74, 105, 143, 0.14);
  background: rgba(248, 251, 255, 0.98);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 40px rgba(46, 86, 138, 0.12);
}

.cbt-play-app__sticky-inner .ant-btn {
  min-height: 46px;
  border-radius: 16px;
}

.cbt-play-app__empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--cbt-muted);
}

.cbt-play-app__empty--fill {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.cbt-play-app .ant-tag,
.cbt-play-app .ant-btn,
.cbt-play-app .ant-segmented-item-label,
.cbt-play-app .ant-typography,
.cbt-play-app .ant-alert-message,
.cbt-play-app .ant-alert-description {
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.cbt-play-app__select {
  min-width: 0;
}

.cbt-play-app__select .ant-select-selector {
  min-height: 44px !important;
  padding: 6px 12px !important;
  align-items: center;
  border-radius: 16px !important;
  border-color: rgba(74, 105, 143, 0.16) !important;
  background: rgba(255, 255, 255, 0.96) !important;
  box-shadow: none !important;
}

.cbt-play-app__select.ant-select-single {
  min-height: 44px;
}

.cbt-play-app__select.ant-select-single .ant-select-selector {
  display: flex;
}

.cbt-play-app__select.ant-select-single .ant-select-selection-wrap,
.cbt-play-app__select.ant-select-single .ant-select-selection-search,
.cbt-play-app__select.ant-select-single .ant-select-selection-item,
.cbt-play-app__select.ant-select-single .ant-select-selection-placeholder {
  display: flex;
  align-items: center;
}

.cbt-play-app__select.ant-select-single .ant-select-selection-item,
.cbt-play-app__select.ant-select-single .ant-select-selection-placeholder {
  min-width: 0;
  line-height: 1.35 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cbt-play-app__select.ant-select-multiple .ant-select-selector {
  padding-block: 7px !important;
}

.cbt-play-app__select.ant-select-multiple .ant-select-selection-overflow {
  flex-wrap: wrap;
  gap: 6px;
}

.cbt-play-app__select.ant-select-multiple .ant-select-selection-overflow-item {
  max-width: 100%;
}

.cbt-play-app__select.ant-select-multiple .ant-select-selection-item {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border-radius: 999px !important;
  background: rgba(239, 246, 255, 0.95) !important;
  border: 1px solid rgba(61, 124, 241, 0.12) !important;
  color: var(--cbt-accent-strong) !important;
}

.cbt-play-app__select.ant-select-multiple .ant-select-selection-item-content {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cbt-play-app__select.ant-select-multiple .ant-select-selection-placeholder {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cbt-play-app .ant-btn-primary {
  background: linear-gradient(135deg, #3d7cf1, #6aa5ff);
  border-color: transparent;
  box-shadow: none;
}

.cbt-play-app .ant-space,
.cbt-play-app .ant-space-item {
  min-width: 0;
}

.cbt-play-app__stack--fill {
  height: 100%;
  min-height: 0;
}

@media (max-width: 920px) {
  .cbt-play-app__hero-grid,
  .cbt-play-app__grid,
  .cbt-play-app__subject-grid,
  .cbt-play-app__action-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .cbt-play-app {
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .cbt-play-app--immersive {
    height: 100%;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    overflow: hidden;
  }

  .cbt-play-app__viewport-shell,
  .cbt-play-app__content-card {
    height: 100%;
    min-height: 0;
  }

  .cbt-play-app__topbar {
    align-items: flex-start;
    padding: 8px;
    border-radius: 18px;
  }

  .cbt-play-app__topbar-group {
    overflow-x: auto;
    flex-wrap: nowrap;
    width: 100%;
    padding-bottom: 2px;
  }

  .cbt-play-app__topbar-status {
    width: 100%;
  }

  .cbt-play-app__content-card {
    padding: 12px;
    border-radius: 24px;
  }

  .cbt-play-app--immersive .cbt-play-app__stack,
  .cbt-play-app__tab-card > .cbt-play-app__card-scroll > .cbt-play-app__stack {
    gap: 10px;
  }

  .cbt-play-app__hero,
  .cbt-play-app__panel,
  .cbt-play-app__workspace,
  .cbt-play-app__sheet,
  .cbt-play-app__question,
  .cbt-play-app__history-card,
  .cbt-play-app__wrong-card {
    border-radius: 24px;
  }

  .cbt-play-app__hero {
    padding: 18px;
  }

  .cbt-play-app__workspace,
  .cbt-play-app__panel {
    padding: 16px;
  }

  .cbt-play-app--immersive .cbt-play-app__workspace {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    padding: 12px;
    border-radius: 28px;
  }

  .cbt-play-app--immersive .cbt-play-app__workspace-body,
  .cbt-play-app--immersive .cbt-play-app__workspace-body > .cbt-play-app__stack {
    display: flex;
    flex: 1;
    min-height: 0;
  }

  .cbt-play-app--immersive .cbt-play-app__workspace-body > .cbt-play-app__stack {
    flex-direction: column;
    gap: 10px;
  }

  .cbt-play-app--immersive .cbt-play-app__solver-scroll {
    padding-bottom: 12px;
  }

  .cbt-play-app__sheet,
  .cbt-play-app__question,
  .cbt-play-app__history-card,
  .cbt-play-app__wrong-card {
    padding: 14px 0;
    border-radius: 0;
  }

  .cbt-play-app__question-body {
    font-size: 18px;
  }

  .cbt-play-app--immersive .cbt-play-app__panel {
    flex: 0 0 auto;
    padding: 12px 14px;
    border-radius: 22px;
  }

  .cbt-play-app--immersive .cbt-play-app__question {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(74, 105, 143, 0.1);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.99);
    position: relative;
    z-index: 1;
  }

  .cbt-play-app--immersive .cbt-play-app__question-head {
    gap: 8px;
  }

  .cbt-play-app--immersive .cbt-play-app__meta-strip {
    display: none;
  }

  .cbt-play-app--immersive .cbt-play-app__question-body {
    margin-top: 0;
    font-size: 17px;
    line-height: 1.42;
  }

  .cbt-play-app--immersive .cbt-play-app__choice-list {
    gap: 8px;
    margin-top: 12px;
  }

  .cbt-play-app--immersive .cbt-play-app__choice-button {
    min-height: 52px;
    padding: 10px 12px;
    border-radius: 16px;
    font-size: 14px;
    background: rgba(255, 255, 255, 1);
  }

  .cbt-play-app--immersive .cbt-play-app__choice-prefix {
    width: 24px;
  }

  .cbt-play-app--immersive .cbt-play-app__question-feedback {
    margin-top: 0;
    padding: 12px;
    border-radius: 16px;
    background: rgba(245, 249, 255, 1);
  }

  .cbt-play-app--immersive .cbt-play-app__sticky-bar {
    flex: 0 0 auto;
    bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .cbt-play-app--immersive .cbt-play-app__sticky-inner {
    padding: 10px;
    border-radius: 20px;
    gap: 6px;
  }

  .cbt-play-app--immersive .cbt-play-app__sticky-inner .ant-btn {
    min-height: 42px;
  }

  .cbt-play-app__summary-row,
  .cbt-play-app__subject-actions,
  .cbt-play-app__solver-actions {
    align-items: flex-start;
  }

  .cbt-play-app__solver-actions {
    width: 100%;
    justify-content: space-between;
  }

  .cbt-play-app__resume-banner {
    align-items: flex-start;
  }

  .cbt-play-app__resume-banner .ant-btn {
    width: 100%;
  }

  .cbt-play-app__sticky-inner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-bottom: 12px;
  }
}
