:root {
  --bg: #fff7d6;
  --ink: #22304f;
  --muted: #65708b;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-solid: #ffffff;
  --pink: #ff6fb1;
  --orange: #ffb347;
  --yellow: #ffe66d;
  --green: #55d18f;
  --blue: #54b7ff;
  --purple: #a889ff;
  --red: #ff6b6b;
  --shadow: 0 22px 55px rgba(56, 67, 104, 0.18);
  --soft-shadow: 0 12px 30px rgba(56, 67, 104, 0.12);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 15%, rgba(255, 111, 177, 0.25), transparent 28%),
    radial-gradient(circle at 85% 12%, rgba(84, 183, 255, 0.25), transparent 24%),
    radial-gradient(circle at 65% 85%, rgba(85, 209, 143, 0.25), transparent 24%),
    linear-gradient(135deg, #fff7d6 0%, #e8f8ff 48%, #ffe8f4 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease;
}

button:hover {
  transform: translateY(-2px);
  filter: saturate(1.08);
}

button:active {
  transform: translateY(1px) scale(0.98);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.flash-card:focus-visible {
  outline: 4px solid rgba(84, 183, 255, 0.6);
  outline-offset: 3px;
}

.page-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  margin-bottom: 24px;
  padding: clamp(24px, 5vw, 44px);
  border: 6px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.64)),
    repeating-linear-gradient(45deg, rgba(255, 230, 109, 0.35) 0 12px, transparent 12px 24px);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -45px;
  width: 190px;
  height: 190px;
  border-radius: 45% 55% 52% 48%;
  background: rgba(168, 137, 255, 0.22);
}

.eyebrow {
  margin: 0 0 8px;
  color: #de4b95;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Baloo 2", "Nunito", system-ui, sans-serif;
  line-height: 0.96;
}

h1 {
  max-width: 740px;
  font-size: clamp(3rem, 10vw, 6.8rem);
  letter-spacing: -0.05em;
}

.hero-copy {
  max-width: 680px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.24rem);
  line-height: 1.55;
}

.hero-badge {
  display: grid;
  place-items: center;
  width: clamp(116px, 18vw, 174px);
  aspect-ratio: 1;
  border-radius: 40% 60% 42% 58%;
  color: #ffffff;
  background: linear-gradient(145deg, var(--pink), var(--purple));
  box-shadow: var(--soft-shadow);
  transform: rotate(6deg);
  z-index: 1;
}

.hero-badge span {
  display: block;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  font-weight: 900;
}

.hero-badge strong {
  color: var(--yellow);
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 0.8;
}

.practice-layout {
  display: grid;
  grid-template-columns: minmax(230px, 310px) minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
}

.panel {
  border: 4px solid rgba(255, 255, 255, 0.86);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(14px);
}

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px;
}

.controls-panel h2,
.add-word-panel h2,
.word-bank-panel h2 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
}

label {
  display: grid;
  gap: 7px;
  color: #405071;
  font-weight: 900;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 3px solid rgba(84, 183, 255, 0.25);
  border-radius: 16px;
  color: var(--ink);
  background: #ffffff;
  padding: 10px 14px;
  box-shadow: inset 0 2px 0 rgba(34, 48, 79, 0.04);
}

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.primary-button,
.secondary-button,
.success-button,
.warning-button,
.round-button {
  min-height: 48px;
  border-radius: 999px;
  font-weight: 900;
}

.primary-button {
  color: #ffffff;
  background: linear-gradient(135deg, #3da4ff, #8b72ff);
  box-shadow: 0 10px 22px rgba(84, 130, 255, 0.3);
}

.secondary-button {
  color: #35415f;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(56, 67, 104, 0.1);
}

.danger-soft {
  color: #b54444;
  background: #fff0f0;
}

.helper-note {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.35;
}

.hidden {
  display: none !important;
}

.success-button {
  color: #0d6639;
  background: linear-gradient(135deg, #b9f7d0, #55d18f);
  box-shadow: 0 10px 22px rgba(85, 209, 143, 0.28);
}

.warning-button {
  color: #704100;
  background: linear-gradient(135deg, #ffe99a, #ffb347);
  box-shadow: 0 10px 22px rgba(255, 179, 71, 0.25);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: auto;
}

.stats div {
  padding: 12px 6px;
  border-radius: 18px;
  text-align: center;
  background: rgba(255, 255, 255, 0.72);
}

.stats span {
  display: block;
  font-size: 1.55rem;
  font-weight: 900;
}

.stats small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.card-zone {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.mobile-hint {
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.flash-card {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: clamp(430px, 62vh, 660px);
  padding: clamp(24px, 5vw, 52px);
  border: 9px solid #ffffff;
  border-radius: clamp(30px, 6vw, 56px);
  text-align: center;
  touch-action: pan-y;
  user-select: none;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.8), transparent 15%),
    linear-gradient(145deg, var(--card-a, #ff83be), var(--card-b, #54b7ff));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.flash-card::before,
.flash-card::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  opacity: 0.28;
  pointer-events: none;
}

.flash-card::before {
  width: 210px;
  height: 210px;
  left: -84px;
  top: -64px;
  background: #ffffff;
}

.flash-card::after {
  width: 260px;
  height: 260px;
  right: -105px;
  bottom: -90px;
  background: var(--yellow);
}

.flash-card.swipe-left {
  animation: swipeLeft 260ms ease;
}

.flash-card.swipe-right {
  animation: swipeRight 260ms ease;
}

.card-ribbon {
  position: absolute;
  top: 22px;
  left: 22px;
  z-index: 1;
  padding: 9px 15px;
  border-radius: 999px;
  color: #22304f;
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.86rem;
  font-weight: 900;
  text-transform: capitalize;
}

.picture-frame {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: min(56vw, 250px);
  max-width: 100%;
  aspect-ratio: 1;
  margin-bottom: 14px;
  border: 7px solid rgba(255, 255, 255, 0.8);
  border-radius: 34% 66% 45% 55%;
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.9), transparent 18%),
    rgba(255, 255, 255, 0.42);
  box-shadow: 0 16px 32px rgba(34, 48, 79, 0.16);
  font-size: clamp(4.8rem, 18vw, 9.5rem);
  line-height: 1;
}

.picture-frame img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.letter-picture {
  display: grid;
  gap: 4px;
  color: #ffffff;
  text-shadow: 0 5px 18px rgba(34, 48, 79, 0.28);
}

.letter-picture strong {
  font-family: "Baloo 2", "Nunito", system-ui, sans-serif;
  font-size: clamp(5rem, 17vw, 10rem);
  line-height: 0.78;
}

.letter-picture small {
  max-width: 180px;
  font-size: clamp(0.8rem, 2vw, 1rem);
  font-weight: 900;
}

.picture-hint {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0;
  color: rgba(255, 255, 255, 0.94);
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  font-weight: 900;
  text-shadow: 0 2px 8px rgba(34, 48, 79, 0.18);
}

#wordText {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  color: #ffffff;
  font-size: clamp(4rem, 17vw, 11rem);
  letter-spacing: -0.04em;
  text-shadow: 0 10px 24px rgba(34, 48, 79, 0.2);
  overflow-wrap: anywhere;
}

.progress-line {
  position: relative;
  z-index: 1;
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 900;
}

.card-actions,
.status-actions,
.picture-actions {
  display: grid;
  grid-template-columns: auto minmax(170px, 260px) auto;
  justify-content: center;
  gap: 12px;
}

.status-actions,
.picture-actions {
  grid-template-columns: minmax(145px, 220px) minmax(145px, 220px);
}

.picture-actions {
  margin-top: 2px;
}

.picture-message {
  min-height: 1.35em;
  margin: -4px 0 0;
  color: var(--muted);
  text-align: center;
  font-weight: 900;
}

.round-button {
  width: 54px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--pink), var(--orange));
  box-shadow: 0 10px 22px rgba(255, 111, 177, 0.25);
  font-size: 2.4rem;
  line-height: 0;
}

.add-word-panel,
.word-bank-panel,
.auth-panel,
.admin-panel {
  margin-top: 22px;
  padding: 24px;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.2fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 22px;
}

.auth-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.auth-buttons {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.admin-panel {
  margin-bottom: 22px;
}

.admin-users {
  display: grid;
  gap: 14px;
}

.admin-user-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 8px 18px rgba(56, 67, 104, 0.08);
}

.admin-user-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.admin-user-heading h3 {
  font-size: 1.6rem;
}

.admin-meta {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.admin-word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-data {
  max-height: 260px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 12px;
  border-radius: 14px;
  color: #25324f;
  background: #f6f8ff;
  font-size: 0.82rem;
  white-space: pre-wrap;
}

.reset-password-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 10px;
}

.add-word-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.2fr);
  gap: 20px;
  align-items: start;
}

.add-word-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.add-word-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.add-word-form label:first-child {
  grid-column: 1 / -1;
}

.add-word-form button {
  align-self: end;
}

.form-message {
  grid-column: 1 / -1;
  min-height: 1.4em;
  margin: 0;
  color: #0d6639;
  font-weight: 900;
}

.word-bank-heading {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-height: 330px;
  overflow: auto;
  padding-right: 6px;
}

.word-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  border-radius: 999px;
  padding: 8px 13px;
  color: #3a4564;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(56, 67, 104, 0.08);
  font-weight: 900;
}

.word-pill.known {
  color: #0d6639;
  background: #e8fff0;
}

.word-pill.practice {
  color: #704100;
  background: #fff5cf;
}

.word-pill button {
  min-width: 26px;
  min-height: 26px;
  border-radius: 999px;
  color: inherit;
  background: rgba(255, 255, 255, 0.78);
  font-weight: 900;
}

.empty-state {
  width: 100%;
  margin: 0;
  padding: 22px;
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
  font-weight: 900;
}

@keyframes swipeLeft {
  50% {
    transform: translateX(-28px) rotate(-2deg);
  }
}

@keyframes swipeRight {
  50% {
    transform: translateX(28px) rotate(2deg);
  }
}

@media (max-width: 860px) {
  .hero,
  .practice-layout,
  .add-word-panel,
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .hero-badge {
    justify-self: start;
  }

  .controls-panel {
    order: 2;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 18px, 1180px);
    padding-top: 10px;
  }

  .hero {
    padding: 22px;
    border-radius: 26px;
  }

  .panel {
    border-radius: 22px;
  }

  .controls-panel,
  .add-word-panel,
  .word-bank-panel {
    padding: 18px;
  }

  .button-grid,
  .stats,
  .add-word-form,
  .auth-form,
  .auth-buttons,
  .card-actions,
  .status-actions,
  .picture-actions,
  .reset-password-form {
    grid-template-columns: 1fr;
  }

  .card-actions {
    grid-template-columns: 54px 1fr 54px;
  }

  .flash-card {
    min-height: min(72vh, 560px);
    padding: 24px 16px;
  }

  .picture-frame {
    width: min(62vw, 215px);
  }

  .word-bank-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
