:root {
  --bg: #f7f8fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #dde3eb;
  --primary: #0064e0;
  --primary-hover: #0055bf;
  --danger: #b91c1c;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Roboto", sans-serif;
  background: radial-gradient(circle at 10% 0%, #eef4ff 0%, var(--bg) 45%, #f4f6fa 100%);
  color: var(--text);
}

.dictionary-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 18px 32px;
}

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

.dictionary-header h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

.dictionary-header p {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 720px;
}

.primary-btn {
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.primary-btn:hover {
  background: var(--primary-hover);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 16px;
}

.controls-label {
  font-weight: 600;
}

.sort-switcher {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
}

.sort-btn {
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

.sort-btn.active {
  background: #e8f0fe;
  color: #133e82;
}

.table-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.state-box {
  padding: 18px;
  color: var(--muted);
}

.state-box.error {
  color: var(--danger);
}

.table-wrapper {
  overflow: auto;
  max-height: 72vh;
}

.dictionary-table {
  width: 100%;
  border-collapse: collapse;
  user-select: none;
  -webkit-user-select: none;
}

.dictionary-table th,
.dictionary-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

.dictionary-table thead th {
  position: sticky;
  top: 0;
  background: #f2f6fd;
  z-index: 1;
  font-size: 14px;
}

.dictionary-table tbody tr:hover {
  background: #f8fbff;
}

.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.92);
  color: #ffffff;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.copy-toast.visible {
  opacity: 1;
}

.hidden {
  display: none;
}

@media (max-width: 768px) {
  .dictionary-page {
    padding: 18px 12px 24px;
  }

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

  .dictionary-header h1 {
    font-size: 24px;
  }

  .primary-btn {
    width: 100%;
  }

  .sort-switcher {
    width: 100%;
    flex-direction: column;
  }

  .sort-btn {
    text-align: left;
  }
}
