body {
  background: #222;
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, Arial, sans-serif;
  padding: 0px 24px;
  font-size: 1.05rem;
  background: #2c2447;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
  height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-header {
  color: #fff;
  font-size: 4rem;
  font-weight: bold;
  text-align: center;
  margin: 5px 0 0 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

#main-ui {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-copyright {
  color: #fff;
  font-size: 0.95rem;
  text-align: center;
  opacity: 0.8;
  margin: 5px auto 10px auto;
  padding: 5px 15px;
  border-radius: 5px;
  background: rgba(44, 36, 71, 0.9);
  width: fit-content;
  flex-shrink: 0;
}

.centered-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 2px;
  padding-bottom: 10px;
  box-sizing: border-box;
  overflow-y: auto;
  min-height: 0;
}

/* Start screen layout with side-by-side panels */
.start-screen-content {
  display: flex;
  gap: 40px;
  align-items: stretch;
  justify-content: center;
}

.quiz-panel {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 0 20px rgba(135, 206, 250, 0.6), 0 0 8px #8888;
  margin-top:20px;
  padding: 16px 32px 16px 32px;
  min-width: 340px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.quiz-title {
  font-size: 1.7rem;
  color: #b00;
  margin-bottom: 8px;
  font-weight: bold;
  text-align: center;
  letter-spacing: 1px;
}

.quiz-form {
  color:#777;
  background: #f8f8f8;
  border-radius: 18px;
  padding: 8px 12px 18px 0px;
  box-shadow: 0 0 6px #bbb8;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.quiz-form label {

  color: #666;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  cursor: pointer;
}

.quiz-form input[type="checkbox"] {
  margin-left:12px;
  margin-top:3px;
  margin-right: 18px;
  transform: scale(1.1);
  accent-color: #b00;
}

.quiz-form input[type="number"] {
  width: 38px;
  font-size: 1rem;
  margin-left: 6px;
  padding: 2px 3px;
  border-radius: 4px;
  border: 1px solid #bbb;
  text-align: center;
  transition: all 0.3s ease;
}

.quiz-form input[type="number"]:focus {
  outline: 2px solid #007bff;
  outline-offset: 1px;
  border-color: #007bff;
}

.button-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  justify-content: center;
  align-items: center;
}

.start-btn {
  background: #007bff;
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.start-btn:hover:not(:disabled) {
  background: #0056b3;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.start-btn:disabled {
  background: #ccc;
  color: #888;
  cursor: not-allowed;
}

/* Coefficient slider styles */
.coefficient-slider-container {
  display: flex;
  justify-content: center;
  margin: 6px 0;
}

.coefficient-slider-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.coefficient-label {
  font-size: 0.85rem;
  color: #666;
  font-weight: 500;
  min-width: 70px;
}

.coefficient-slider {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.coefficient-slider input {
  opacity: 0;
  width: 0;
  height: 0;
}

.coefficient-slider-track {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #007bff;
  transition: 0.3s;
  border-radius: 24px;
}

.coefficient-slider-track:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .coefficient-slider-track {
  background-color: #007bff;
}

input:checked + .coefficient-slider-track:before {
  transform: translateX(26px);
}

/* Promotion panel styles */
.promo-panel {
  background: #333; /*#2c2447;*/
  border-radius: 18px;
  box-shadow: 0 0 8px #8888;
  margin-top:20px;
  padding: 24px 32px 0px 32px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: space-between;
}

.promo-text {
  color: #fff;
  font-size: 1.2rem;
  font-weight: bold;
  margin: 0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.promo-text-small {
  color: #fff;
  font-size: 1rem;
  margin: 2px 0 2px 0;
  opacity: 0.7;
}

.donate-btn {
  background: #D4AF37;
  color: #000;
  border: none;
  padding: 12px 30px;
  margin:10px auto 50px auto;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.copy-link-btn {
  padding:0;
  margin:0;
  height:30px;
  width:30px;
  background: transparent;
  color: white;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.donate-btn:hover {
  background: #B8860B;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.copy-link-btn:hover {
  background: #218838;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#copy-link-icon {
  height:30px;
  width:30px;
  border-radius: 4px;
}

.website-link {
  display: inline-block;
  transition: transform 0.2s;
}

.website-link:hover {
  transform: scale(1.05);
}

.website-logo {
  height: 60px;
  width: auto;
  margin:4px auto 40px auto;
  border-radius: 8px;
}

/* Flashcard Screen Styles */
/* New 3-column flashcard layout */
.flashcard-layout {
  display: flex;
  width: 100%;
  max-width: 1000px;
  align-items: flex-start;
  gap: 20px;
}

.flashcard-left {
  width: 15%;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  padding-top: 10px;
}

.flashcard-center {
  padding-top:20px;
  width: 70%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.flashcard-right {
  width: 15%;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding-top: 10px;
}

.flashcard {
  background: #fefdfb;
  border-radius: 12px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid #333;
  box-shadow: 0 0 20px rgba(135, 206, 250, 0.6), 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  width: 100%;
  max-width: 320px;
}

.timer-display {
  font-size: 2rem;
  font-weight: bold;
  color: #007bff;
  background: #f0f8ff;
  padding: 8px 16px;
  border-radius: 8px;
  border: 2px solid #007bff;
  min-width: 60px;
  text-align: center;
}

.timer-display.warning {
  color: #ff6b6b;
  border-color: #ff6b6b;
  background: #ffe0e0;
}

.quit-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.quit-btn:hover {
  background: #c82333;
}

.math-problem {
  text-align: right;
  margin-bottom: 15px;
  width: 100%;
  max-width: 250px;
}

.operand {
  font-size: 4rem;
  font-weight: bold;
  color: #333;
  margin: 2px 0;
  font-family: 'Courier New', monospace;
  text-align: right;
}

.operation-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin: 2px 0;
}

.operation {
  font-size: 4rem;
  font-weight: bold;
  color: #333;
  margin-right: 12px;
  font-family: 'Courier New', monospace;
}

.problem-line {
  width: 250px;
  height: 4px;
  background: #333;
  margin: 8px auto;
}

.answer-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

#answer-input {
  font-size: 2rem;
  padding: 12px;
  border: 2px solid #ccc;
  border-radius: 8px;
  text-align: center;
  width: 200px;
  font-family: 'Courier New', monospace;
}

#answer-input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 8px rgba(0, 123, 255, 0.3);
}

.check-btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.check-btn:hover {
  background: #218838;
}

.check-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.feedback {
  position: absolute;
  top: 4px;
  left: -20px;
  z-index: 10;
}

.feedback img {
  width: 240px;
  height: 240px;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  box-sizing: border-box;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 32px;
  min-width: 400px;
  max-width: 90vw;
  max-height: 90vh;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  overflow-y: auto;
  box-sizing: border-box;
}

.modal-header {
  font-size: 2rem;
  font-weight: bold;
  color: #333;
  margin-bottom: 24px;
}

.settings-display {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 16px;
  margin: 0 0 20px 0;
  font-size: 0.95rem;
  color: #495057;
}

.settings-display h4 {
  margin: 0 0 10px 0;
  font-size: 1.1rem;
  color: #333;
  font-weight: 600;
}

.settings-display .setting-line {
  margin: 4px 0;
  line-height: 1.4;
}

.score-display {
  margin: 24px 0;
}

.score-line {
  font-size: 1.4rem;
  color: #333;
  margin: 8px 0;
  font-weight: 500;
}

.modal-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 24px;
}

.modal-btn {
  background: #007bff;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  min-width: 120px;
}

.modal-btn:hover {
  background: #0056b3;
}

.modal-btn:last-child {
  background: #dc3545;
}

.modal-btn:last-child:hover {
  background: #c82333;
}

/* Fix for medium screen width overflow - switch to column layout earlier */
@media (max-width: 925px) {
  .start-screen-content {
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 0 10px;
  }
  
  .quiz-panel {
    min-width: 340px;
    max-width: 500px;
    width: 100%;
  }
  

}

/* Responsive design for smaller screens */
@media (max-width: 800px) {
  body {
    padding: 0px 8px;
  }
  
  .page-header {
    margin: 1px 0;
  }
  
  .page-copyright {
    font-size: 0.7rem;
    margin: 2px auto 3px auto;
    padding: 2px 8px;
  }
  
  .centered-container {
    padding-top: 5px;
    padding-bottom: 5px;
  }
  
  .start-screen-content {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
  
  .quiz-panel {
    min-width: 280px;
    padding: 8px 16px;
  }
  
  .quiz-title {
    font-size: 1.2rem;
    margin-bottom: 4px;
  }
  
  .quiz-form {
    padding: 4px 8px 8px 0px;
  }
  
  .quiz-form label {
    font-size: 0.8rem;
  }
  
  .quiz-form input[type="number"] {
    font-size: 0.8rem;
    padding: 2px 4px;
  }
  
  .coefficient-slider-container {
    margin-bottom: 6px !important;
  }
  
  .coefficient-label {
    font-size: 0.75rem !important;
  }
  
  .promo-panel {
    min-width: 200px;
  }
  
  .promo-text {
    font-size: 0.9rem;
    margin: 4px 0;
  }
  
  .promo-text-small {
    font-size: 0.75rem;
    margin: 2px 0;
  }
  
  .donate-btn, .copy-link-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  
  .website-logo {
    height: 24px;
  }
  
  .start-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
  }
  
  .flashcard-panel {
    min-width: 90%;
    padding: 8px;
  }
  
  .flashcard {
    min-width: 90%;
    padding: 8px;
  }
  
  .operand, .operation {
    font-size: 3.2rem;
  }
  
  #answer-input {
    font-size: 1.6rem;
    width: 150px;
    padding: 4px;
  }
  
  .check-btn {
    font-size: 0.9rem;
    padding: 6px 12px;
  }
  
  .modal-content {
    min-width: 260px;
    padding: 16px;
    margin: 8px;
  }
  
  .modal-header {
    font-size: 1.4rem;
    margin-bottom: 12px;
  }
  
  .settings-display {
    padding: 8px;
    margin: 0 0 10px 0;
    font-size: 0.85rem;
  }
  
  .score-line {
    font-size: 1.1rem;
    margin: 4px 0;
  }
  
  .modal-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
  }
}

@media (max-height: 700px) {
  .page-header {
    margin: 1px 0;
  }
  
  .page-copyright {
    font-size: 0.7rem;
    margin: 1px auto 2px auto;
    padding: 1px 6px;
  }
  
  .centered-container {
    padding-top: 3px;
    padding-bottom: 3px;
  }
  
  .start-screen-content {
    gap: 6px;
  }
  
  .quiz-panel {
    padding: 6px 12px;
  }
  
  .quiz-title {
    font-size: 1.1rem;
    margin-bottom: 3px;
  }
  
  .quiz-form {
    padding: 3px 6px 6px 0px;
  }
  
  
  .promo-text {
    font-size: 0.8rem;
    margin: 3px 0;
  }
  
  .promo-text-small {
    font-size: 0.7rem;
    margin: 1px 0;
  }
}

@media (max-height: 600px) {
  .page-header {
    font-size: 2.4rem;
    margin: 0;
  }
  
  .page-copyright {
    font-size: 0.7rem;
    margin: 1px auto;
    padding: 1px 4px;
  }
  
  .centered-container {
    padding-top: 2px;
    padding-bottom: 2px;
  }
  
  .start-screen-content {
    gap: 4px;
  }
  
  .quiz-panel {
    padding: 4px 8px;
  }
  
  .quiz-title {
    font-size: 1rem;
    margin-bottom: 2px;
  }
  
  .quiz-form {
    padding: 2px 4px 4px 0px;
  }

  
  .coefficient-slider-container {
    margin-bottom: 4px !important;
  }
  
  .operand, .operation {
    font-size: 3rem;
  }
}

@media (max-width: 480px) {
  body {
    padding: 0px 4px;
  }
  
  .page-header {
    font-size: 1.4rem;
    margin: 0;
  }
  
  .quiz-panel {
    min-width: 260px;
    padding: 6px 10px;
  }
  
  .quiz-form {
    padding: 2px 4px 4px 0px;
  }
  
  .quiz-title {
    font-size: 0.95rem;
    margin-bottom: 2px;
  }
  

  
  .promo-text {
    font-size: 0.75rem;
    margin: 2px 0;
  }
  
  .promo-text-small {
    font-size: 0.65rem;
    margin: 1px 0;
  }
  
  .start-screen-content {
    gap: 3px;
  }
  
  .donate-btn, .copy-link-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
  }
  
  .website-logo {
    height: 20px;
  }
  
  .start-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  
  .coefficient-slider-container {
    margin-bottom: 3px !important;
  }
  
  .coefficient-label {
    font-size: 0.7rem !important;
  }
  
  .quiz-form label {
    font-size: 0.75rem;
  }
}
