/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

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

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.14), transparent 28rem),
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.14), transparent 24rem),
    #020617;
  color: #e2e8f0;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-shell {
  width: min(100%, 72rem);
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1;
}

.page-subtitle,
.eyebrow {
  margin: 0 0 0.5rem;
  color: #94a3b8;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  font-weight: 700;
}

.card,
.empty-state {
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.82);
  border-radius: 1.25rem;
  box-shadow: 0 20px 60px rgba(2, 6, 23, 0.45);
}

.card {
  padding: 1.25rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
}

.empty-state h2 {
  margin-top: 0;
}

.button-row,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.8rem 1.2rem;
  font-weight: 700;
  transition: 0.18s ease;
}

.button-primary {
  background: #38bdf8;
  color: #082f49;
}

.button-primary:hover {
  background: #7dd3fc;
}

.button-secondary {
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.55);
  color: #e2e8f0;
}

.button-secondary:hover {
  border-color: rgba(226, 232, 240, 0.34);
  background: rgba(30, 41, 59, 0.82);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.95rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  vertical-align: top;
}

.table th {
  color: #94a3b8;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table-link {
  color: #7dd3fc;
  font-weight: 700;
}

.table-link-danger {
  color: #fca5a5;
}

.table-actions {
  white-space: nowrap;
}

.table-actions form {
  display: inline-flex;
  margin: 0 0.35rem 0 0;
}

.history-action {
  min-width: 5.5rem;
  padding: 0.55rem 0.9rem;
}

.history-action-correct {
  border-color: rgba(34, 197, 94, 0.3);
  color: #86efac;
  background: rgba(20, 83, 45, 0.26);
}

.history-action-correct:hover {
  border-color: rgba(34, 197, 94, 0.48);
  background: rgba(21, 128, 61, 0.3);
}

.history-action-wrong {
  border-color: rgba(248, 113, 113, 0.3);
  color: #fca5a5;
  background: rgba(127, 29, 29, 0.24);
}

.history-action-wrong:hover {
  border-color: rgba(248, 113, 113, 0.48);
  background: rgba(153, 27, 27, 0.28);
}

.history-outcome-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
}

.history-outcome-badge-correct {
  background: rgba(34, 197, 94, 0.18);
  color: #bbf7d0;
}

.history-outcome-badge-wrong {
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
}

.history-outcome-badge-skipped {
  background: rgba(56, 189, 248, 0.18);
  color: #bae6fd;
}

.history-row-correct td {
  background: rgba(20, 83, 45, 0.08);
}

.history-row-wrong td {
  background: rgba(127, 29, 29, 0.08);
}

.history-row-skipped td {
  background: rgba(12, 74, 110, 0.08);
}

.word-form {
  display: grid;
  gap: 1rem;
}

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

.field-grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.field label {
  font-size: 0.95rem;
  font-weight: 700;
  color: #cbd5e1;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 0.9rem;
  padding: 0.85rem 0.95rem;
  background: rgba(2, 6, 23, 0.65);
  color: #f8fafc;
  font: inherit;
}

.field select {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 0.9rem;
  padding: 0.85rem 2.8rem 0.85rem 0.95rem;
  background:
    linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.96)),
    rgba(2, 6, 23, 0.65);
  color: #f8fafc;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.96)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%2394A3B8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 0.95rem center;
  background-size: auto, 0.95rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid rgba(56, 189, 248, 0.35);
  border-color: rgba(56, 189, 248, 0.45);
}

.word-root-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-end;
  gap: 1rem;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.filter-select {
  width: auto;
  min-width: 10rem;
}

.filter-actions {
  align-items: center;
}

.form-errors {
  border: 1px solid rgba(248, 113, 113, 0.3);
  background: rgba(127, 29, 29, 0.25);
  color: #fecaca;
  border-radius: 1rem;
  padding: 1rem 1.1rem;
}

.form-errors h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.form-errors ul {
  margin: 0;
  padding-left: 1.2rem;
}

.detail-card {
  display: grid;
  gap: 1.5rem;
}

.detail-block h2 {
  margin-top: 0;
}

.detail-block p {
  margin-bottom: 0;
  color: #cbd5e1;
}

.stat-card {
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 1rem;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.45);
}

.stat-label {
  display: block;
  color: #94a3b8;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.stat-value {
  font-size: 2rem;
}

.flash-stack {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 1rem 1rem 0;
}

.flash {
  width: min(100%, 72rem);
  margin: 0 auto;
  border-radius: 1rem;
  padding: 0.95rem 1.1rem;
  font-weight: 700;
}

.flash-notice {
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.32);
  color: #bbf7d0;
}

.flash-alert {
  background: rgba(248, 113, 113, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.32);
  color: #fecaca;
}

.shuffle-shell {
  width: min(100%, 72rem);
  margin: 0 auto;
  min-height: 100vh;
  padding: 2rem 1rem 3rem;
  display: flex;
  flex-direction: column;
}

.shuffle-topbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.shuffle-topbar h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
}

.shuffle-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.82);
  border-radius: 1.75rem;
  box-shadow: 0 20px 60px rgba(2, 6, 23, 0.45);
  padding: clamp(1.5rem, 4vw, 3rem);
  min-height: 70vh;
}

.shuffle-word-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.shuffle-label {
  margin: 0 0 1rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
  font-size: 0.8rem;
}

.shuffle-word {
  margin: 0;
  font-size: clamp(3rem, 8vw, 7rem);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: normal;
}

.shuffle-prompt {
  max-width: 52rem;
  margin: 0;
  font-size: clamp(1.2rem, 2.6vw, 2rem);
  line-height: 1.45;
  font-weight: 800;
}

.shuffle-prompt p {
  margin: 0;
}

.shuffle-definition {
  margin-top: 2.5rem;
}

.shuffle-definition-toggle {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  padding: 0.75rem 1rem;
  background: rgba(2, 6, 23, 0.56);
  color: #cbd5e1;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s ease;
}

.shuffle-definition-toggle::-webkit-details-marker {
  display: none;
}

.shuffle-definition-toggle:hover {
  border-color: rgba(226, 232, 240, 0.28);
  background: rgba(30, 41, 59, 0.88);
}

.shuffle-definition[open] .shuffle-definition-toggle {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.28);
  color: #bae6fd;
}

.shuffle-definition-body {
  margin-top: 1rem;
  max-width: 42rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  background: rgba(2, 6, 23, 0.45);
  color: #cbd5e1;
  text-align: left;
}

.shuffle-definition-body p {
  margin: 0;
}

.shuffle-answer-body {
  text-align: center;
}

.shuffle-answer-body strong {
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.05;
}

.shuffle-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 1rem;
}

.shuffle-actions form {
  margin: 0;
}

.shuffle-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 1.2rem;
  padding: 1rem 1.2rem;
  font-size: 1rem;
  font-weight: 800;
  background: rgba(2, 6, 23, 0.56);
  color: #e2e8f0;
  transition: 0.18s ease;
}

.shuffle-button:hover {
  border-color: rgba(226, 232, 240, 0.28);
  background: rgba(30, 41, 59, 0.88);
}

.shuffle-button-correct {
  color: #86efac;
}

.shuffle-button-wrong {
  color: #fca5a5;
}

.shuffle-button-skip {
  color: #7dd3fc;
}

.shuffle-stats {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  color: #94a3b8;
  font-size: 0.95rem;
}

.app-shell {
  min-height: 100vh;
}

.app-header {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.app-brand {
  color: #f8fafc;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.app-brand:hover {
  color: #7dd3fc;
}

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

.app-session-email {
  color: #94a3b8;
  font-size: 0.95rem;
}

.app-session-button {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.app-session-button:hover {
  background: rgba(30, 41, 59, 0.9);
}

.auth-shell {
  width: min(100%, 34rem);
  margin: 0 auto;
  padding: 4rem 1rem 5rem;
}

.auth-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.88);
  border-radius: 1.5rem;
  box-shadow: 0 20px 60px rgba(2, 6, 23, 0.45);
  padding: 2rem;
}

.auth-card h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 5vw, 2.6rem);
  line-height: 1;
}

.auth-submit {
  width: 100%;
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: #cbd5e1;
  font-weight: 600;
}

.checkbox-field input {
  width: auto;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.2rem;
  margin-top: 1.4rem;
  color: #94a3b8;
  font-size: 0.95rem;
}

.auth-links a {
  color: #7dd3fc;
  font-weight: 700;
}

.auth-links a:hover {
  color: #bae6fd;
}

@media (max-width: 700px) {
  .app-header,
  .app-session {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-shell {
    padding-top: 2.5rem;
  }

  .auth-card {
    padding: 1.4rem;
  }

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

  .field-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .table,
  .table thead,
  .table tbody,
  .table th,
  .table td,
  .table tr {
    display: block;
  }

  .table thead {
    display: none;
  }

  .table tr {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  }

  .table td {
    padding: 0.4rem 0;
    border-bottom: 0;
  }

  .shuffle-topbar {
    flex-direction: column;
  }

  .shuffle-actions {
    grid-template-columns: 1fr;
  }

  .shuffle-stats {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }
}
