@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap");

:root {
  --ink: #071a2f;
  --ink-soft: #0c2744;
  --ink-lighter: #123759;
  --ice: #f1f8ff;
  --ice-muted: #aac5da;
  --blue: #43a5ff;
  --blue-bright: #75bdff;
  --line: rgba(179, 215, 239, 0.15);
  --surface: rgba(9, 35, 61, 0.72);
  --shadow: 0 24px 80px rgba(0, 8, 18, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ice);
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    var(--ink);
  background-size: 42px 42px;
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(180deg, transparent 0%, rgba(3, 14, 27, 0.5) 100%);
  content: "";
  pointer-events: none;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.22;
  pointer-events: none;
}

.ambient--one {
  top: -300px;
  right: -180px;
  background: radial-gradient(circle, #1c9aff 0%, rgba(28, 154, 255, 0) 68%);
}

.ambient--two {
  bottom: -400px;
  left: -260px;
  background: radial-gradient(circle, #1b80cc 0%, rgba(27, 128, 204, 0) 70%);
}

.page-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  min-height: 590px;
  padding: 32px 0 88px;
  display: flex;
  flex-direction: column;
}

.brand {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ice);
  text-decoration: none;
}

.brand__mark {
  width: 42px;
  height: 42px;
  display: block;
  border: 1px solid rgba(201, 225, 242, 0.4);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 5px 18px rgba(0, 7, 15, 0.35);
}

.brand__name {
  color: var(--ice-muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.hero__content {
  margin: auto 0 0;
}

.eyebrow {
  margin: 0 0 15px;
  color: var(--blue-bright);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  letter-spacing: -0.045em;
}

h1 {
  max-width: 850px;
  font-size: clamp(55px, 9vw, 108px);
  line-height: 0.88;
}

h1 span {
  color: transparent;
  background: linear-gradient(110deg, #f3faff 12%, #62b1f7 92%);
  background-clip: text;
  -webkit-background-clip: text;
}

.hero__intro {
  max-width: 580px;
  margin: 32px 0 0;
  color: var(--ice-muted);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.65;
}

.dictionary {
  margin-bottom: 80px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.dictionary__toolbar {
  padding: 30px 32px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.dictionary__toolbar .eyebrow {
  margin-bottom: 9px;
}

h2 {
  font-size: clamp(30px, 4vw, 42px);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.search {
  width: min(32vw, 360px);
  height: 50px;
  padding: 0 13px 0 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid rgba(174, 211, 237, 0.2);
  border-radius: 13px;
  color: var(--ice-muted);
  background: rgba(1, 15, 29, 0.36);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.search:focus-within {
  border-color: rgba(117, 189, 255, 0.75);
  background: rgba(1, 15, 29, 0.56);
  box-shadow: 0 0 0 4px rgba(67, 165, 255, 0.11);
}

.search svg {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--ice);
  background: transparent;
  font: 500 15px/1 "DM Sans", sans-serif;
}

.search input::placeholder {
  color: #7897af;
}

.search input::-webkit-search-cancel-button {
  display: none;
}

kbd {
  padding: 3px 7px;
  border: 1px solid rgba(174, 211, 237, 0.22);
  border-radius: 6px;
  color: #7897af;
  background: rgba(255, 255, 255, 0.035);
  font: 500 12px/1.2 "DM Sans", sans-serif;
}

.dictionary__meta {
  min-height: 49px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  color: #7897af;
  font-size: 13px;
}

.dictionary__meta p {
  margin: 0;
}

.clear-button {
  padding: 4px 0;
  border: 0;
  color: var(--blue-bright);
  background: none;
  cursor: pointer;
  font: 600 13px/1 "DM Sans", sans-serif;
}

.clear-button:hover {
  color: var(--ice);
}

.primary-button,
.secondary-button,
.icon-button {
  border: 0;
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: transform 150ms ease, background-color 150ms ease, color 150ms ease,
    opacity 150ms ease, box-shadow 150ms ease;
}

.primary-button {
  min-height: 50px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 13px;
  color: #03182b;
  background: linear-gradient(135deg, #84c9ff, #43a5ff);
  box-shadow: 0 9px 24px rgba(19, 118, 200, 0.2);
  white-space: nowrap;
}

.primary-button span {
  font-size: 21px;
  font-weight: 400;
  line-height: 0;
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(19, 118, 200, 0.3);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.secondary-button {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(174, 211, 237, 0.2);
  border-radius: 12px;
  color: var(--ice-muted);
  background: rgba(255, 255, 255, 0.035);
}

.secondary-button:hover {
  color: var(--ice);
  background: rgba(255, 255, 255, 0.07);
}

.table-wrap {
  position: relative;
  min-height: 170px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 23px 32px;
  text-align: left;
}

th:first-child,
td:first-child {
  width: 36%;
}

th {
  color: #7897af;
  background: rgba(1, 15, 29, 0.22);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

td {
  border-top: 1px solid var(--line);
  vertical-align: top;
  color: var(--ice-muted);
  font-size: 16px;
  line-height: 1.55;
}

tbody tr {
  transition: background-color 150ms ease;
}

tbody tr:hover {
  background: rgba(67, 165, 255, 0.045);
}

td:first-child {
  color: var(--ice);
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  font-size: 19px;
  font-weight: 600;
}

.status {
  min-height: 170px;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--ice-muted);
  text-align: center;
}

.status[hidden],
table[hidden] {
  display: none;
}

.status p {
  max-width: 430px;
  margin: 0;
  line-height: 1.6;
}

.modal {
  width: min(520px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  overflow: visible;
  border: 1px solid rgba(174, 211, 237, 0.2);
  border-radius: 22px;
  color: var(--ice);
  background: #0a223b;
  box-shadow: 0 30px 100px rgba(0, 7, 15, 0.65);
}

.modal[open] {
  animation: modal-in 180ms ease-out;
}

.modal::backdrop {
  background: rgba(1, 9, 18, 0.78);
  backdrop-filter: blur(7px);
}

.modal__card {
  padding: 30px;
  overflow-y: auto;
}

.modal__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.modal__heading .eyebrow {
  margin-bottom: 8px;
}

.modal__heading h2 {
  font-size: 31px;
  line-height: 1.08;
}

.icon-button {
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid rgba(174, 211, 237, 0.16);
  border-radius: 10px;
  color: var(--ice-muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
}

.icon-button:hover {
  color: var(--ice);
  background: rgba(255, 255, 255, 0.08);
}

.modal__intro {
  margin: 22px 0;
  color: var(--ice-muted);
  line-height: 1.55;
}

.field {
  margin-top: 20px;
  display: grid;
  gap: 9px;
}

.field > span {
  color: var(--ice-muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid rgba(174, 211, 237, 0.2);
  border-radius: 12px;
  outline: none;
  color: var(--ice);
  background: rgba(1, 15, 29, 0.48);
  font: 500 16px/1.5 "DM Sans", sans-serif;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input {
  height: 50px;
  padding: 0 14px;
}

.field textarea {
  min-height: 116px;
  padding: 12px 14px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(117, 189, 255, 0.75);
  box-shadow: 0 0 0 4px rgba(67, 165, 255, 0.11);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #66859e;
}

.form-error {
  margin: 15px 0 0;
  color: #ff9fa9;
  font-size: 13px;
  line-height: 1.5;
}

.modal__actions {
  margin-top: 28px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal__actions .primary-button {
  min-height: 46px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(420px, calc(100% - 48px));
  padding: 14px 18px;
  border: 1px solid rgba(117, 189, 255, 0.3);
  border-radius: 12px;
  color: var(--ice);
  background: #0e3454;
  box-shadow: 0 18px 45px rgba(0, 7, 15, 0.45);
  font-size: 14px;
}

.toast[hidden] {
  display: none;
}

.loader {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(117, 189, 255, 0.2);
  border-top-color: var(--blue-bright);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

footer {
  padding: 0 4px 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #6e8ca5;
  font-size: 13px;
}

footer p {
  margin: 0;
}

footer span {
  color: var(--blue);
}

.noscript {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: 20px;
  padding: 16px;
  border-radius: 10px;
  color: var(--ice);
  background: #8b2e3a;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 24px, 1120px);
  }

  .hero {
    min-height: 510px;
    padding-top: 20px;
    padding-bottom: 56px;
  }

  .brand__name {
    font-size: 13px;
  }

  h1 {
    font-size: clamp(48px, 16.5vw, 78px);
    line-height: 0.94;
  }

  .hero__intro {
    margin-top: 24px;
    font-size: 16px;
  }

  .dictionary {
    margin-bottom: 50px;
    border-radius: 18px;
  }

  .dictionary__toolbar {
    padding: 24px 20px;
    align-items: stretch;
    flex-direction: column;
  }

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

  .search {
    width: 100%;
  }

  .toolbar-actions > .primary-button {
    width: 100%;
  }

  .dictionary__meta {
    padding: 0 20px;
  }

  thead {
    display: none;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
  }

  tbody {
    padding: 4px 20px;
  }

  tbody tr {
    padding: 20px 0;
  }

  tbody tr + tr {
    border-top: 1px solid var(--line);
  }

  th:first-child,
  td:first-child {
    width: auto;
  }

  td {
    padding: 0;
    border: 0;
  }

  td:first-child {
    margin-bottom: 7px;
    font-size: 18px;
  }

  footer {
    padding-bottom: 28px;
    flex-direction: column;
    text-align: center;
  }

  .modal__card {
    padding: 24px 20px;
  }

  .modal__heading h2 {
    font-size: 27px;
  }

  .modal__actions {
    flex-direction: row-reverse;
  }

  .modal__actions > * {
    flex: 1;
  }

  .toast {
    right: 14px;
    bottom: 14px;
    max-width: calc(100% - 28px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
