:root {
  color-scheme: dark;
  --bg: #202030;
  --panel: rgba(176, 224, 240, .10);
  --panel-strong: rgba(176, 224, 240, .17);
  --line: rgba(208, 224, 160, .18);
  --text: #f7fff0;
  --muted: #b0e0f0;
  --mint: #66f071;
  --lime: #d0e0a0;
  --rose: #f07050;
  --amber: #ffb75c;
  --cyan: #20b0a0;
  --violet: #502090;
  --blue: #4070b0;
  --leaf-dark: #105040;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 35% 4%, rgba(102, 240, 113, .26), transparent 28%),
    radial-gradient(circle at 78% 24%, rgba(240, 112, 80, .18), transparent 26%),
    radial-gradient(circle at 14% 72%, rgba(80, 32, 144, .28), transparent 34%),
    linear-gradient(160deg, #202030 0%, #172942 48%, #101b28 100%);
}
button, input, select {
  font: inherit;
}
button {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
input, select {
  width: 100%;
  color: var(--text);
  background: rgba(255, 255, 255, .09);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 15px;
  outline: none;
}
input:focus, select:focus { border-color: rgba(126, 240, 161, .65); }
.hidden { display: none !important; }
.phone-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(96px, env(safe-area-inset-bottom));
}
.auth-view, .ideas-view, .game-view {
  min-height: 100vh;
  display: grid;
  gap: 18px;
}
.auth-view { align-content: center; }
.ideas-view, .game-view { align-content: start; }
.brand-pop {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(102,240,113,.35), rgba(32,176,160,.18));
  box-shadow: 0 0 38px rgba(102, 240, 113, .30), 0 24px 70px rgba(0, 0, 0, .35);
}
.brand-pop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 56px; letter-spacing: 0; }
h2 { font-size: 28px; letter-spacing: 0; }
h3 { font-size: 22px; }
.subtle, .eyebrow { color: var(--muted); }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.private-access {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}
.glass-form, .compact-grid, .modal-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.08);
  backdrop-filter: blur(24px);
}
label span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 6px 4px;
}
.primary-btn {
  min-height: 50px;
  color: #08120b;
  background: linear-gradient(135deg, var(--mint), var(--lime));
  border-radius: 16px;
  font-weight: 850;
  box-shadow: 0 14px 34px rgba(126, 240, 161, .22);
}
.ghost-btn, .text-btn {
  min-height: 46px;
  color: var(--text);
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.text-btn {
  padding: 0 14px;
  min-height: 40px;
}
.auth-actions, .two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.screen-title {
  flex: 1;
  padding: 0 12px;
  text-align: center;
}
.icon-btn {
  width: 44px;
  height: 44px;
  color: var(--text);
  border-radius: 50%;
  background: rgba(255,255,255,.10);
}
.hero-meter {
  position: relative;
  min-height: 190px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 22px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(102,240,113,.18), rgba(32,176,160,.16)),
    rgba(176,224,240,.08);
  box-shadow: 0 26px 80px rgba(0, 0, 0, .32);
}
.hero-meter span, .quick-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}
.hero-meter strong {
  display: block;
  margin-top: 4px;
  font-size: 52px;
  letter-spacing: 0;
}
#sparkline {
  position: absolute;
  right: -24px;
  top: 18px;
  opacity: .85;
}
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 14px 0;
}
.quick-grid article:nth-child(3):last-child {
  grid-column: 1 / -1;
}
.quick-grid article {
  min-height: 94px;
  padding: 16px;
  border-radius: 22px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
}
.quick-grid strong {
  display: block;
  margin-top: 10px;
  font-size: 25px;
}
.insight-pill {
  padding: 14px 16px;
  color: #071109;
  background: linear-gradient(135deg, var(--amber), var(--rose));
  border-radius: 18px;
  font-weight: 800;
}
.module-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
  padding-bottom: 82px;
}
.module-card {
  min-height: 86px;
  display: grid;
  place-items: center;
  gap: 7px;
  color: var(--text);
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
  border-radius: 22px;
  font-weight: 850;
}
.module-card i {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(255,255,255,.12);
  font-style: normal;
  font-size: 22px;
}
.module-card span {
  font-size: 12px;
}
.module-card[data-module="memory"]:last-child:nth-child(3n + 2) {
  grid-column: 3;
}
.method-list, .stack-list, .timeline {
  display: grid;
  gap: 10px;
}
.method-row, .stack-row, .timeline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.07);
}
.method-row i, .stack-row i, .timeline-row i {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 15px;
  background: rgba(255,255,255,.11);
  font-style: normal;
  font-size: 22px;
}
.row-main { flex: 1; min-width: 0; }
.row-main b, .row-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-main small, .row-side { color: var(--muted); font-size: 12px; }
.row-side {
  text-align: right;
  font-weight: 800;
}
.action-row {
  padding: 0;
  overflow: hidden;
}
.row-button {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--text);
  background: transparent;
  padding: 14px 14px 14px 0;
  text-align: left;
}
.consume-fab {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: 68px;
  height: 68px;
  color: #071109;
  background: linear-gradient(135deg, var(--mint), var(--lime));
  border-radius: 50%;
  font-size: 36px;
  font-weight: 900;
  box-shadow: 0 18px 48px rgba(126, 240, 161, .34);
}
dialog {
  width: min(92vw, 390px);
  max-height: min(86vh, 760px);
  padding: 0;
  border: 0;
  background: transparent;
}
dialog::backdrop { background: rgba(0,0,0,.62); backdrop-filter: blur(6px); }
.modal-card {
  max-height: min(86vh, 760px);
  overflow: auto;
  background: rgba(32, 32, 48, .96);
  border-radius: 28px;
}
.module-modal-card {
  gap: 14px;
}
.module-add {
  min-height: 46px;
}
.balance-filter {
  display: grid;
  grid-template-columns: 1fr 1fr 58px;
  gap: 8px;
}
.balance-filter input {
  min-width: 0;
  padding: 12px 10px;
  font-size: 13px;
}
.balance-filter button {
  color: #08120b;
  background: var(--mint);
  border-radius: 14px;
  font-weight: 900;
}
.balance-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.balance-grid article {
  min-height: 82px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.08);
}
.balance-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.balance-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}
.balance-note {
  padding: 12px 14px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.06);
  font-size: 13px;
  font-weight: 750;
}
.active-filter button {
  width: 100%;
  min-height: 42px;
  color: #071109;
  background: var(--lime);
  border-radius: 16px;
  font-weight: 900;
}
.category-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.category-rail::-webkit-scrollbar { display: none; }
.category-rail button, .tag-filter-btn {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 13px;
  color: var(--text);
  background: rgba(255,255,255,.09);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 850;
}
.category-rail button.active, .tag-filter-btn {
  color: #071109;
  background: var(--mint);
}
.tag-filter-btn {
  width: fit-content;
}
.challenge-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.challenge-card {
  min-height: 62px;
  padding: 9px 10px;
  color: #071109;
  background: linear-gradient(135deg, var(--cyan), var(--mint));
  border-radius: 14px;
  text-align: left;
  font-size: 11px;
  line-height: 1.25;
  font-weight: 750;
}
.ideas-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 11px;
}
.idea-card {
  overflow: hidden;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.08);
}
.idea-card img {
  width: 100%;
  max-height: 150px;
  object-fit: cover;
  display: block;
}
.idea-card > div {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 13px;
}
.idea-tag {
  width: fit-content;
  padding: 5px 8px;
  color: #08120b;
  background: var(--lime);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
}
.idea-body {
  color: var(--text);
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  font-size: 13px;
  line-height: 1.4;
}
.idea-body ul, .idea-body ol {
  margin: 6px 0 0 15px;
  padding: 0;
}
.idea-card small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}
.card-tags, .tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.card-tags button, .tag-chips button {
  width: fit-content;
  min-height: 24px;
  padding: 0 8px;
  color: var(--text);
  background: rgba(255,255,255,.10);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 850;
}
.idea-form {
  gap: 11px;
}
.tag-editor {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.06);
}
.tag-editor input {
  min-height: 40px;
  padding: 10px 12px;
}
.editor-toolbar {
  display: flex;
  gap: 8px;
}
.editor-toolbar button {
  width: 44px;
  height: 38px;
  color: var(--text);
  background: rgba(255,255,255,.10);
  border: 1px solid var(--line);
  border-radius: 13px;
  font-weight: 900;
}
.native-file {
  display: none;
}
.photo-choice button {
  min-height: 52px;
  color: var(--text);
  background: rgba(255,255,255,.10);
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: left;
  padding: 0 15px;
  font-weight: 850;
}
.tag-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-filter-options button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--text);
  background: rgba(255,255,255,.10);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 850;
}
.tag-filter-options button.active {
  color: #071109;
  background: var(--mint);
}
.idea-editor {
  min-height: 150px;
  max-height: 280px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.08);
  line-height: 1.45;
  outline: none;
}
.idea-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}
.idea-photo-preview {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
}
.game-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.game-stats article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.08);
}
.game-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.game-stats strong {
  display: block;
  margin-top: 7px;
  font-size: 28px;
}
#gameCanvas {
  width: 100%;
  max-width: 300px;
  height: auto;
  justify-self: center;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(126,240,161,.16), transparent 36%),
    rgba(3, 8, 6, .72);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .30);
}
.game-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}
.game-controls button {
  min-height: 54px;
  color: #071109;
  background: linear-gradient(135deg, var(--mint), var(--lime));
  border-radius: 18px;
  font-size: 22px;
  font-weight: 900;
}
.quiz-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    linear-gradient(145deg, rgba(120,216,255,.12), rgba(255,196,95,.10)),
    rgba(255,255,255,.08);
}
.quiz-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.quiz-progress {
  width: fit-content;
  padding: 7px 10px;
  color: #071109;
  background: var(--cyan);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}
.quiz-timer {
  min-width: 58px;
  padding: 7px 10px;
  color: #071109;
  background: var(--amber);
  border-radius: 999px;
  text-align: center;
  font-size: 12px;
  font-weight: 950;
}
.quiz-timer.danger {
  background: var(--rose);
}
.quiz-notice {
  padding: 11px 12px;
  color: #071109;
  background: linear-gradient(135deg, var(--amber), var(--lime));
  border-radius: 16px;
  font-size: 12px;
  font-weight: 900;
}
.quiz-options {
  display: grid;
  gap: 9px;
}
.quiz-options button {
  min-height: 52px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255,255,255,.09);
  border: 1px solid var(--line);
  border-radius: 17px;
  text-align: left;
  font-weight: 850;
}
.quiz-options button.correct {
  color: #071109;
  background: var(--mint);
}
.quiz-options button.wrong {
  color: #071109;
  background: var(--rose);
}
.quiz-feedback {
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.memory-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    radial-gradient(circle at 12% 0%, rgba(255,196,95,.15), transparent 38%),
    rgba(255,255,255,.08);
}
.memory-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}
.memory-card {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: var(--text);
  background:
    linear-gradient(145deg, rgba(126,240,161,.16), rgba(120,216,255,.10)),
    rgba(255,255,255,.09);
  border: 1px solid var(--line);
  border-radius: 18px;
  font-size: 27px;
  font-weight: 950;
  transition: transform .18s ease, background .18s ease;
}
.memory-card.flipped,
.memory-card.matched {
  color: #071109;
  background: var(--mint);
  transform: rotateY(180deg);
}
.memory-card.matched {
  background: linear-gradient(135deg, var(--lime), var(--cyan));
}
.memory-card.wrong {
  background: var(--rose);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.consume-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.consume-choice {
  min-height: 86px;
  color: var(--text);
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-weight: 850;
}
.consume-choice.active {
  color: #071109;
  background: var(--mint);
}
.toast {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 104px;
  max-width: 394px;
  margin: 0 auto;
  padding: 15px 16px;
  color: #071109;
  background: var(--mint);
  border-radius: 18px;
  font-weight: 900;
  text-align: center;
  animation: pop .26s ease;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pop {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
