:root {
  color-scheme: light dark;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #f5f5f5;
  color: #1e1e1e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  background: linear-gradient(135deg, #e0f2f1, #f1f8e9);
}

.auth {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(12px);
  z-index: 1000;
}

.auth[hidden] {
  display: none;
}

.auth__card[hidden],
.auth__card[aria-hidden="true"] {
  display: none !important;
}

.auth__card {
  width: min(420px, 94vw);
  background: rgba(255, 255, 255, 0.95);
  padding: clamp(1.75rem, 4vw, 2.5rem);
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25);
  display: grid;
  gap: 1.5rem;
}

.auth__title {
  margin: 0;
  font-size: 1.8rem;
  color: #0f172a;
}

.auth__subtitle {
  margin: 0;
  color: #475569;
  line-height: 1.6;
}

.auth__submit {
  justify-self: start;
}

.auth__error {
  margin: 0;
  font-size: 0.95rem;
  color: #dc2626;
}

.auth__info {
  margin: 0;
  font-size: 0.95rem;
  color: #2563eb;
}

.auth__actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.auth__resend {
  justify-self: start;
  padding: 0.5rem 1.1rem;
  font-size: 0.95rem;
}

.app {
  width: min(960px, 100%);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
  border-radius: 16px;
  padding: clamp(1.75rem, 4vw, 2.5rem);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.15);
  display: grid;
  gap: clamp(1.75rem, 3vw, 2.5rem);
}

.app__toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: -0.5rem;
}

.app__toolbar .btn {
  padding: 0.55rem 1.1rem;
}

form {
  display: grid;
  gap: 1.25rem;
}

.field {
  display: grid;
  gap: 0.5rem;
}

label {
  font-weight: 600;
  color: #1f2937;
}

input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #cbd5f5;
  border-radius: 10px;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.form-actions {
  display: flex;
  gap: 1rem;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn--primary {
  color: white;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.35);
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.4);
}

.btn--ghost {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}

.btn--ghost:hover {
  background: rgba(15, 23, 42, 0.1);
}

.btn--icon {
  background: transparent;
  padding: 0.45rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
  text-transform: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.btn--icon:hover {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.btn--icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

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

.link-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid transparent;
  transition: border-color 0.2s ease, transform 0.15s ease;
  height: 100%;
}

.link-item__main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.link-item__icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  background: #e2e8f0;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.5);
}

.link-item:hover {
  border-color: rgba(37, 99, 235, 0.35);
  transform: translateY(-2px);
}

.link-item__anchor {
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.link-item__anchor:hover .link-item__title {
  text-decoration: underline;
}

.link-item__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-item__url {
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-item__actions {
  display: flex;
  gap: 0.5rem;
}

.empty {
  text-align: center;
  color: #6b7280;
}

@media (max-width: 600px) {
  body {
    padding: 1.25rem;
  }

  .auth {
    padding: 1.5rem;
  }

  .auth__card {
    padding: 2rem;
    gap: 1.25rem;
  }

  .app {
    width: 100%;
    padding: 1.5rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .link-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .link-item__main {
    width: 100%;
  }

  .link-item__anchor {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .app__toolbar {
    justify-content: center;
  }

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

  .auth__resend {
    width: 100%;
    text-align: center;
  }
}

@media (min-width: 768px) {
  .link-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .link-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
