:root {
  color-scheme: light;
  --ink: #17232b;
  --muted: #62717a;
  --line: #d7e2de;
  --panel: #ffffff;
  --surface: #f6faf8;
  --teal: #007f75;
  --teal-dark: #00655d;
  --blue: #2d6fbd;
  --coral: #d95f48;
  --gold: #d89a21;
  --shadow: 0 18px 50px rgba(23, 35, 43, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(0, 127, 117, 0.12), transparent 38%),
    linear-gradient(315deg, rgba(217, 95, 72, 0.12), transparent 35%),
    var(--surface);
}

button,
input {
  font: inherit;
}

button,
.start-link {
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

button:hover,
.start-link:hover {
  background: var(--teal-dark);
  box-shadow: 0 10px 24px rgba(0, 127, 117, 0.22);
  transform: translateY(-1px);
}

.games-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 48px 0;
}

.login-view {
  min-height: calc(100vh - 96px);
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(430px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.brand-mark {
  position: relative;
  width: 52px;
  height: 52px;
}

.brand-mark span {
  position: absolute;
  width: 38px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
  box-shadow: 0 8px 18px rgba(23, 35, 43, 0.08);
}

.brand-mark span:nth-child(1) {
  left: 0;
  top: 6px;
  rotate: -9deg;
  background: #f9e6df;
}

.brand-mark span:nth-child(2) {
  left: 8px;
  top: 2px;
  rotate: 4deg;
  background: #edf6ff;
}

.brand-mark span:nth-child(3) {
  left: 14px;
  top: 0;
  background: #fffdf8;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 6vw, 3.1rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label:not(.remember-row) {
  color: #31444f;
  font-size: 0.9rem;
  font-weight: 800;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid #cbd9d4;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.login-form input:focus {
  outline: 3px solid rgba(45, 111, 189, 0.18);
  border-color: var(--blue);
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.login-form button {
  min-height: 50px;
  padding: 0 18px;
}

#loginMessage {
  min-height: 22px;
  color: #a33b2e;
  font-size: 0.9rem;
  font-weight: 700;
}

.dashboard-view {
  display: grid;
  gap: 28px;
}

.is-hidden {
  display: none;
}

.dashboard-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 0 6px;
}

.profile-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

#playerBadge {
  min-width: 0;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

#logoutButton {
  min-height: 40px;
  padding: 0 14px;
  background: #e9f1ee;
  color: var(--ink);
}

#logoutButton:hover {
  background: #dfeae6;
  box-shadow: none;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.game-card {
  min-height: 360px;
  display: grid;
  grid-template-rows: 168px 1fr auto;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 32px rgba(23, 35, 43, 0.08);
}

.game-art {
  border-radius: 8px;
  overflow: hidden;
  background: #f5f8f7;
}

.flashcard-art {
  position: relative;
  background:
    linear-gradient(90deg, rgba(0, 127, 117, 0.12) 0 18%, transparent 18%),
    #fffdf8;
}

.flashcard-art span {
  position: absolute;
  width: 46%;
  height: 44%;
  border: 1px solid #d9ddd8;
  border-radius: 6px;
  background: #fffefa;
  box-shadow: 0 10px 20px rgba(23, 35, 43, 0.08);
}

.flashcard-art span:nth-child(1) {
  left: 20px;
  top: 26px;
}

.flashcard-art span:nth-child(2) {
  right: 20px;
  top: 46px;
}

.flashcard-art span:nth-child(3) {
  left: 52px;
  bottom: 22px;
}

.math-art,
.word-art {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  justify-items: center;
  font-size: 3.4rem;
  font-weight: 900;
}

.math-art span:nth-child(1) {
  color: var(--teal);
}

.math-art span:nth-child(2) {
  color: var(--coral);
}

.math-art span:nth-child(3),
.word-art span:nth-child(2) {
  color: var(--gold);
}

.word-art span:nth-child(1) {
  color: var(--blue);
}

.word-art span:nth-child(3) {
  color: var(--teal);
}

.game-copy h2 {
  margin-bottom: 8px;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.game-copy p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.start-link,
.soon-pill {
  justify-self: start;
  min-width: 96px;
  padding: 12px 18px;
  text-align: center;
}

.soon-pill {
  border-radius: 8px;
  background: #edf2f0;
  color: #66777f;
  font-weight: 900;
}

@media (max-width: 860px) {
  .games-shell {
    width: min(100% - 24px, 620px);
    padding: 24px 0;
  }

  .dashboard-header {
    align-items: start;
    flex-direction: column;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .game-card {
    min-height: 320px;
  }
}

@media (max-width: 480px) {
  .login-panel {
    padding: 24px;
  }

  .brand-row {
    align-items: start;
  }

  .profile-actions {
    width: 100%;
    justify-content: space-between;
  }
}
