:root {
  color-scheme: dark;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #1a1f35, #0b0f1a 55%);
  color: #e8ecff;
}

body[data-theme="classroom"] {
  background: #f5f6f8;
  color: #1d2335;
}

.page {
  min-height: 100vh;
  padding: 120px 16px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.breadcrumb {
  max-width: 1100px;
  width: 100%;
  color: #9aa3c7;
  font-size: 0.9rem;
  display: flex;
  gap: 8px;
  align-items: center;
}

body[data-theme="classroom"] .breadcrumb {
  color: #51607a;
}

.cabinet {
  width: min(1100px, 100%);
  background: rgba(16, 20, 35, 0.9);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(110, 130, 255, 0.2);
}

body[data-theme="classroom"] .cabinet {
  background: #ffffff;
  border: 1px solid #d7dbe6;
  box-shadow: 0 14px 40px rgba(38, 42, 55, 0.1);
}

.cabinet-header {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cabinet-header h1 {
  font-size: clamp(2rem, 3vw, 2.6rem);
  margin: 0 0 8px;
}

.cabinet-header p {
  margin: 0;
  color: #b7c2ee;
}

body[data-theme="classroom"] .cabinet-header p {
  color: #52617a;
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  background: rgba(20, 28, 50, 0.8);
  padding: 12px 16px;
  border-radius: 16px;
}

body[data-theme="classroom"] .status-bar {
  background: #f2f4f9;
}

.status-item {
  display: grid;
  gap: 4px;
  font-size: 0.85rem;
  min-width: 80px;
}

.status-item .value {
  font-size: 1.2rem;
  font-weight: 700;
}

.status-item.badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(103, 106, 255, 0.4);
  font-weight: 700;
}

body[data-theme="classroom"] .status-item.badge {
  background: #d7e2ff;
}

.status-item.badge.status-toggle {
  background: rgba(126, 249, 255, 0.2);
  color: #d6fbff;
}

body[data-theme="classroom"] .status-item.badge.status-toggle {
  background: #cfe9ff;
  color: #1b2d4a;
}

.settings-btn {
  padding: 8px 14px;
  border-radius: 10px;
  border: none;
  background: #5d6bff;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

body[data-theme="classroom"] .settings-btn {
  background: #2d5bb3;
}

.cabinet-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.left-panel {
  display: grid;
  gap: 16px;
}

.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  background: rgba(24, 30, 54, 0.8);
  padding: 16px;
  border-radius: 20px;
  touch-action: none;
  user-select: none;
}

body[data-theme="classroom"] .board {
  background: #f5f7ff;
}

.tile {
  background: rgba(90, 105, 255, 0.2);
  border: 1px solid rgba(114, 145, 255, 0.6);
  color: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  border-radius: 14px;
  padding: 18px;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

body[data-theme="classroom"] .tile {
  background: #ffffff;
  border: 1px solid #c7d2ee;
}

.tile:focus-visible {
  outline: 3px solid #ffd86b;
  outline-offset: 2px;
}

.tile.selected {
  background: #7ef9ff;
  color: #151821;
  box-shadow: 0 0 16px rgba(126, 249, 255, 0.6);
  transform: translateY(-2px);
}

body[data-theme="classroom"] .tile.selected {
  background: #7cc5ff;
  color: #0b1a2a;
}

.tile.adjacent {
  box-shadow: 0 0 10px rgba(126, 249, 255, 0.4);
}

.current-word {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(25, 30, 52, 0.9);
  font-weight: 600;
}

body[data-theme="classroom"] .current-word {
  background: #f0f4ff;
}

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

.controls button {
  flex: 1;
  min-width: 110px;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  background: rgba(78, 92, 196, 0.4);
  color: inherit;
  font-weight: 600;
  cursor: pointer;
}

.controls button.primary {
  background: #5d6bff;
  color: #fff;
}

body[data-theme="classroom"] .controls button {
  background: #e4e8f5;
}

body[data-theme="classroom"] .controls button.primary {
  background: #2d5bb3;
  color: #fff;
}

.right-panel {
  display: grid;
  gap: 16px;
}

.panel {
  background: rgba(20, 26, 46, 0.7);
  border-radius: 18px;
  padding: 16px;
}

body[data-theme="classroom"] .panel {
  background: #f7f8fc;
}

.panel h2 {
  margin-top: 0;
}

.found-list {
  max-height: 260px;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding-right: 8px;
}

.found-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(78, 88, 148, 0.5);
}

body[data-theme="classroom"] .found-item {
  background: #e6ecff;
}

.stats ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.stats li {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

details summary {
  cursor: pointer;
  font-weight: 600;
}

.how-to {
  margin-top: 8px;
  color: #c2c9e8;
}

body[data-theme="classroom"] .how-to {
  color: #5b6a83;
}

.settings-drawer {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 20, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.settings-drawer.open {
  display: flex;
}

.drawer-content {
  background: rgba(22, 26, 42, 0.98);
  padding: 24px;
  border-radius: 20px;
  width: min(420px, 92vw);
  display: grid;
  gap: 16px;
}

body[data-theme="classroom"] .drawer-content {
  background: #ffffff;
}

.drawer-content header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-content label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.drawer-content label.setting-toggle {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.drawer-content label.setting-toggle input {
  width: 18px;
  height: 18px;
  accent-color: #5d6bff;
}

body[data-theme="classroom"] .drawer-content label.setting-toggle input {
  accent-color: #2d5bb3;
}

.drawer-content select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #4c5ea5;
  background: transparent;
  color: inherit;
}

body[data-theme="classroom"] .drawer-content select {
  border: 1px solid #c3cbe0;
}

.drawer-content footer {
  display: flex;
  justify-content: flex-end;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 24, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: rgba(20, 24, 40, 0.98);
  padding: 28px;
  border-radius: 22px;
  width: min(420px, 90vw);
  text-align: center;
}

body[data-theme="classroom"] .modal-content {
  background: #ffffff;
}

.modal-actions {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(25, 30, 52, 0.95);
  padding: 10px 16px;
  border-radius: 12px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

body[data-theme="classroom"] .toast {
  background: #1d253a;
  color: #fff;
}

@media (max-width: 768px) {
  .status-bar {
    justify-content: center;
  }

  .board {
    grid-template-columns: repeat(4, minmax(50px, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
