* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, sans-serif;
  overflow-x: hidden;
  position: relative;
  background: var(--sky-gradient, linear-gradient(to bottom, #87ceeb, #f0f8ff));
  transition: background 1s linear;
  width: 100%;
}

/* ---- General Section Layout ---- */
section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 10px;
}

/* ---- Table Section ---- */
.table-wrapper {
  width: 100%;
  max-width: 420px;
  overflow-x: auto;
  margin-bottom: 30px;
  padding: 0 5px;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 300px;
  background-color: white;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
  font-size: 12px;
  table-layout: auto;
}

th,
td {
  border: 1px solid #ccc;
  padding: 8px 4px;
  text-align: center;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

td:first-child,
th:first-child {
  text-align: left;
  padding-left: 6px;
  min-width: 120px;
}

td:nth-child(2),
th:nth-child(2) {
  min-width: 50px;
}

td:nth-child(3),
th:nth-child(3) {
  min-width: 80px;
}

th {
  background-color: #1976d2;
  color: white;
  font-weight: bold;
}

tr:nth-child(even) td {
  background-color: #f9f9f9;
}

input[type="text"] {
  width: 100%;
  padding: 5px 3px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 11px;
  box-sizing: border-box;
}

/* ---- Syllabus Section ---- */
h1 {
  text-align: center;
  color: #2b3e50;
  font-size: 1.3rem;
  margin: 10px 5px;
  padding: 0 10px;
  line-height: 1.3;
}

h2 {
  text-align: center;
  color: #2b3e50;
  font-size: 1.1rem;
  margin: 15px 5px 10px;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin-top: 20px;
  position: relative;
  width: 100%;
  padding: 0 10px;
}

.topic {
  position: relative;
  background-color: white;
  border: 2px solid #2196f3;
  border-radius: 12px;
  width: 100%;
  max-width: 350px;
  padding: 15px;
  font-size: 16px;
  color: #333;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: 0.2s;
  cursor: pointer;
  user-select: none;
}

.topic:active {
  background-color: #e3f2fd;
  transform: scale(0.98);
}

/* ---- Subtopic Box ---- */
.subtopics {
  position: relative;
  background-color: #f8f9fa;
  border: 1px solid #ccc;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  padding: 10px;
  width: 100%;
  display: none;
  margin-top: 10px;
}

.subtopics ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

.subtopics li {
  padding: 8px;
  border-bottom: 1px solid #ddd;
  color: #333;
  font-size: 13px;
  text-align: left;
  line-height: 1.5;
}

.subtopics li:last-child {
  border-bottom: none;
}

/* Periodic table styling */
.periodic-table {
  text-align: center;
  margin: 20px 10px;
  width: 100%;
  padding: 0 10px;
}

.periodic-table img {
  max-width: 100%;
  height: auto;
  border: 3px solid #007bff;
  border-radius: 12px;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s, box-shadow 0.3s;
}

.periodic-table img:active {
  transform: scale(1.02);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* Small phones - 320px to 374px */
@media (max-width: 374px) {
  h1 {
    font-size: 1.1rem;
  }

  h2 {
    font-size: 0.95rem;
  }

  table {
    font-size: 10px;
  }

  th,
  td {
    padding: 6px 3px;
  }

  input[type="text"] {
    font-size: 10px;
    padding: 4px 2px;
  }

  .topic {
    font-size: 14px;
    padding: 12px;
  }

  .periodic-table {
    margin: 15px 5px;
  }

  .periodic-table img {
    border-width: 2px;
  }
}

/* Standard phones - 375px to 480px */
@media (min-width: 375px) and (max-width: 480px) {
  h1 {
    font-size: 1.25rem;
  }

  h2 {
    font-size: 1.05rem;
  }

  table {
    font-size: 11px;
  }

  input[type="text"] {
    font-size: 11px;
  }

  .topic {
    font-size: 15px;
  }
}

/* Large phones - 481px to 768px */
@media (min-width: 481px) and (max-width: 768px) {
  section {
    padding: 30px 15px;
  }

  h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  table {
    font-size: 13px;
  }

  th,
  td {
    padding: 9px 6px;
  }

  input[type="text"] {
    font-size: 12px;
    padding: 6px 4px;
  }

  .topic {
    font-size: 18px;
    padding: 18px;
    max-width: 400px;
  }

  .subtopics li {
    font-size: 14px;
  }

  .periodic-table {
    margin: 25px 15px;
  }

  .periodic-table img {
    border-width: 4px;
  }
}

/* Tablets - 769px to 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
  section {
    padding: 40px 20px;
  }

  h1 {
    font-size: 1.9rem;
  }

  h2 {
    font-size: 1.4rem;
  }

  table {
    font-size: 14px;
  }

  th,
  td {
    padding: 10px 8px;
  }

  input[type="text"] {
    font-size: 13px;
    padding: 7px 5px;
  }

  .topic {
    font-size: 19px;
    padding: 19px;
    max-width: 420px;
  }

  .topic:hover {
    background-color: #e3f2fd;
    transform: scale(1.02);
  }

  .subtopics {
    position: absolute;
    top: 0;
    left: 450px;
    width: 280px;
    margin-top: 0;
  }

  .subtopics li {
    font-size: 15px;
  }

  .periodic-table img:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  }
}

/* Desktop - 1025px and above */
@media (min-width: 1025px) {
  section {
    padding: 40px 0;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  table {
    font-size: 15px;
  }

  th,
  td {
    padding: 10px;
  }

  input[type="text"] {
    font-size: 14px;
    padding: 8px;
  }

  .topic {
    font-size: 20px;
    padding: 20px;
    max-width: 350px;
  }

  .topic:hover {
    background-color: #e3f2fd;
    transform: scale(1.03);
  }

  .subtopics {
    position: absolute;
    top: 0;
    left: 385px;
    width: 260px;
    margin-top: 0;
  }

  .subtopics li {
    font-size: 16px;
  }

  .container {
    gap: 20px;
  }

  .periodic-table {
    margin: 30px 0;
  }

  .periodic-table img {
    border-width: 5px;
    border-radius: 15px;
  }

  .periodic-table img:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
  }
}

/* Large desktop - 1440px and above */
@media (min-width: 1440px) {
  h1 {
    font-size: 2.2rem;
  }

  h2 {
    font-size: 1.7rem;
  }

  table {
    font-size: 16px;
  }
}
