* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f3f4f6;
  color: #1f2937;
}

button,
select,
input {
  font: inherit;
}

button, .abutton {
  cursor: pointer;
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  background: #111827;
  color: #ffffff;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

button:hover, .abutton:hover {
  transform: translateY(-1px);
}

.abutton  {display:inline-block;text-decoration:none;}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.secondary-btn {
  background: #e5e7eb;
  color: #111827;
}

.app {
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0;
  font-size: 32px;
}

.subtitle {
  margin: 8px 0 0;
  color: #4b5563;
}

.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
}

.panel {
  min-width: 0;
}

.card {
  background: #ffffff;
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.left-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.label {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 8px;
}

.labelabs {position:absolute;}

.selected-element-box {
  text-align: center;
  padding: 8px 0;
}

.selected-element-symbol {
  font-size: 52px;
  font-weight: 700;
  line-height: 1;
}

.selected-element-name {
  margin-top: 8px;
  font-size: 22px;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.stats-grid.timer-active {
  grid-template-columns: 1fr 1fr 1fr;
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
}

.inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.answer-card input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 22px;
  outline: none;
}

.answer-card input:focus {
  border-color: #6b7280;
  box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.15);
}

.feedback {
  border-radius: 18px;
  padding: 14px 16px;
  line-height: 1.45;
}

.feedback.success {
  background: #d1fae5;
  color: #065f46;
}

.feedback.error {
  background: #fef3c7;
  color: #92400e;
}

.hidden {
  display: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.teacher-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.teacher-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.teacher-actions select {
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 10px 12px;
  background: #ffffff;
}

#timerEnabled {
  width: 18px;
  height: 18px;
}

.table-card h2 {
  margin: 0;
  font-size: 28px;
}

.table-subtitle {
  margin: 8px 0 18px;
  color: #6b7280;
}

.table-wrapper {
  overflow-x: auto;
}

.periodic-table {
  display: grid;
  grid-template-columns: 80px 80px repeat(10, 2px) repeat(6, 80px);
  gap: 8px;
  align-items: stretch;
}

.placeholder {
  width: 100%;
  height: 100%;
}

.element-cell {
  height: 80px;
  border-radius: 15px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  padding: 10px;
  display: flex;
  flex-direction: column;
  text-align: left;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.element-cell.active {
  background: #dbeafe;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.element-cell.revealed {
  background: #d1fae5;
  border-color: #10b981;
}

.element-z {
  font-size: 14px;
  color: #6b7280;
}

.element-symbol {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  color: #000;
  text-align: center;
}

.element-name {
  margin-top: 4px;
  font-size: 8px;
  color: #4b5563;
  text-align: center;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: min(460px, 100%);
  background: #ffffff;
  border-radius: 24px;
  padding: 28px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 12px;
}

.final-message {
  margin: 12px 0 20px;
  font-size: 18px;
  font-weight: 700;
}

@media (max-width: 1240px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    display: flex;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .app {
    padding: 12px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .selected-element-symbol {
    font-size: 42px;
  }

  .selected-element-name {
    font-size: 20px;
  }

  .stat-value {
    font-size: 24px;
  }

  .answer-card input {
    font-size: 18px;
  }

  .inputs-grid,
  .stats-grid,
  .stats-grid.timer-active {
    grid-template-columns: 1fr;
  }
}
