body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  padding: 20px;
  box-sizing: border-box;
  background-color: #FDFBF7;
  font-family: Arial, Helvetica, sans-serif;
}

.screen {
  position: relative;
  width: 100%;
  max-width: 500px;
  text-align: center;
  padding: 20px;
  box-sizing: border-box;
}

.app-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

.app-logo img {
  width: 64px;
  height: 64px;
}

.intro-overlay {
  position: fixed;
  inset: 0;
  background-color: #FDFBF7;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  z-index: 1000;
  transition: opacity 0.6s ease;
  cursor: pointer;
}

.intro-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.intro-video-frame {
  width: min(86vw, 460px);
  aspect-ratio: 1 / 1;
  background: #ffffff;
  border: 3px solid #2D2D2D;
  border-radius: 4px 26px 4px 26px;
  padding: 10px;
  box-shadow: 8px 8px 0 rgba(45, 45, 45, 0.18);
  transform: rotate(-1.2deg);
  box-sizing: border-box;
}

.intro-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px 20px 2px 20px;
  display: block;
}

.draft-card {
  display: none;
  width: 200px;
  flex-shrink: 0;
  background-color: #FFF9C4;
  border: none;
  border-radius: 2px 14px 2px 14px;
  padding: 16px;
  box-shadow: 4px 4px 0 rgba(45, 45, 45, 0.15);
  text-align: left;
  transform: rotate(-2deg);
}

.draft-title {
  font-size: 20px;
  font-weight: bold;
  color: #7a6a1a;
  margin-bottom: 10px;
}

.draft-text {
  font-size: 17px;
  line-height: 1.4;
  color: #4a4a3a;
}

.back-btn {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 10;
  font-size: 18px;
  padding: 6px 14px;
  cursor: pointer;
  background: #ffffff;
  color: #2D5DA1;
  border: 2px solid #2D5DA1;
  border-radius: 14px 4px 14px 4px;
  box-shadow: 3px 3px 0 rgba(45, 93, 161, 0.25);
}

.trophy-counter {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
}

.trophy-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.trophy-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.trophy-icon svg {
  display: block;
}

.trophy-icon.trophy-big svg {
  width: 60px;
  height: 72px;
}

.trophy-icon.trophy-small svg {
  width: 46px;
  height: 55px;
}

.trophy-icon.trophy-pop {
  animation: trophyPop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.trophy-count {
  font-size: 22px;
  font-weight: bold;
  color: #2D5DA1;
}

.top {
  font-size: 44px;
  font-weight: bold;
  color: #2D2D2D;
  background-color: #ffffff;
  border: 2px solid #2D2D2D;
  border-radius: 4px 20px 4px 20px;
  padding: 20px;
  margin: 40px 0 30px;
  box-shadow: 5px 5px 0 rgba(45, 45, 45, 0.15);
  transform: rotate(-0.6deg);
}

.column-btn .column-line {
  border-top-color: #ffffff;
}

.top.top-word {
  font-size: 23px;
  font-weight: normal;
  line-height: 1.4;
  text-align: left;
}

.top.top-column {
  font-size: 44px;
  font-weight: bold;
  line-height: 1.2;
  text-align: center;
}

.status {
  display: inline-block;
  margin-left: 16px;
}

.status.correct {
  color: #3F7D3F;
}

.status.solved {
  display: block;
  text-align: center;
  margin-left: 0;
  margin-top: 12px;
  font-weight: bold;
}

.status.incorrect {
  color: #D63B3B;
}

.page-indicator {
  display: none;
  font-size: 15px;
  color: #7a756a;
  margin: -18px 0 22px;
}

.bottom {
  font-size: 27px;
  font-weight: normal;
  color: #2D2D2D;
}

.bottom p {
  margin: 0 0 20px;
  line-height: 1.4;
}

.sum-field {
  margin-bottom: 16px;
}

.answer-table {
  border-collapse: collapse;
  margin: 0 auto 20px;
  table-layout: fixed;
  width: 100%;
  max-width: 480px;
}

.answer-table th,
.answer-table td {
  border: 1px solid #2D2D2D;
  padding: 3px;
  font-size: 15px;
  text-align: center;
}

.answer-table th:first-child,
.answer-table td:first-child {
  width: 44px;
}

.answer-table th {
  background: #FFF9C4;
}

.bottom .answer-table input {
  width: 100%;
  max-width: 44px;
  font-size: 15px;
  text-align: center;
  padding: 2px 1px;
  margin-right: 0;
  border: 1px solid #2D5DA1;
  border-radius: 4px;
  box-sizing: border-box;
}

.bottom .answer-table input.cell-correct {
  border: 2px solid #3F7D3F;
  background: #EAF5EA;
  color: #3F7D3F;
  font-weight: bold;
}

.bottom .answer-table input.cell-wrong {
  border: 2px solid #D63B3B;
}

.bottom .answer-table input:disabled:not(.cell-correct) {
  background: #eee;
  border-color: #ccc;
}

.column-expr {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
}

.column-row {
  position: relative;
  padding: 2px 6px;
}

.column-op {
  position: absolute;
  left: -6px;
  transform: translateX(-100%);
}

.column-line {
  border-top: 4px solid #2D2D2D;
  width: 100%;
  margin-top: 4px;
}

.bottom p.has-badge {
  line-height: 2.3;
  padding-top: 16px;
}

.number-badge {
  position: relative;
  display: inline-block;
  margin: 0 4px;
}

.number-badge-label {
  position: absolute;
  left: 50%;
  top: -14px;
  transform: translateX(-50%);
  font-size: 18px;
  font-weight: bold;
  color: #3F7D3F;
  white-space: nowrap;
}

.bottom input {
  font-size: 26px;
  width: 100px;
  text-align: center;
  padding: 8px;
  margin-right: 10px;
  background: #ffffff;
  border: 2px solid #2D2D2D;
  border-radius: 4px 12px 4px 12px;
}

.bottom input[type="number"]::-webkit-outer-spin-button,
.bottom input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.bottom input[type="number"] {
  -moz-appearance: textfield;
}

.bottom button {
  font-size: 26px;
  padding: 12px 28px;
  margin: 6px;
  cursor: pointer;
  background-color: #2D5DA1;
  color: #ffffff;
  border: none;
  border-radius: 14px 4px 14px 4px;
  box-shadow: 4px 4px 0 rgba(45, 45, 45, 0.2);
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

.bottom button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(45, 45, 45, 0.2);
}

.bottom button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(45, 45, 45, 0.2);
}

.bottom button.dz-selected {
  background-color: #3F7D3F;
}

.theme-text {
  font-size: 19px;
  text-align: left;
}

.theme-text p {
  margin: 0 0 10px;
  line-height: 1.35;
}

.theme-text .theme-label {
  font-weight: bold;
  color: #2D5DA1;
  margin-bottom: 4px;
}

.topic-card {
  border: 2px solid #2D5DA1;
  border-radius: 4px 20px 4px 20px;
  padding: 16px;
  margin-bottom: 16px;
  background-color: #ffffff;
}

.topic-header {
  margin-bottom: 12px;
}

.topic-name {
  font-size: 17px;
  font-weight: bold;
  color: #2D5DA1;
  margin: 0 0 10px;
  line-height: 1.3;
}

.topic-pages {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.topic-pages button {
  margin: 0;
}

.bottom button.dz-secondary {
  background-color: #ffffff;
  color: #2D5DA1;
  border: 2px solid #2D5DA1;
  box-shadow: 3px 3px 0 rgba(45, 93, 161, 0.25);
}

.confetti-piece {
  position: fixed;
  width: 8px;
  height: 14px;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 900;
  opacity: 0;
}

@keyframes confettiFly {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: var(--confetti-end) rotate(var(--confetti-rotate));
  }
}

@keyframes trophyPop {
  0% { transform: scale(1) rotate(0deg); }
  35% { transform: scale(1.5) rotate(-10deg); }
  60% { transform: scale(0.9) rotate(6deg); }
  80% { transform: scale(1.08) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .intro-overlay {
    display: none;
  }

  .trophy-icon.trophy-pop {
    animation: none;
  }

  .confetti-piece {
    display: none;
  }

  .bottom button {
    transition: none;
  }

  .bottom button:hover,
  .bottom button:active {
    transform: none;
  }
}
