:root {
  --navy: #071d35;
  --navy-2: #102b4f;
  --ink: #10233f;
  --muted: #647086;
  --white: #ffffff;
  --paper: #f8fbff;
  --line: rgba(16, 35, 63, 0.12);
  --yellow: #ffc84b;
  --orange: #ff8f3d;
  --pink: #ff4f92;
  --cyan: #14c8d7;
  --blue: #4d86f7;
  --green: #27c98b;
  --purple: #8b55d9;
  --shadow: 0 18px 44px rgba(16, 35, 63, 0.14);
  --shadow-strong: 0 26px 60px rgba(3, 13, 28, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Nunito", Arial, sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 79, 146, 0.18), transparent 25%),
    radial-gradient(circle at 92% 12%, rgba(20, 200, 215, 0.16), transparent 24%),
    linear-gradient(180deg, #f7fbff 0%, #ffffff 46%, #f6f8ff 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.app-shell {
  width: min(1480px, calc(100% - 36px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.topbar {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto auto auto;
  align-items: center;
  gap: 14px;
  min-height: 58px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--navy);
  text-decoration: none;
  text-transform: uppercase;
  font-family: "Baloo 2", "Nunito", Arial, sans-serif;
  font-size: clamp(1.6rem, 3.2vw, 2.55rem);
  font-weight: 700;
  letter-spacing: 0;
}

.brand b {
  color: transparent;
  background: linear-gradient(90deg, #22c8f2, #64d06c, #ffc84b, #ff6d74, #8b55d9);
  -webkit-background-clip: text;
  background-clip: text;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff4f92, #ffc84b);
  font-size: 1.45rem;
  box-shadow: 0 12px 24px rgba(255, 79, 146, 0.28);
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.main-nav button {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  color: #f6fbff;
  font-weight: 800;
  background: rgba(7, 29, 53, 0.86);
  box-shadow: 0 10px 26px rgba(16, 35, 63, 0.12);
}

.main-nav button:hover,
.main-nav button:focus-visible {
  background: #173d70;
}

.icon-button,
.stars-pill,
.primary-button,
.secondary-button,
.menu-card,
.emotion-card,
.level-button,
.memory-card,
.feature-card {
  border: 0;
  border-radius: 8px;
}

.icon-button {
  display: inline-grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: var(--white);
  font-size: 1.45rem;
  font-weight: 900;
  background: rgba(7, 29, 53, 0.92);
  box-shadow: var(--shadow);
}

.stars-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 74px;
  padding: 10px 14px;
  color: var(--navy);
  background: var(--yellow);
  box-shadow: var(--shadow);
  font-size: 1.12rem;
  font-weight: 900;
}

.top-logout {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--white);
  background: rgba(7, 29, 53, 0.9);
  box-shadow: var(--shadow);
  font-weight: 900;
  white-space: nowrap;
}

.top-logout:hover,
.top-logout:focus-visible {
  background: #173d70;
}

.screen {
  display: none;
  animation: liftIn 240ms ease both;
}

.screen.active {
  display: block;
}

.welcome-screen {
  margin-top: 18px;
}

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(450px, 1fr) minmax(280px, 338px);
  gap: 22px;
  min-height: 500px;
  padding: clamp(24px, 4vw, 44px);
  overflow: hidden;
  color: var(--white);
  background:
    linear-gradient(90deg, rgba(4, 16, 31, 0.98) 0%, rgba(4, 16, 31, 0.9) 29%, rgba(4, 16, 31, 0.35) 58%, rgba(4, 16, 31, 0.08) 100%),
    url("assets/hero-emocie.png?v=hero1") center right / cover no-repeat,
    #071d35;
  border-radius: 0 0 34px 34px;
  box-shadow: var(--shadow-strong);
}

.hero-panel::after {
  content: "";
  position: absolute;
  right: -8%;
  bottom: -120px;
  width: 70%;
  height: 230px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 50% 0 0 0;
  transform: rotate(-3deg);
}

.hero-copy,
.hero-scene,
.login-card {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 8px;
  color: #5d6b82;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow.light {
  color: #a8dfff;
}

.hero-copy {
  align-self: center;
  max-width: 610px;
}

.hero-copy h1,
.screen h2,
.parents-preview h2,
.login-card h2,
.parent-tips h3 {
  margin: 0;
  font-family: "Baloo 2", "Nunito", Arial, sans-serif;
  line-height: 1.03;
  letter-spacing: 0;
}

.hero-copy h1 {
  max-width: 660px;
  font-size: clamp(2.55rem, 5vw, 4.55rem);
}

.hero-copy h1 span {
  color: transparent;
  background: linear-gradient(90deg, #ff8f3d, #ffc84b);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-lead {
  margin: 18px 0 20px;
  color: #f6fbff;
  font-size: clamp(1.25rem, 2vw, 1.85rem);
  font-weight: 700;
}

.hero-points {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  gap: 12px 22px;
  max-width: 620px;
  margin-bottom: 28px;
  color: #f7fbff;
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  font-weight: 800;
}

.hero-points span:nth-child(odd) {
  color: #66f3d4;
}

.hero-points span:nth-child(even) {
  color: #ffe38a;
}

.hero-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 12px 20px;
  color: var(--white);
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 12px 25px rgba(16, 35, 63, 0.18);
}

.primary-button {
  background: linear-gradient(90deg, var(--pink), var(--orange), #ffbd4a);
}

.secondary-button {
  background: rgba(16, 35, 63, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.hero-link {
  display: inline-flex;
  align-items: center;
}

.play-dot {
  display: inline-grid;
  width: 28px;
  height: 28px;
  margin-right: 8px;
  place-items: center;
  color: var(--navy);
  background: var(--white);
  border-radius: 50%;
  font-size: 0.78rem;
}

.login-card {
  align-self: center;
  display: grid;
  gap: 10px;
  padding: 30px 22px 22px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  box-shadow: var(--shadow-strong);
}

.auth-card {
  min-width: 0;
}

.login-card h2 {
  text-align: center;
  font-size: 1.7rem;
}

.login-card p {
  margin: 2px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.92rem;
  font-weight: 800;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  background: #edf3fb;
  border-radius: 14px;
}

.auth-tabs button {
  border: 0;
  border-radius: 10px;
  padding: 9px 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.auth-tabs button.active {
  color: var(--white);
  background: linear-gradient(135deg, #173d70, #071d35);
  box-shadow: 0 8px 18px rgba(16, 35, 63, 0.16);
}

.game-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding: 6px;
  width: fit-content;
  max-width: 100%;
  background: #edf3fb;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.game-tabs button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.game-tabs button.active {
  color: var(--white);
  background: linear-gradient(135deg, #173d70, #071d35);
  box-shadow: 0 8px 18px rgba(16, 35, 63, 0.16);
}

.auth-panel {
  display: none;
  gap: 9px;
}

.auth-panel.active {
  display: grid;
}

.game-panel {
  display: none;
}

.game-panel.active {
  display: block;
}

.auth-message {
  min-height: 38px;
}

.auth-message.error {
  color: #b42318;
}

.lock-badge {
  position: absolute;
  top: -28px;
  left: 50%;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  transform: translateX(-50%);
  background: #2d9cff;
  border-radius: 18px;
  box-shadow: 0 14px 28px rgba(45, 156, 255, 0.35);
  font-size: 1.5rem;
}

label {
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 13px 15px;
  color: var(--ink);
  background: var(--white);
  outline: none;
  box-shadow: inset 0 0 0 1px var(--line), 0 8px 18px rgba(16, 35, 63, 0.07);
}

input:focus,
select:focus,
textarea:focus {
  border-color: #2d9cff;
}

textarea {
  resize: vertical;
}

.feature-strip {
  position: relative;
  margin: 22px 0 26px;
}

.feature-strip h2 {
  margin: 0 0 16px;
  text-align: center;
  font-size: clamp(2rem, 3.5vw, 3rem);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.feature-card {
  position: relative;
  display: grid;
  min-height: 152px;
  align-content: end;
  padding: 18px 18px;
  overflow: hidden;
  color: var(--white);
  text-align: left;
  background-position: center;
  background-size: cover;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.feature-card::after {
  content: "";
  position: absolute;
  inset: 42% 0 0;
  background: linear-gradient(180deg, transparent, rgba(3, 13, 28, 0.48));
}

.feature-card strong {
  position: relative;
  z-index: 1;
  font-size: clamp(1rem, 1.4vw, 1.22rem);
  text-shadow: 0 2px 9px rgba(3, 13, 28, 0.35);
}

.feature-emotions { background-image: url("assets/features/karticky-emocii.jpg?v=features1"); }
.feature-anger { background-image: url("assets/features/teplomer-hnevu.jpg?v=features1"); }
.feature-breathing { background-image: url("assets/features/dychanie.jpg?v=features1"); }
.feature-diary { background-image: url("assets/features/dennik-emocii.jpg?v=features1"); }
.feature-drawing { background-image: url("assets/features/kreslenie-pocitov.jpg?v=features1"); }
.feature-rewards { background-image: url("assets/features/odmeny-pokrok.jpg?v=features1"); }

.parents-preview {
  max-width: 760px;
  padding: 22px 4px 0;
}

.parents-preview h2 {
  max-width: 620px;
  font-size: clamp(1.8rem, 3vw, 2.45rem);
}

.parents-preview ul {
  display: grid;
  gap: 12px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink);
  font-size: 1.22rem;
  font-weight: 850;
}

.section-heading {
  margin: 30px 0 18px;
}

.section-heading h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.session-line {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 850;
}

.text-button {
  width: auto;
  margin-top: 10px;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--white);
  background: var(--navy);
  font-weight: 900;
}

.menu-grid,
.emotion-grid,
.badges-grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.menu-card {
  min-height: 172px;
  padding: 20px;
  color: var(--white);
  text-align: left;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.menu-card:hover,
.menu-card:focus-visible,
.emotion-card:hover,
.emotion-card:focus-visible,
.memory-card:hover,
.memory-card:focus-visible,
.feature-card:hover,
.feature-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 22px 38px rgba(16, 35, 63, 0.18);
}

.menu-card strong,
.menu-card small {
  display: block;
}

.menu-card strong {
  margin: 10px 0 4px;
  font-size: 1.28rem;
}

.menu-card small {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.98rem;
}

.menu-icon {
  font-size: 2.65rem;
}

.anger { background: linear-gradient(135deg, #ffbd4a, #ff6b35); }
.cards { background: linear-gradient(135deg, #ff7dbc, #ff2f75); }
.games { background: linear-gradient(135deg, #8d6cff, #4d86f7); }
.diary { background: linear-gradient(135deg, #5da4ff, #315fd5); }
.breath { background: linear-gradient(135deg, #56e4ea, #009bb2); }
.badges { background: linear-gradient(135deg, #64df8c, #06a974); }
.parent { background: linear-gradient(135deg, #253f6b, #0d203d); }

.thermometer,
.entries-list,
.parent-panel {
  display: grid;
  gap: 12px;
}

.level-button {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 13px 16px;
  color: var(--ink);
  text-align: left;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(16, 35, 63, 0.1);
}

.level-dot {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.result-box {
  margin: 16px 0 0;
  padding: 15px 17px;
  color: #344054;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(16, 35, 63, 0.06);
}

.emotion-card {
  display: grid;
  min-height: 0;
  padding: 8px;
  align-content: start;
  color: var(--ink);
  text-align: center;
  background: var(--white);
  border: 2px solid transparent;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.emotion-card img {
  display: block;
  width: 100%;
  aspect-ratio: 267 / 324;
  object-fit: cover;
  border-radius: 7px;
  box-shadow: 0 10px 20px rgba(16, 35, 63, 0.12);
}

.emotion-card span {
  display: block;
  margin-bottom: 8px;
  font-size: 3.2rem;
  filter: drop-shadow(0 8px 12px rgba(16, 35, 63, 0.14));
}

.emotion-card strong {
  font-family: "Baloo 2", "Nunito", Arial, sans-serif;
  margin-top: 9px;
  font-size: 1.15rem;
  line-height: 1;
}

.emotion-card small {
  display: block;
  margin-top: 8px;
  color: rgba(16, 35, 63, 0.78);
  font-weight: 900;
}

.emotion-card.selected {
  border-color: rgba(16, 35, 63, 0.34);
  transform: translateY(-3px);
}

.emotion-card.joy { background: linear-gradient(145deg, #fff4b8, #ffd46b); }
.emotion-card.sad { background: linear-gradient(145deg, #dcefff, #9fd0f4); }
.emotion-card.anger { background: linear-gradient(145deg, #ffd6c5, #ff8a64); }
.emotion-card.fear { background: linear-gradient(145deg, #eadcff, #c4a5eb); }
.emotion-card.calm { background: linear-gradient(145deg, #e6f8c4, #a9df8f); }
.emotion-card.love { background: linear-gradient(145deg, #ffe0e8, #ff9eb5); }
.emotion-card.surprise { background: linear-gradient(145deg, #d6fff4, #8bddce); }
.emotion-card.pride { background: linear-gradient(145deg, #ffecbd, #ffc66f); }
.emotion-card.shame { background: linear-gradient(145deg, #ffe0e7, #f5a3b3); }
.emotion-card.bored { background: linear-gradient(145deg, #e2f2ff, #a7d3f2); }
.emotion-card.gratitude { background: linear-gradient(145deg, #fff0b8, #ffd98a); }
.emotion-card.courage { background: linear-gradient(145deg, #eadcff, #b99bea); }

.emotion-detail {
  margin-top: 18px;
  padding: 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.emotion-card-viewer {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 14px;
  align-items: start;
}

.emotion-card-viewer figure {
  margin: 0;
  padding: 8px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(16, 35, 63, 0.08);
  border-radius: 14px;
  box-shadow: 0 12px 24px rgba(16, 35, 63, 0.1);
}

.emotion-card-viewer img {
  display: block;
  width: 100%;
  border-radius: 10px;
}

.emotion-card-viewer figcaption {
  margin-top: 7px;
  color: var(--muted);
  text-align: center;
  font-weight: 900;
}

.emotion-detail-front {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.detail-icon {
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 24px rgba(16, 35, 63, 0.12);
  font-size: 3.6rem;
}

.emotion-detail h3 {
  margin: 0;
  font-family: "Baloo 2", "Nunito", Arial, sans-serif;
  font-size: clamp(2rem, 4vw, 3rem);
}

.emotion-detail-front p:last-child {
  margin: 6px 0 0;
  font-size: 1.15rem;
  font-weight: 900;
}

.emotion-detail-back {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.emotion-detail-back section {
  min-height: 132px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px dashed rgba(16, 35, 63, 0.16);
  border-radius: 16px;
}

.emotion-detail-back h4 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 1.02rem;
}

.emotion-detail-back p,
.emotion-detail-back ul {
  margin: 0;
  color: #24344f;
  font-weight: 800;
}

.emotion-detail-back ul {
  padding-left: 18px;
}

.emotion-detail.joy { background: linear-gradient(145deg, #fff8d5, #fff0a8); }
.emotion-detail.sad { background: linear-gradient(145deg, #eff8ff, #d7ecff); }
.emotion-detail.anger { background: linear-gradient(145deg, #fff1ea, #ffd2c3); }
.emotion-detail.fear { background: linear-gradient(145deg, #f7f0ff, #e8ddff); }
.emotion-detail.calm { background: linear-gradient(145deg, #f2fbde, #def4c8); }
.emotion-detail.love { background: linear-gradient(145deg, #fff0f4, #ffd8e1); }
.emotion-detail.surprise { background: linear-gradient(145deg, #e9fff9, #cff5eb); }
.emotion-detail.pride { background: linear-gradient(145deg, #fff5de, #ffdf9f); }
.emotion-detail.shame { background: linear-gradient(145deg, #fff2f5, #ffdbe3); }
.emotion-detail.bored { background: linear-gradient(145deg, #f0f8ff, #d8ecfb); }
.emotion-detail.gratitude { background: linear-gradient(145deg, #fff8dd, #ffe5a8); }
.emotion-detail.courage { background: linear-gradient(145deg, #f3ecff, #e0d0ff); }

.game-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.game-status span,
.round-counter {
  margin: 0;
  padding: 9px 13px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(70px, 1fr));
  gap: 11px;
  max-width: 590px;
}

.memory-card {
  aspect-ratio: 1;
  min-width: 0;
  color: var(--ink);
  font-size: clamp(1.8rem, 8vw, 3rem);
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.memory-card.matched {
  background: linear-gradient(135deg, #eaffc9, #75df86);
}

.mini-game-card {
  display: grid;
  gap: 14px;
  max-width: 780px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.mini-game-card h3 {
  margin: 0;
  color: var(--navy);
  font-family: "Baloo 2", "Nunito", Arial, sans-serif;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  line-height: 1.08;
}

.game-kicker {
  margin: 0;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

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

.choice-button {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  color: var(--ink);
  text-align: left;
  background: #ffffff;
  box-shadow: 0 10px 20px rgba(16, 35, 63, 0.08);
}

.choice-button:hover,
.choice-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(16, 35, 63, 0.14);
}

.choice-button span {
  font-size: 2rem;
}

.choice-button strong {
  min-width: 0;
}

.choice-button small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
}

.mood-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mood-choice {
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
}

.snake-card {
  max-width: 620px;
  touch-action: manipulation;
}

.snake-board {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 3px;
  width: min(100%, 520px);
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 8px;
  background:
    linear-gradient(135deg, rgba(7, 29, 53, 0.96), rgba(16, 43, 79, 0.96)),
    #071d35;
  border: 3px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.snake-cell {
  display: grid;
  min-width: 0;
  place-items: center;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  font-size: clamp(0.7rem, 3.2vw, 1.25rem);
  line-height: 1;
}

.snake-body {
  background: linear-gradient(135deg, #43e2a9, #14c8d7);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.snake-head {
  background: linear-gradient(135deg, #ffc84b, #ff8f3d);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.62);
}

.snake-food {
  background: rgba(255, 255, 255, 0.92);
}

.snake-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(68px, 1fr));
  gap: 10px;
  width: min(100%, 360px);
  margin: 0 auto;
}

.snake-controls button {
  min-height: 62px;
  border: 0;
  border-radius: 16px;
  color: var(--white);
  background: linear-gradient(135deg, #173d70, #071d35);
  box-shadow: 0 12px 22px rgba(16, 35, 63, 0.18);
  font-size: 2rem;
  font-weight: 900;
}

.snake-controls button:active {
  transform: translateY(2px);
}

.snake-controls [data-snake-dir="up"] {
  grid-column: 2;
}

.snake-controls [data-snake-dir="left"] {
  grid-column: 1;
}

.snake-controls [data-snake-dir="down"] {
  grid-column: 2;
}

.snake-controls [data-snake-dir="right"] {
  grid-column: 3;
}

.sequence-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  min-height: 58px;
  align-items: center;
}

.sequence-dot {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 20px rgba(16, 35, 63, 0.08);
  font-size: 1.75rem;
  font-weight: 900;
}

.sequence-dot.hidden-dot {
  color: var(--white);
  background: linear-gradient(135deg, #173d70, #071d35);
}

.diary-form,
.pin-form {
  display: grid;
  max-width: 760px;
  gap: 11px;
  padding: 18px;
  text-align: left;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.entry-card,
.badge-card,
.stats-grid article,
.parent-tips {
  padding: 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 22px rgba(16, 35, 63, 0.07);
}

.entry-card strong,
.entry-card small {
  display: block;
}

.entry-card p {
  margin: 8px 0 0;
}

.breathing-stage {
  display: grid;
  min-height: 320px;
  place-items: center;
}

.breath-circle {
  display: grid;
  width: min(58vw, 270px);
  aspect-ratio: 1;
  place-items: center;
  padding: 18px;
  color: var(--ink);
  text-align: center;
  font-weight: 900;
  background: radial-gradient(circle, #ffffff 0 37%, #55dfe7 38% 100%);
  border-radius: 50%;
  box-shadow: 0 22px 42px rgba(16, 35, 63, 0.18);
  transition: transform 900ms ease-in-out, background 500ms ease;
}

.breath-circle.inhale {
  transform: scale(1.18);
  background: radial-gradient(circle, #ffffff 0 34%, #8fc7ff 35% 100%);
}

.breath-circle.hold {
  transform: scale(1.18);
  background: radial-gradient(circle, #ffffff 0 34%, var(--yellow) 35% 100%);
}

.breath-circle.exhale {
  transform: scale(0.88);
  background: radial-gradient(circle, #ffffff 0 34%, #55dfe7 35% 100%);
}

.badge-card {
  display: grid;
  position: relative;
  min-height: 190px;
  align-content: end;
  justify-items: center;
  gap: 8px;
  overflow: hidden;
  text-align: center;
}

.badge-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.95), transparent 22%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(238, 246, 255, 0.9));
  z-index: 0;
}

.badge-card > * {
  position: relative;
  z-index: 1;
}

.medal-ribbon {
  position: absolute;
  top: 18px;
  left: 50%;
  width: 74px;
  height: 78px;
  transform: translateX(-50%);
  background:
    linear-gradient(115deg, #ff4f92 0 48%, transparent 49%),
    linear-gradient(245deg, #4d86f7 0 48%, transparent 49%);
  clip-path: polygon(0 0, 100% 0, 82% 100%, 50% 72%, 18% 100%);
  filter: drop-shadow(0 10px 14px rgba(16, 35, 63, 0.16));
}

.badge-card .badge-icon {
  font-size: 1rem;
}

.medal {
  display: grid;
  width: 96px;
  height: 96px;
  margin-top: 54px;
  place-items: center;
  color: #ffffff;
  border-radius: 50%;
  border: 7px solid rgba(255, 255, 255, 0.76);
  box-shadow:
    inset 0 -12px 20px rgba(3, 13, 28, 0.18),
    inset 0 10px 20px rgba(255, 255, 255, 0.32),
    0 16px 28px rgba(16, 35, 63, 0.2);
  font-family: "Baloo 2", "Nunito", Arial, sans-serif;
  font-size: 1.75rem !important;
  font-weight: 900;
}

.medal::before {
  content: "";
  position: absolute;
  width: 62px;
  height: 62px;
  border: 2px solid rgba(255, 255, 255, 0.46);
  border-radius: 50%;
}

.medal.bronze {
  background: radial-gradient(circle at 32% 24%, #ffe4b7, #c57a35 52%, #8f4d22 100%);
}

.medal.silver {
  background: radial-gradient(circle at 32% 24%, #ffffff, #9fb3c8 56%, #61758c 100%);
}

.medal.gold {
  background: radial-gradient(circle at 32% 24%, #fff6b8, #ffc84b 54%, #ce7b10 100%);
}

.medal.diamond {
  background: radial-gradient(circle at 32% 24%, #e9ffff, #44c6e8 52%, #2d64d7 100%);
}

.badge-card strong {
  color: var(--navy);
  font-size: 1.12rem;
}

.badge-card small {
  color: var(--muted);
  font-weight: 900;
}

.badge-card.locked {
  filter: grayscale(1);
  opacity: 0.58;
}

.pin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.pin-error {
  min-height: 22px;
  margin: 0;
  color: #b42318;
  font-weight: 900;
}

.stats-grid article {
  text-align: center;
}

.stats-grid strong {
  display: block;
  color: var(--blue);
  font-size: 2.1rem;
}

.stats-grid span {
  color: var(--muted);
  font-weight: 900;
}

.parent-tips {
  max-width: 760px;
}

.parent-tips h3 {
  font-size: 1.55rem;
}

.parent-tips ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.hidden {
  display: none !important;
}

@keyframes liftIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: auto 1fr auto auto;
  }

  .main-nav {
    display: none;
  }

  .hero-panel {
    grid-template-columns: minmax(300px, 1fr) minmax(280px, 0.8fr);
    background-position: 68% center;
  }

  .login-card {
    grid-column: 1 / -1;
    max-width: 520px;
    justify-self: center;
  }

  .feature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

}

@media (max-width: 780px) {
  .app-shell {
    width: min(100% - 18px, 720px);
    padding-top: 12px;
  }

  .topbar {
    grid-template-columns: auto 1fr auto auto;
    gap: 9px;
  }

  .brand {
    font-size: 1.65rem;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .icon-button {
    width: 42px;
    height: 42px;
  }

  .stars-pill {
    min-width: 62px;
    padding: 8px 10px;
  }

  .hero-panel {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 22px;
    border-radius: 0 0 24px 24px;
  }

  .hero-points {
    grid-template-columns: 1fr;
  }

  .login-card {
    order: 2;
  }

  .feature-grid,
  .menu-grid,
  .emotion-grid,
  .badges-grid,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feature-card,
  .menu-card {
    min-height: 142px;
    padding: 15px;
  }

  .emotion-detail-front,
  .emotion-detail-back,
  .emotion-card-viewer {
    grid-template-columns: 1fr;
  }

  .detail-icon {
    width: 72px;
    height: 72px;
    font-size: 2.8rem;
  }

  .memory-grid {
    grid-template-columns: repeat(3, minmax(72px, 1fr));
  }

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

  .mood-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 12px, 520px);
  }

  .topbar {
    grid-template-columns: auto 1fr;
  }

  .stars-pill,
  .top-logout {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .brand {
    font-size: 1.42rem;
  }

  .hero-copy h1 {
    font-size: clamp(2.15rem, 12vw, 3.1rem);
  }

  .hero-actions {
    display: grid;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .hero-panel {
    background:
      linear-gradient(180deg, rgba(4, 16, 31, 0.92) 0%, rgba(4, 16, 31, 0.76) 56%, rgba(4, 16, 31, 0.48) 100%),
      url("assets/hero-emocie.png?v=hero1") 66% top / auto 58% no-repeat,
      #071d35;
    padding-top: 210px;
  }

  .feature-grid,
  .menu-grid,
  .emotion-grid,
  .badges-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

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

  .game-tabs {
    width: 100%;
  }

  .game-tabs button {
    flex: 1 1 100%;
  }

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

  .level-button {
    grid-template-columns: auto 1fr;
  }

  .level-button small {
    grid-column: 2;
  }

  .pin-row {
    grid-template-columns: 1fr;
  }
}
