@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&display=swap");

:root {
  --purple: #7a4cff;
  --green: #23c37d;
  --navy: #0f1c3f;
  --bg: #f5f6fb;
  --text: #1c2233;
  --muted: #6b7280;
  --danger: #e24040;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.btn {
  border-radius: 12px;
  padding: 0.5rem 1.2rem;
}

.btn-sm {
  border-radius: 12px;
  padding: 0.35rem 0.85rem;
}


.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
}

.btn-icon .icon {
  width: 18px;
  height: 18px;
}


.btn-icon-sm {
  width: 30px;
  height: 30px;
  padding: 0;
}

.btn-icon-sm .icon {
  width: 14px;
  height: 14px;
}

.folder-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.btn-json {
  min-width: 58px;
  padding: 0 10px;
}

.btn-json__text {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.table-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  text-decoration: none;
}

.table-sort:hover {
  text-decoration: underline;
}

.table-sort__icon {
  font-size: 0.7rem;
  color: var(--muted);
}

.folder-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.folder-pill__link {
  padding-right: 28px;
}

.folder-pill__delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  font-size: 12px;
  line-height: 18px;
  padding: 0;
}

.folder-pill__delete:hover {
  background: rgba(0, 0, 0, 0.18);
}
.card {
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(15, 28, 63, 0.08);
}

.app-nav {
  background: linear-gradient(90deg, var(--navy), #152a68);
}

.is-embedded .app-nav {
  display: none;
}

.btn-primary {
  background-color: var(--navy);
  border-color: var(--navy);
}

.btn-accent {
  background-color: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

.btn-success {
  background-color: var(--green);
  border-color: var(--green);
}

.btn-danger {
  background-color: var(--danger);
  border-color: var(--danger);
}

.hero {
  display: flex;
  gap: 2rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.hero-card {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 12px 28px rgba(15, 28, 63, 0.12);
}

.quiz-shell {
  background: #fff;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 16px 34px rgba(15, 28, 63, 0.1);
}

.quiz-body {
  margin-top: 1.5rem;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.answer--correct {
  display: inline-block;
  background: rgba(35, 195, 125, 0.2);
  color: var(--green);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-right: 0.5rem;
}

.answer--wrong {
  display: inline-block;
  background: rgba(226, 64, 64, 0.2);
  color: var(--danger);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

.toast-stack {
  position: fixed;
  right: 1.5rem;
  top: 5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 1050;
}

.toast-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #fff;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  box-shadow: 0 12px 24px rgba(15, 28, 63, 0.12);
  border: 1px solid #e2e8f0;
  min-width: 260px;
}

.toast-item.is-hiding {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-body {
  flex: 1;
}

.toast-close {
  border: none;
  background: transparent;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--muted);
}

.toast-actions {
  display: flex;
  gap: 0.5rem;
}

.toast-success {
  border-color: rgba(35, 195, 125, 0.4);
}

.toast-danger {
  border-color: rgba(226, 64, 64, 0.4);
}

.toast-warning {
  border-color: rgba(249, 115, 22, 0.4);
}

.snippet-box {
  background: #0f172a;
  color: #f8fafc;
  padding: 1rem;
  border-radius: 12px;
  overflow-x: auto;
}

.quiz-placeholder {
  background: #f3f4f6;
  border-radius: 12px;
  padding: 1rem;
  color: var(--muted);
}

.sequence-cards,
.sequence-slots {
  display: grid;
  gap: 0.75rem;
}

.sequence-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  cursor: grab;
  user-select: none;
  touch-action: none;
  box-shadow: 0 6px 14px rgba(15, 28, 63, 0.08);
}

.sequence-card.is-dragging {
  cursor: grabbing;
  box-shadow: 0 12px 24px rgba(15, 28, 63, 0.18);
}

.sequence-card.is-correct {
  border-color: var(--green);
  background: rgba(35, 195, 125, 0.15);
}

.sequence-card.is-wrong {
  border-color: var(--danger);
  background: rgba(226, 64, 64, 0.15);
}

.sequence-slot {
  min-height: 64px;
  border: 2px dashed #cbd5f5;
  border-radius: 12px;
  padding: 0.5rem;
  background: rgba(122, 76, 255, 0.05);
}

.sequence-slot.is-hover {
  border-color: var(--purple);
  background: rgba(122, 76, 255, 0.12);
}

.sequence-card.is-snapped {
  border-color: var(--purple);
}

.fill-text__hint {
  background: #f8fafc;
  border-left: 4px solid var(--purple);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  color: var(--text);
  margin-bottom: 1rem;
}

.fill-text {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
}

.fill-text__input {
  display: inline-block;
  min-width: 120px;
  max-width: 240px;
  border: 2px solid #cbd5f5;
  border-radius: 10px;
  padding: 0.15rem 0.5rem;
  margin: 0 0.2rem;
  background: #fff;
}

.fill-text__input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 2px rgba(122, 76, 255, 0.15);
  outline: none;
}

.label-editor {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #0b1225;
  min-height: 240px;
}

.label-editor__image {
  width: 100%;
  display: block;
}

.label-editor__overlay {
  position: absolute;
  inset: 0;
}

.label-field {
  position: absolute;
  border: 2px solid var(--purple);
  border-radius: 8px;
  background: rgba(122, 76, 255, 0.12);
  cursor: move;
  user-select: none;
}

.label-field.is-dragging {
  box-shadow: 0 10px 20px rgba(15, 28, 63, 0.25);
}

.label-field__tag {
  position: absolute;
  top: -10px;
  left: 6px;
  font-size: 0.75rem;
  background: var(--navy);
  color: #fff;
  padding: 2px 6px;
  border-radius: 999px;
}

.label-field__handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 2px solid var(--purple);
  border-radius: 50%;
}

.label-field__handle[data-handle="nw"] {
  top: -6px;
  left: -6px;
  cursor: nwse-resize;
}

.label-field__handle[data-handle="ne"] {
  top: -6px;
  right: -6px;
  cursor: nesw-resize;
}

.label-field__handle[data-handle="sw"] {
  bottom: -6px;
  left: -6px;
  cursor: nesw-resize;
}

.label-field__handle[data-handle="se"] {
  bottom: -6px;
  right: -6px;
  cursor: nwse-resize;
}

.label-player {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #0b1225;
}

.label-player__image {
  width: 100%;
  display: block;
}

.label-player__overlay {
  position: absolute;
  inset: 0;
}

.label-player__input {
  position: absolute;
  border: 2px solid #cbd5f5;
  border-radius: 8px;
  padding: 0.25rem 0.5rem;
  background: rgba(255, 255, 255, 0.9);
}

.label-player__input.is-correct {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(35, 195, 125, 0.2);
}

.label-player__input.is-wrong {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(226, 64, 64, 0.2);
}

.match-canvas {
  position: relative;
  height: 520px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.match-card {
  position: absolute;
  min-width: 140px;
  max-width: 240px;
  background: #fff;
  border-radius: 12px;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  cursor: grab;
  user-select: none;
  touch-action: none;
  box-shadow: 0 6px 14px rgba(15, 28, 63, 0.1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.match-card img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 8px;
  pointer-events: none;
}

.match-card--image-only {
  justify-content: center;
  padding: 0.9rem;
}

.match-card--image-only img {
  width: 110px;
  height: 110px;
  border-radius: 12px;
}

.match-card.is-dragging {
  cursor: grabbing;
  box-shadow: 0 12px 24px rgba(15, 28, 63, 0.2);
}

.match-card.is-snapped {
  border-color: var(--purple);
}

.match-group {
  position: absolute;
  border: 2px dashed #94a3b8;
  border-radius: 14px;
  padding: 6px;
  pointer-events: none;
}

.match-group__button {
  pointer-events: auto;
  position: absolute;
  top: -14px;
  right: -10px;
  background: var(--navy);
  border-color: var(--navy);
}

.match-group.is-correct {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(35, 195, 125, 0.15);
}

.match-group.is-wrong {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(226, 64, 64, 0.15);
}

.pair-image-preview {
  display: block;
  margin-top: 0.5rem;
  max-width: 100px;
  max-height: 100px;
  border-radius: 10px;
  object-fit: cover;
}

.question-image-preview {
  display: block;
  margin-top: 0.5rem;
  max-width: 240px;
  max-height: 160px;
  border-radius: 10px;
  object-fit: cover;
}

.millionaire-board {
  background: radial-gradient(circle at top, #1b2f66 0%, #0f1c3f 60%, #0b1430 100%);
  border-radius: 18px;
  padding: 1.5rem;
  color: #f8fafc;
  box-shadow: 0 18px 36px rgba(15, 28, 63, 0.2);
}

.millionaire-question {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  text-align: center;
}

.millionaire-question__meta {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0.5rem;
}

.millionaire-question__text {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.millionaire-question__image {
  max-width: min(520px, 100%);
  border-radius: 12px;
  margin: 0 auto 0.75rem;
  display: block;
}

.millionaire-question__amount {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
}

.millionaire-question__timer {
  margin-top: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #facc15;
}

.millionaire-answers {
  gap: 0.75rem;
}

.millionaire-answer {
  background: rgba(15, 28, 63, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  border-radius: 999px;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.millionaire-answer:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.5);
}

.millionaire-answer__label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(122, 76, 255, 0.2);
  color: #f8fafc;
  font-size: 0.85rem;
}

.millionaire-answer__text {
  flex: 1;
  text-align: left;
}

.millionaire-answer.is-correct {
  background: rgba(35, 195, 125, 0.2);
  border-color: rgba(35, 195, 125, 0.8);
}

.millionaire-answer.is-wrong {
  background: rgba(226, 64, 64, 0.2);
  border-color: rgba(226, 64, 64, 0.8);
}

.millionaire-answer.is-disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.quiz-start-popup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 28, 63, 0.45);
  z-index: 1060;
  padding: 1.5rem;
}

.quiz-start-popup__card {
  width: min(480px, 92vw);
  background: #fff;
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: 0 18px 36px rgba(15, 28, 63, 0.18);
  text-align: center;
}

.quiz-result-popup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 28, 63, 0.45);
  z-index: 1060;
  padding: 1.5rem;
}

.quiz-result-popup__card {
  width: min(420px, 92vw);
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 18px 36px rgba(15, 28, 63, 0.18);
  text-align: center;
}

@media (max-width: 768px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }
}

.user-password {
  min-width: 180px;
}

.analytics-chart {
  width: 100%;
  height: 180px;
  background: linear-gradient(180deg, rgba(15, 28, 63, 0.06), rgba(15, 28, 63, 0));
  border-radius: 12px;
  padding: 12px;
}

.analytics-chart svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line--views {
  stroke: #5f6fff;
}

.chart-line--starts {
  stroke: #1bbf83;
}

.chart-line--finishes {
  stroke: #f4a63b;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
}

.legend-item::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.legend-views::before {
  background: #5f6fff;
}

.legend-starts::before {
  background: #1bbf83;
}

.legend-finishes::before {
  background: #f4a63b;
}

.distribution-list {
  display: grid;
  gap: 10px;
}

.distribution-row {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.distribution-bar {
  position: relative;
  height: 10px;
  background: rgba(15, 28, 63, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.distribution-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, #5f6fff, #8b5cf6);
  border-radius: inherit;
}

.sort-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.sort-link:hover {
  color: #1b4dff;
}

.sort-arrows {
  display: inline-flex;
  flex-direction: column;
  font-size: 0.55rem;
  line-height: 0.6rem;
  color: rgba(0, 0, 0, 0.35);
}

.sort-arrow.is-active {
  color: #1b4dff;
}
