* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Theme Variables */
:root {
  --primary: #3b82f6;
  --accent: #10b981;
  --background: #ffffff;
  --surface: #f9fafb;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

html[data-theme="dark"] {
  --background: #0f172a;
  --surface: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --border: #334155;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Improved header with better mobile support */
.header {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background-color: var(--surface);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

@media (min-width: 768px) {
  .header-content {
    padding: 0 2rem;
  }
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.header-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  transition: opacity 0.3s ease;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .header-logo {
    height: 44px;
  }
}

.header-logo:hover {
  opacity: 0.85;
}

.site-title {
  font-size: 1.125rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 640px) {
  .site-title {
    font-size: 1.375rem;
  }
}

.header-nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .header-nav {
    gap: 1rem;
  }
}

.theme-toggle,
.admin-link {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 0.875rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 640px) {
  .theme-toggle,
  .admin-link {
    padding: 0.625rem 1rem;
    font-size: 0.9375rem;
  }
}

.theme-toggle:hover,
.admin-link:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.theme-toggle:active,
.admin-link:active {
  transform: translateY(0);
}

/* Improved main content with responsive padding */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

@media (min-width: 768px) {
  .main-content {
    padding: 2rem 1.5rem;
  }
}

@media (min-width: 1024px) {
  .main-content {
    padding: 2.5rem 2rem;
  }
}

/* Responsive welcome section */
.welcome-section {
  margin-bottom: 2.5rem;
  text-align: center;
  padding: 0 0.5rem;
}

@media (min-width: 768px) {
  .welcome-section {
    margin-bottom: 3rem;
  }
}

.welcome-text h2 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.2;
}

@media (min-width: 640px) {
  .welcome-text h2 {
    font-size: 2.25rem;
  }
}

@media (min-width: 1024px) {
  .welcome-text h2 {
    font-size: 2.75rem;
  }
}

.welcome-text p {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 42rem;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .welcome-text p {
    font-size: 1.125rem;
  }
}

/* Improved responsive grid for tiles */
.tiles-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

@media (min-width: 640px) {
  .tiles-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}

@media (min-width: 1024px) {
  .tiles-container {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
  }
}

.tile {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 1.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.tile-header {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.tile-header i {
  font-size: 1.625rem;
  color: var(--primary);
  flex-shrink: 0;
}

.tile-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
}

.tile-description {
  color: var(--text-secondary);
  flex-grow: 1;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.tile-button {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.tile-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.tile-button:active {
  transform: translateY(0);
}

/* Improved posts section with responsive design */
.posts-section {
  margin-top: 3rem;
  padding-top: 2.5rem;
  border-top: 2px solid var(--border);
}

@media (min-width: 768px) {
  .posts-section {
    margin-top: 4rem;
    padding-top: 3rem;
  }
}

.posts-section-header {
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .posts-section-header {
    margin-bottom: 2rem;
  }
}

.posts-section-header h2 {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .posts-section-header h2 {
    font-size: 1.875rem;
  }
}

.posts-section-header h2 i {
  color: var(--primary);
}

.posts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .posts-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

.post-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.post-card-content {
  padding: 1.25rem;
}

@media (min-width: 768px) {
  .post-card-content {
    padding: 1.5rem;
  }
}

.post-card-title {
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
}

.post-card-preview {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.post-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.post-card-date {
  color: var(--text-secondary);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.post-card-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.post-card-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.post-card-btn:active {
  transform: translateY(0);
}

.no-posts-message {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.no-posts-message i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.no-posts-message.hidden {
  display: none;
}

/* Responsive footer */
.footer {
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 4rem;
}

@media (min-width: 768px) {
  .footer {
    padding: 2rem;
  }
}

/* Responsive admin layout */
.admin-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

@media (min-width: 1024px) {
  .admin-container {
    flex-direction: row;
  }
}

.admin-sidebar {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 1rem;
  overflow-y: auto;
  position: relative;
}

@media (min-width: 1024px) {
  .admin-sidebar {
    border-bottom: none;
    border-right: 1px solid var(--border);
    width: 280px;
    padding: 2rem;
    height: 100vh;
    position: sticky;
    top: 0;
  }
}

.admin-sidebar h2 {
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
  font-weight: 700;
}

@media (min-width: 1024px) {
  .admin-sidebar h2 {
    margin-bottom: 2rem;
  }
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 1024px) {
  .admin-nav {
    margin-bottom: 2rem;
  }
}

.nav-item {
  background: none;
  border: none;
  padding: 0.875rem 1rem;
  border-radius: 0.625rem;
  cursor: pointer;
  text-align: left;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.875rem;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 0.9375rem;
}

.nav-item:hover,
.nav-item.active {
  background-color: var(--primary);
  color: white;
  transform: translateX(4px);
}

.back-link {
  position: static;
  margin-top: 1rem;
  color: var(--primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

@media (min-width: 1024px) {
  .back-link {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    margin-top: 0;
  }
}

.back-link:hover {
  text-decoration: underline;
}

.admin-content {
  flex: 1;
  padding: 1.5rem 1rem;
  overflow-y: auto;
}

@media (min-width: 768px) {
  .admin-content {
    padding: 2rem 1.5rem;
  }
}

@media (min-width: 1024px) {
  .admin-content {
    padding: 2.5rem 2rem;
  }
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Improved form controls with better mobile support */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.625rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9375rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background-color: var(--background);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

/* Lists */
.tiles-list,
.posts-list,
.plugins-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.tile-item,
.post-item,
.plugin-item {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  padding: 1rem;
  transition: all 0.2s ease;
}

.tile-item:hover,
.post-item:hover,
.plugin-item:hover {
  box-shadow: var(--shadow-md);
}

.tile-item-header,
.post-header,
.plugin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.tile-item-header h3,
.post-header h3,
.plugin-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.post-date {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.post-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Improved buttons with better touch targets */
.btn-primary,
.btn-secondary,
.btn-small {
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-secondary {
  background-color: var(--text-secondary);
  color: white;
}

.btn-small {
  background-color: var(--accent);
  color: white;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  min-height: 36px;
}

.btn-danger {
  background-color: #ef4444;
  color: white;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-small:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active,
.btn-secondary:active,
.btn-small:active {
  transform: translateY(0);
}

/* Responsive modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content {
  background-color: var(--background);
  padding: 1.5rem;
  border-radius: 1rem;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

@media (min-width: 768px) {
  .modal-content {
    padding: 2rem;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.modal-header h2 {
  font-size: 1.375rem;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.25rem;
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.close-btn:hover {
  color: var(--text-primary);
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

/* Responsive plugin layout */
.plugin-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.plugin-header {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}

.plugin-header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  .plugin-header-content {
    padding: 0 2rem;
    flex-wrap: nowrap;
  }
}

.back-button {
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  font-weight: 500;
}

.back-button:hover {
  background-color: var(--primary);
  color: white;
}

.plugin-header h1 {
  flex-grow: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
}

@media (min-width: 768px) {
  .plugin-header h1 {
    font-size: 1.5rem;
  }
}

.plugin-title-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.plugin-title-section .header-logo,
.plugin-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .plugin-title-section .header-logo,
  .plugin-logo {
    height: 40px;
  }
}

.plugin-title-section h1 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.125rem;
  min-width: 0;
}

@media (min-width: 768px) {
  .plugin-title-section h1 {
    font-size: 1.375rem;
  }
}

/* Responsive periodic table controls */
.periodic-main-content {
  max-width: 100%;
  padding: 1rem;
}

.periodic-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 0 0.5rem;
}

@media (min-width: 768px) {
  .periodic-controls {
    padding: 0 1rem;
  }
}

.periodic-controls .search-box {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}

.periodic-controls .search-box input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background-color: var(--surface);
  color: var(--text-primary);
  font-size: 1rem;
}

.view-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.view-tab {
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  border-radius: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  font-weight: 500;
}

@media (min-width: 640px) {
  .view-tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
  }
}

.view-tab:hover,
.view-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.view-content {
  display: none;
}

.view-content.active {
  display: block;
}

/* Responsive legend */
.legend-container {
  padding: 1rem;
  margin-bottom: 1rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

@media (min-width: 768px) {
  .legend {
    gap: 1rem;
  }
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
}

@media (min-width: 640px) {
  .legend-item {
    font-size: 0.875rem;
  }
}

.legend-color {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .legend-color {
    width: 20px;
    height: 20px;
  }
}

/* Category Colors */
.legend-color.alkali-metal,
.alkali-metal {
  background-color: #ff6b6b;
}
.legend-color.alkaline-earth,
.alkaline-earth {
  background-color: #feca57;
}
.legend-color.transition-metal,
.transition-metal {
  background-color: #ff9ff3;
}
.legend-color.post-transition,
.post-transition {
  background-color: #54a0ff;
}
.legend-color.metalloid,
.metalloid {
  background-color: #5f27cd;
  color: white;
}
.legend-color.nonmetal,
.nonmetal {
  background-color: #1dd1a1;
}
.legend-color.halogen,
.halogen {
  background-color: #48dbfb;
}
.legend-color.noble-gas,
.noble-gas {
  background-color: #c8d6e5;
}
.legend-color.lanthanide,
.lanthanide {
  background-color: #ff7675;
}
.legend-color.actinide,
.actinide {
  background-color: #a29bfe;
}

/* Responsive periodic table */
.periodic-table-wrapper {
  overflow-x: auto;
  padding: 1rem 0.5rem;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
  .periodic-table-wrapper {
    padding: 1rem;
  }
}

.periodic-table-classic {
  display: grid;
  grid-template-columns: repeat(18, minmax(50px, 1fr));
  grid-template-rows: repeat(10, auto);
  gap: 2px;
  min-width: 900px;
}

@media (min-width: 768px) {
  .periodic-table-classic {
    grid-template-columns: repeat(18, minmax(55px, 1fr));
    gap: 3px;
    min-width: 1000px;
  }
}

@media (min-width: 1280px) {
  .periodic-table-classic {
    grid-template-columns: repeat(18, minmax(60px, 1fr));
    gap: 4px;
    min-width: 1100px;
  }
}

.element-tile {
  padding: 0.375rem;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
  border: 1px solid rgba(0, 0, 0, 0.1);
  min-height: 60px;
}

@media (min-width: 768px) {
  .element-tile {
    padding: 0.4rem;
    min-height: 65px;
  }
}

.element-tile:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
  z-index: 10;
}

.element-number {
  font-size: 0.625rem;
  opacity: 0.8;
}

.element-symbol {
  font-weight: 700;
  font-size: 1rem;
}

@media (min-width: 768px) {
  .element-symbol {
    font-size: 1.1rem;
  }
}

.element-name {
  font-size: 0.5625rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (min-width: 768px) {
  .element-name {
    font-size: 0.625rem;
  }
}

.element-mass {
  font-size: 0.5rem;
  opacity: 0.8;
}

@media (min-width: 768px) {
  .element-mass {
    font-size: 0.5625rem;
  }
}

.empty-cell {
  background: transparent;
  pointer-events: none;
}

.spacer-row {
  height: 16px;
  background: transparent;
  pointer-events: none;
}

@media (min-width: 768px) {
  .spacer-row {
    height: 20px;
  }
}

.lanthanide-label,
.actinide-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  border-radius: 4px;
  min-height: 60px;
}

@media (min-width: 768px) {
  .lanthanide-label,
  .actinide-label {
    font-size: 0.75rem;
    min-height: 65px;
  }
}

.lanthanide-label {
  background-color: #ff7675;
  color: white;
}

.actinide-label {
  background-color: #a29bfe;
  color: white;
}

.period-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

@media (min-width: 768px) {
  .period-label {
    font-size: 0.875rem;
  }
}

/* Classification View */
.classification-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1rem;
}

@media (min-width: 768px) {
  .classification-grid {
    gap: 2rem;
  }
}

.classification-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
  .classification-section {
    padding: 1.5rem;
  }
}

.classification-section h2 {
  font-size: 1.375rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .classification-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
  }
}

.classification-section h2 i {
  color: var(--primary);
  font-size: 1.25rem;
}

@media (min-width: 768px) {
  .classification-section h2 i {
    font-size: 1.5rem;
  }
}

.metals-section {
  border-left: 4px solid #ff6b6b;
}

.metalloids-section {
  border-left: 4px solid #5f27cd;
}

.nonmetals-section {
  border-left: 4px solid #1dd1a1;
}

.classification-subsections {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .classification-subsections {
    gap: 1.5rem;
  }
}

.subsection h3 {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

@media (min-width: 768px) {
  .subsection h3 {
    font-size: 1rem;
  }
}

.elements-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .elements-row {
    gap: 0.625rem;
  }
}

.element-tile-small {
  width: 64px;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
  .element-tile-small {
    width: 72px;
  }
}

.element-tile-small:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.element-tile-small .element-number {
  font-size: 0.5625rem;
  opacity: 0.8;
}

@media (min-width: 768px) {
  .element-tile-small .element-number {
    font-size: 0.625rem;
  }
}

.element-tile-small .element-symbol {
  font-size: 0.9375rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .element-tile-small .element-symbol {
    font-size: 1rem;
  }
}

.element-tile-small .element-name {
  font-size: 0.5rem;
}

@media (min-width: 768px) {
  .element-tile-small .element-name {
    font-size: 0.5625rem;
  }
}

/* Responsive element detail modal */
.element-detail {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.element-detail.hidden {
  display: none;
}

.detail-content {
  background-color: var(--background);
  padding: 1.5rem;
  border-radius: 1rem;
  max-width: 480px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow-lg);
}

@media (min-width: 768px) {
  .detail-content {
    padding: 2rem;
  }
}

.detail-content .close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

@media (min-width: 768px) {
  .detail-content .close-btn {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem;
  border-radius: 0.875rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .detail-header {
    gap: 1.5rem;
    padding: 1.5rem;
  }
}

.detail-symbol-large {
  font-size: 2.5rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .detail-symbol-large {
    font-size: 3rem;
  }
}

.detail-name h2 {
  font-size: 1.375rem;
  margin-bottom: 0.375rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .detail-name h2 {
    font-size: 1.5rem;
  }
}

.detail-name p {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.9375rem;
}

.detail-table {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

@media (min-width: 768px) {
  .detail-table {
    gap: 0.75rem;
  }
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.875rem;
  background-color: var(--surface);
  border-radius: 0.625rem;
  gap: 1rem;
}

@media (min-width: 768px) {
  .detail-row {
    padding: 1rem;
  }
}

.detail-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

@media (min-width: 768px) {
  .detail-label {
    font-size: 0.9375rem;
  }
}

.detail-value {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.875rem;
  text-align: right;
}

@media (min-width: 768px) {
  .detail-value {
    font-size: 0.9375rem;
  }
}

/* Responsive Le Chatelier styles */
.principle-container {
  max-width: 700px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

@media (min-width: 768px) {
  .principle-container {
    margin: 2rem auto;
    padding: 0 2rem;
  }
}

.formula-display {
  background: var(--background);
  border: 2px solid var(--accent);
  border-radius: 0.75rem;
  padding: 1.25rem;
  text-align: center;
  margin: 1rem 0;
}

@media (min-width: 640px) {
  .formula-display {
    padding: 1.5rem;
  }
}

.formula-title {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.formula-fraction {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  font-family: "Times New Roman", serif;
}

.fraction-numerator {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
}

@media (min-width: 640px) {
  .fraction-numerator {
    font-size: 2rem;
  }
}

.fraction-line {
  width: 100%;
  max-width: 300px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--text-primary), transparent);
  position: relative;
}

@media (min-width: 640px) {
  .fraction-line {
    max-width: 400px;
    height: 3px;
  }
}

.fraction-line::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 2px;
  background: var(--text-primary);
}

@media (min-width: 640px) {
  .fraction-line::before {
    height: 3px;
  }
}

.fraction-denominator {
  font-size: 1rem;
  color: var(--text-primary);
  padding: 0.5rem;
  letter-spacing: 0.5px;
  font-weight: 500;
}

@media (min-width: 640px) {
  .fraction-denominator {
    font-size: 1.125rem;
    letter-spacing: 1px;
  }
}

.formula-fraction sub {
  font-size: 0.7em;
  vertical-align: sub;
}

.formula-fraction sup {
  font-size: 0.7em;
  vertical-align: super;
}

.info-section {
  background-color: var(--surface);
  padding: 1.25rem;
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 640px) {
  .info-section {
    padding: 1.5rem;
    margin-bottom: 2rem;
  }
}

.info-section h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .info-section h2 {
    font-size: 1.5rem;
  }
}

.info-section p {
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
}

.info-section code {
  background-color: var(--background);
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  display: inline-block;
  font-family: "Courier New", monospace;
  font-size: 1.125rem;
  border: 1px solid var(--border);
}

.format-help {
  margin-top: 1rem;
  padding: 1rem;
  background-color: var(--background);
  border-left: 3px solid var(--primary);
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

.result-section,
.error-section {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border-radius: 0.875rem;
  background-color: var(--surface);
  box-shadow: var(--shadow-sm);
}

@media (min-width: 640px) {
  .result-section,
  .error-section {
    margin-top: 2rem;
    padding: 1.5rem;
  }
}

.result-section h3,
.error-section h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .result-section h3,
  .error-section h3 {
    font-size: 1.5rem;
  }
}

.result-section.hidden,
.error-section.hidden {
  display: none;
}

.error-section {
  background-color: #fee2e2;
  color: #7f1d1d;
  border: 2px solid #fca5a5;
}

html[data-theme="dark"] .error-section {
  background-color: rgba(127, 29, 29, 0.3);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.5);
}

.result-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.equation-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--background);
  border-radius: 0.625rem;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .equation-card {
    gap: 1rem;
  }
}

.equation-number {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 0.875rem;
}

@media (min-width: 768px) {
  .equation-number {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
}

.equation-display {
  flex: 1;
  font-family: "Courier New", monospace;
  font-size: 1rem;
}

@media (min-width: 768px) {
  .equation-display {
    font-size: 1.125rem;
  }
}

.result-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1rem 0;
}

@media (min-width: 640px) {
  .result-header {
    grid-template-columns: 1fr 1fr;
  }
}

.result-item {
  background-color: var(--background);
  border: 2px solid var(--primary);
  border-radius: 0.75rem;
  padding: 1.25rem;
  text-align: center;
}

.result-item .label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.625rem;
  font-weight: 600;
}

.result-item .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

@media (min-width: 768px) {
  .result-item .value {
    font-size: 1.75rem;
  }
}

.explanation-box {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(16, 185, 129, 0.1));
  border-left: 4px solid var(--primary);
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-top: 1.25rem;
}

@media (min-width: 768px) {
  .explanation-box {
    padding: 1.5rem;
  }
}

.explanation-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1rem;
}

@media (min-width: 768px) {
  .explanation-header {
    font-size: 1.125rem;
  }
}

.explanation-text {
  color: var(--text-primary);
  line-height: 1.75;
  white-space: pre-wrap;
  font-size: 0.9375rem;
}

@media (min-width: 768px) {
  .explanation-text {
    font-size: 1rem;
  }
}

/* Full Post Page */
.post-full {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 768px) {
  .post-full {
    padding: 0;
  }
}

.post-full-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.post-full-header h1 {
  font-size: 1.875rem;
  margin-bottom: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

@media (min-width: 768px) {
  .post-full-header h1 {
    font-size: 2.5rem;
  }
}

.post-meta {
  color: var(--text-secondary);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9375rem;
}

.post-meta span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.post-full-content {
  font-size: 1.0625rem;
  line-height: 1.75;
  white-space: pre-wrap;
  word-wrap: break-word;
}

@media (min-width: 768px) {
  .post-full-content {
    font-size: 1.125rem;
    line-height: 1.8;
  }
}

/* Utility classes for better responsiveness */
.hidden {
  display: none;
}

@media (max-width: 639px) {
  .hide-mobile {
    display: none !important;
  }
}

@media (min-width: 640px) {
  .show-mobile {
    display: none !important;
  }
}

/* Smooth scrolling and touch improvements */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Touch target improvements for mobile */
@media (hover: none) and (pointer: coarse) {
  button,
  a,
  .tile,
  .post-card,
  .element-tile,
  .element-tile-small {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Focus styles for better accessibility */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Loading states */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Added toggle switch styles for admin panel */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--text-secondary);
  transition: 0.3s;
  border-radius: 28px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Improved tile info layout for admin */
.tile-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.tile-info i {
  font-size: 1.5rem;
  color: var(--primary);
  flex-shrink: 0;
}

.tile-info div {
  min-width: 0;
}

.tile-info h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.tile-info p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 0;
}

/* Improved sidebar footer with logout button */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

@media (min-width: 1024px) {
  .sidebar-footer {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    right: 2rem;
    margin-top: 0;
  }
}

.logout-link {
  color: #ef4444;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  font-weight: 500;
  text-align: center;
  justify-content: center;
}

.logout-link:hover {
  background-color: rgba(239, 68, 68, 0.1);
}

/* Improved admin logo styles */
.admin-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .admin-logo {
    height: 40px;
  }
}

/* Improved version badge */
.version-badge {
  background-color: var(--primary);
  color: white;
  padding: 0.25rem 0.625rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
  margin-top: 0.5rem;
}

/* Improved sidebar header layout */
.sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

@media (min-width: 1024px) {
  .sidebar-header {
    margin-bottom: 2rem;
  }
}

.sidebar-header h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
  .sidebar-header h2 {
    font-size: 1.25rem;
  }
}

/* Improved tab header layout */
.tab-header {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  .tab-header {
    margin-bottom: 2rem;
    align-items: center;
  }
}

.tab-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

@media (min-width: 768px) {
  .tab-header h2 {
    font-size: 1.875rem;
  }
}

.tab-description {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-top: 0.5rem;
}

/* Improved dashboard grid layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

.stat-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, var(--primary), #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-info {
  flex: 1;
  min-width: 0;
}

.stat-info h4 {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.stat-info span {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Improved plugin info layout */
.plugin-info {
  flex: 1;
  min-width: 0;
}

.plugin-info h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.plugin-info p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 0;
}

.plugin-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.plugin-meta .version {
  background-color: var(--primary);
  color: white;
  padding: 0.25rem 0.625rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.plugin-meta .status {
  padding: 0.25rem 0.625rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.plugin-meta .status.active {
  background-color: #d1fae5;
  color: #065f46;
}

html[data-theme="dark"] .plugin-meta .status.active {
  background-color: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

.plugin-meta .status.inactive {
  background-color: #fee2e2;
  color: #991b1b;
}

html[data-theme="dark"] .plugin-meta .status.inactive {
  background-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

/* Improved empty state styles */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* Improved post info layout */
.post-info {
  flex: 1;
  min-width: 0;
}

.post-info h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Button sizing improvements */
.btn-lg {
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.btn-edit {
  background-color: var(--accent);
}

.btn-edit:hover {
  background-color: #059669;
}

/* Improved settings form layout */
.settings-form {
  max-width: 600px;
}

/* Improved full post page layout */
.post-full {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 768px) {
  .post-full {
    padding: 0;
  }
}

.post-full-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.post-full-header h1 {
  font-size: 1.875rem;
  margin-bottom: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

@media (min-width: 768px) {
  .post-full-header h1 {
    font-size: 2.5rem;
  }
}

.post-meta {
  color: var(--text-secondary);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9375rem;
}

.post-meta span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.post-full-content {
  font-size: 1.0625rem;
  line-height: 1.75;
  white-space: pre-wrap;
  word-wrap: break-word;
}

@media (min-width: 768px) {
  .post-full-content {
    font-size: 1.125rem;
    line-height: 1.8;
  }
}

/* Le Chatelier specific styles with responsive improvements */
.principle-container {
  max-width: 700px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

@media (min-width: 768px) {
  .principle-container {
    margin: 2rem auto;
    padding: 0 2rem;
  }
}

.info-section {
  background-color: var(--surface);
  padding: 1.25rem;
  border-radius: 0.875rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
  .info-section {
    padding: 1.5rem;
    margin-bottom: 2rem;
  }
}

.info-section h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .info-section h2 {
    font-size: 1.5rem;
  }
}

.info-section p {
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
}

.info-section code {
  background-color: var(--background);
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  display: inline-block;
  font-family: "Courier New", monospace;
  font-size: 1.125rem;
  border: 1px solid var(--border);
}

.formula-card {
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: 0.875rem;
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
}

.formula-title {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-weight: 600;
  text-align: center;
}

@media (min-width: 768px) {
  .formula-title {
    font-size: 1rem;
  }
}

.fraction {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  font-family: "Times New Roman", serif;
}

.fraction-numerator {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  padding: 0.5rem;
  text-align: center;
}

@media (min-width: 768px) {
  .fraction-numerator {
    font-size: 1.5rem;
  }
}

.fraction-line {
  width: 100%;
  max-width: 400px;
  height: 2px;
  background: var(--text-primary);
  position: relative;
}

.fraction-denominator {
  font-size: 1rem;
  color: var(--text-primary);
  padding: 0.5rem;
  letter-spacing: 0.5px;
  font-weight: 500;
  text-align: center;
}

@media (min-width: 768px) {
  .fraction-denominator {
    font-size: 1.125rem;
  }
}

/* Improved result section styles */
.result-section,
.error-section {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border-radius: 0.875rem;
  background-color: var(--surface);
  box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
  .result-section,
  .error-section {
    margin-top: 2rem;
    padding: 1.5rem;
  }
}

.result-section h3,
.error-section h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .result-section h3,
  .error-section h3 {
    font-size: 1.5rem;
  }
}

.result-section.hidden,
.error-section.hidden {
  display: none;
}

.error-section {
  background-color: #fee2e2;
  color: #7f1d1d;
  border: 2px solid #fca5a5;
}

html[data-theme="dark"] .error-section {
  background-color: rgba(127, 29, 29, 0.3);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.5);
}

/* Improved equation card styles */
.equation-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--background);
  border-radius: 0.625rem;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .equation-card {
    gap: 1rem;
  }
}

.equation-number {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 0.875rem;
}

@media (min-width: 768px) {
  .equation-number {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
}

.equation-display {
  flex: 1;
  font-family: "Courier New", monospace;
  font-size: 1rem;
}

@media (min-width: 768px) {
  .equation-display {
    font-size: 1.125rem;
  }
}

/* Improved result items grid */
.result-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1rem 0;
}

@media (min-width: 640px) {
  .result-header {
    grid-template-columns: 1fr 1fr;
  }
}

/* Improved explanation box */
.explanation-box {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(16, 185, 129, 0.1));
  border-left: 4px solid var(--primary);
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-top: 1.25rem;
}

@media (min-width: 768px) {
  .explanation-box {
    padding: 1.5rem;
  }
}

.explanation-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1rem;
}

@media (min-width: 768px) {
  .explanation-header {
    font-size: 1.125rem;
  }
}

.explanation-text {
  color: var(--text-primary);
  line-height: 1.75;
  white-space: pre-wrap;
  font-size: 0.9375rem;
}

@media (min-width: 768px) {
  .explanation-text {
    font-size: 1rem;
  }
}

/* Improved login page styles */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(135deg, var(--surface) 0%, var(--background) 100%);
}

@media (min-width: 768px) {
  .login-page {
    padding: 2rem;
  }
}

.login-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
}

.login-card-header {
  background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
  padding: 2rem 1.5rem;
  text-align: center;
  color: white;
}

@media (min-width: 768px) {
  .login-card-header {
    padding: 2.5rem 2rem;
  }
}

.login-logo {
  height: 56px;
  width: auto;
  object-fit: contain;
  margin-bottom: 1rem;
  filter: brightness(0) invert(1);
}

@media (min-width: 768px) {
  .login-logo {
    height: 64px;
  }
}

.login-card-header h1 {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
  .login-card-header h1 {
    font-size: 1.5rem;
  }
}

.login-subtitle {
  opacity: 0.95;
  font-size: 0.9375rem;
}

.login-alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  margin: 1.25rem 1.25rem 0;
  border-radius: 0.625rem;
  font-size: 0.875rem;
}

@media (min-width: 768px) {
  .login-alert {
    padding: 1rem 1.5rem;
    margin: 1.5rem 1.5rem 0;
    font-size: 0.9375rem;
  }
}

.login-alert-error {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

html[data-theme="dark"] .login-alert-error {
  background-color: rgba(127, 29, 29, 0.3);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.login-form {
  padding: 1.5rem 1.25rem;
}

@media (min-width: 768px) {
  .login-form {
    padding: 2rem 1.5rem;
  }
}

.login-form-group {
  margin-bottom: 1.25rem;
}

.login-form-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

@media (min-width: 768px) {
  .login-form-group label {
    font-size: 0.9375rem;
  }
}

.login-form-group label i {
  color: var(--primary);
  width: 16px;
}

.login-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border);
  border-radius: 0.625rem;
  background-color: var(--surface);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.login-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.login-input::placeholder {
  color: var(--text-secondary);
}

.login-btn {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 0.625rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  transition: all 0.2s ease;
  margin-top: 0.75rem;
  box-shadow: var(--shadow-md);
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.login-btn:active {
  transform: translateY(0);
}

.login-card-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
  background: var(--surface);
}

@media (min-width: 768px) {
  .login-card-footer {
    padding: 1.5rem;
  }
}

.login-back-link {
  color: var(--primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  transition: opacity 0.2s ease;
  font-weight: 500;
}

@media (min-width: 768px) {
  .login-back-link {
    font-size: 0.9375rem;
  }
}

.login-back-link:hover {
  opacity: 0.8;
}

/* Improved classification view for periodic table */
.classification-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1rem;
}

@media (min-width: 768px) {
  .classification-grid {
    gap: 2rem;
  }
}

.classification-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
  .classification-section {
    padding: 1.5rem;
  }
}

.classification-section h2 {
  font-size: 1.375rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .classification-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
  }
}

.classification-section h2 i {
  color: var(--primary);
  font-size: 1.25rem;
}

@media (min-width: 768px) {
  .classification-section h2 i {
    font-size: 1.5rem;
  }
}

.metals-section {
  border-left: 4px solid #ff6b6b;
}

.metalloids-section {
  border-left: 4px solid #5f27cd;
}

.nonmetals-section {
  border-left: 4px solid #1dd1a1;
}

.classification-subsections {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .classification-subsections {
    gap: 1.5rem;
  }
}

.subsection h3 {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

@media (min-width: 768px) {
  .subsection h3 {
    font-size: 1rem;
  }
}

.elements-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .elements-row {
    gap: 0.625rem;
  }
}

.element-tile-small {
  width: 64px;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
  .element-tile-small {
    width: 72px;
  }
}

.element-tile-small:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.element-tile-small .element-number {
  font-size: 0.5625rem;
  opacity: 0.8;
}

@media (min-width: 768px) {
  .element-tile-small .element-number {
    font-size: 0.625rem;
  }
}

.element-tile-small .element-symbol {
  font-size: 0.9375rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .element-tile-small .element-symbol {
    font-size: 1rem;
  }
}

.element-tile-small .element-name {
  font-size: 0.5rem;
}

@media (min-width: 768px) {
  .element-tile-small .element-name {
    font-size: 0.5625rem;
  }
}

/* Improved element detail modal */
.element-detail {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.element-detail.hidden {
  display: none;
}

.detail-content {
  background-color: var(--background);
  padding: 1.5rem;
  border-radius: 1rem;
  max-width: 480px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow-lg);
}

@media (min-width: 768px) {
  .detail-content {
    padding: 2rem;
  }
}

.detail-content .close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

@media (min-width: 768px) {
  .detail-content .close-btn {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem;
  border-radius: 0.875rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .detail-header {
    gap: 1.5rem;
    padding: 1.5rem;
  }
}

.detail-symbol-large {
  font-size: 2.5rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .detail-symbol-large {
    font-size: 3rem;
  }
}

.detail-name h2 {
  font-size: 1.375rem;
  margin-bottom: 0.375rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .detail-name h2 {
    font-size: 1.5rem;
  }
}

.detail-name p {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.9375rem;
}

.detail-table {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

@media (min-width: 768px) {
  .detail-table {
    gap: 0.75rem;
  }
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.875rem;
  background-color: var(--surface);
  border-radius: 0.625rem;
  gap: 1rem;
}

@media (min-width: 768px) {
  .detail-row {
    padding: 1rem;
  }
}

.detail-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

@media (min-width: 768px) {
  .detail-label {
    font-size: 0.9375rem;
  }
}

.detail-value {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.875rem;
  text-align: right;
}

@media (min-width: 768px) {
  .detail-value {
    font-size: 0.9375rem;
  }
}

/* Added touch-friendly focus states */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Improved spacing for empty cell placeholders */
.empty-cell {
  background: transparent;
  pointer-events: none;
}

.spacer-row {
  height: 16px;
  background: transparent;
  pointer-events: none;
}

@media (min-width: 768px) {
  .spacer-row {
    height: 20px;
  }
}

.lanthanide-label,
.actinide-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  border-radius: 4px;
  min-height: 60px;
}

@media (min-width: 768px) {
  .lanthanide-label,
  .actinide-label {
    font-size: 0.75rem;
    min-height: 65px;
  }
}

.lanthanide-label {
  background-color: #ff7675;
  color: white;
}

.actinide-label {
  background-color: #a29bfe;
  color: white;
}

/* Improved period label if used */
.period-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

@media (min-width: 768px) {
  .period-label {
    font-size: 0.875rem;
  }
}

/* Ensure images are responsive */
img {
  max-width: 100%;
  height: auto;
}
