:root {
  --bg: #f4f2f8;
  --panel: #ffffff;
  --side: #f7f6fb;
  --ink: #141418;
  --muted: #8b8a96;
  --line: #eceaf3;
  --lavender: #a78bfa;
  --lavender-2: #c4b5fd;
  --lavender-soft: #efe9ff;
  --black: #111113;
  --danger: #dc4b4b;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(40, 30, 70, 0.08);
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  background:
    radial-gradient(900px 420px at 80% -10%, rgba(167, 139, 250, 0.28), transparent 55%),
    radial-gradient(700px 380px at 0% 110%, rgba(196, 181, 253, 0.22), transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; letter-spacing: -0.03em; }

.login { min-height: 100%; display: grid; place-items: center; padding: 2rem; }
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 2.2rem 2rem;
  box-shadow: var(--shadow);
}
.brand-mark { width: 40px; height: 40px; border-radius: 12px; }
.login h1 { margin: 1rem 0 .35rem; font-size: 1.8rem; }
.login p { color: var(--muted); margin: 0 0 1.3rem; }
.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.field span { font-size: .75rem; color: var(--muted); font-weight: 600; }
.field input, .field textarea, .field select {
  background: var(--side);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .75rem .9rem;
  outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--lavender); background: #fff; }
.btn {
  border: 0;
  border-radius: 14px;
  padding: .75rem 1.1rem;
  background: var(--black);
  color: #fff;
  font-weight: 600;
}
.btn:disabled { opacity: .45; cursor: wait; }
.btn-ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-lavender { background: var(--lavender-soft); color: #5b3fd6; }
.err { color: var(--danger); font-size: .9rem; }
.muted { color: var(--muted); }

.app-frame {
  height: 100%;
  padding: 14px;
}
.shell {
  height: 100%;
  display: grid;
  grid-template-columns: 268px 1fr;
  background: var(--panel);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.7);
}
.side {
  background: var(--side);
  padding: 1.1rem .9rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  border-right: 1px solid var(--line);
}
.side-brand { display: flex; align-items: center; gap: .65rem; padding: .15rem .25rem; }
.side-brand strong { font-size: 1.15rem; }
.btn-new {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
}
.search {
  display: flex;
  align-items: center;
  gap: .45rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .55rem .7rem;
  color: var(--muted);
}
.search input { border: 0; outline: 0; background: transparent; width: 100%; }
.search kbd {
  font-size: .68rem;
  background: var(--side);
  border-radius: 6px;
  padding: .1rem .35rem;
}
.nav { display: flex; flex-direction: column; gap: .15rem; }
.nav button {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 12px;
  padding: .55rem .65rem;
  color: #5c5b66;
}
.nav button.active, .nav button:hover { background: #fff; color: var(--ink); }
.nav svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.hist { flex: 1; min-height: 0; overflow: auto; }
.hist-label {
  font-size: .7rem;
  color: var(--muted);
  font-weight: 600;
  padding: .55rem .4rem .25rem;
}
.hist button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #5c5b66;
  padding: .4rem .5rem;
  border-radius: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: .86rem;
}
.hist button:hover, .hist button.active { background: #fff; color: var(--ink); }
.user-card {
  display: flex;
  align-items: center;
  gap: .65rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: .55rem .6rem;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #c4b5fd, #8b5cf6);
}
.user-card small { display: block; color: var(--muted); font-size: .72rem; }
.user-card .out { margin-left: auto; border: 0; background: transparent; color: var(--muted); padding: .3rem; }

.main { display: flex; flex-direction: column; min-width: 0; background: #fff; }
.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: .95rem 1.3rem;
}
.brand-mini { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.brand-mini img { width: 22px; height: 22px; border-radius: 6px; }
.top-actions { display: flex; align-items: center; gap: .5rem; }
.chip {
  font-size: .78rem;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: .4rem .7rem;
  border-radius: 999px;
  background: #fff;
}

.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem 1.4rem;
  text-align: center;
}
.hello { color: var(--lavender); font-weight: 600; margin-bottom: .25rem; }
.hello em { font-style: normal; background: linear-gradient(90deg, #8b5cf6, #c4b5fd); -webkit-background-clip: text; color: transparent; }
.hero h1 { font-size: 2rem; font-weight: 700; margin-bottom: 1.4rem; }

.ask {
  width: min(720px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(40, 30, 70, 0.05);
  text-align: left;
  overflow: hidden;
}
.ask textarea {
  width: 100%;
  border: 0;
  resize: none;
  outline: 0;
  min-height: 72px;
  padding: 1rem 1.1rem .4rem;
}
.ask-tools {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: 0 1rem .75rem;
}
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px;
  border: 0; background: transparent; color: #6b6a75;
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--side); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.mic {
  width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: var(--lavender); color: #fff;
  display: grid; place-items: center; margin-left: auto;
}
.ask-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: .65rem 1rem;
  color: var(--muted);
  font-size: .85rem;
}
.ask-attach {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
}
.ask-attach:hover { color: var(--ink); }
.suggests {
  width: min(720px, 100%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .7rem;
  margin-top: 1rem;
}
.suggest {
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: .85rem .9rem;
}
.suggest-ico {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--lavender);
}
.suggest-ico svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.suggest strong { display: block; margin: .35rem 0 .2rem; font-size: .92rem; }
.suggest span { color: var(--muted); font-size: .8rem; line-height: 1.35; }

.msgs { flex: 1; overflow: auto; padding: 1.2rem 8%; display: flex; flex-direction: column; gap: .85rem; }
.bubble { max-width: 72%; padding: .95rem 1.05rem; border-radius: 18px; line-height: 1.55; white-space: pre-wrap; }
.bubble.user { align-self: flex-end; background: var(--black); color: #fff; }
.bubble.assistant { align-self: flex-start; background: var(--side); }
.bubble .who { font-size: .7rem; color: var(--muted); margin-bottom: .3rem; font-weight: 600; }
.bubble.user .who { color: rgba(255,255,255,.65); }
.composer-wrap { padding: 0 8% 1.2rem; }
.composer-wrap .ask { width: 100%; }

.grid { padding: 0 1.5rem 2rem; overflow: auto; display: grid; gap: 1rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .85rem; }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.05rem;
}
.card h3 { font-size: 1.02rem; margin: .2rem 0 .35rem; }
.theme-bar { height: 4px; border-radius: 99px; margin-bottom: .7rem; background: var(--lavender); }
.card-top { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.card-top .theme-bar { margin-bottom: 0; }
.heart {
  width: 34px; height: 34px; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 50%;
  background: #fff; color: var(--muted); font-size: 1rem;
}
.heart:hover, .heart.on { color: #ef5b7a; border-color: #f8c4cf; background: #fff5f7; }
.row { display: flex; justify-content: space-between; gap: .8rem; align-items: center; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: .6rem .35rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }
.secret {
  background: var(--lavender-soft);
  border: 1px dashed var(--lavender);
  padding: .8rem 1rem;
  border-radius: 12px;
  font-family: ui-monospace, monospace;
  word-break: break-all;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.drop { position: fixed; inset: 0; background: rgba(20, 16, 32, .35); display: grid; place-items: center; z-index: 20; }
.drop-card {
  background: #fff;
  border: 1.5px dashed var(--lavender);
  padding: 2.2rem 2.6rem;
  border-radius: 24px;
  text-align: center;
}
.launch-game {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 1.4rem;
}
.launch-game-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 1.6rem 1.4rem 1.2rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.launch-game-kicker {
  margin: 0 0 .35rem;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #5b3fd6;
  font-weight: 700;
}
.launch-game-card h2 { margin-bottom: .35rem; }
.launch-game-card .muted { margin-bottom: 1.1rem; }
.launch-skip { width: 100%; margin-top: 1.1rem; }
.g-ico { font-size: 1.7rem; line-height: 1; filter: drop-shadow(0 2px 0 rgba(0,0,0,.04)); }
.g-ico.lit { transform: scale(1.25); filter: drop-shadow(0 0 10px rgba(167,139,250,.7)); }
.g-ico.dim { opacity: .38; }
.g-grid { display: grid; gap: 10px; margin: 0 auto; max-width: 280px; }
.g-grid-3 { grid-template-columns: repeat(3, 1fr); }
.g-row { display: flex; gap: 12px; justify-content: center; margin-top: 14px; }
.g-tile {
  aspect-ratio: 1;
  border: 1.5px solid var(--line);
  background: var(--side);
  border-radius: 16px;
  display: grid;
  place-items: center;
  padding: 0;
  transition: transform .12s, border-color .12s, background .12s;
}
.g-tile:hover { border-color: var(--lavender); transform: translateY(-1px); }
.g-tile.ok { background: var(--lavender-soft); border-color: var(--lavender); }
.g-tile.big { width: 92px; height: 92px; }
.g-tile.rain {
  width: 110px; height: 110px; margin: 0 auto;
  animation: g-fall .45s ease;
}
.g-tile.shake { animation: g-shake .28s ease; }
.g-tile:disabled { opacity: .45; cursor: default; }
.g-back { font-size: 1.2rem; font-weight: 700; color: var(--lavender); }
.g-seq { display: flex; justify-content: center; gap: 10px; margin-bottom: 6px; min-height: 42px; }
.g-rain { display: grid; place-items: center; gap: 10px; }
.g-score { margin: 0; font-weight: 700; color: #5b3fd6; }
@keyframes g-fall {
  from { transform: translateY(-18px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes g-shake {
  30% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
}

@media (max-width: 860px) {
  .app-frame { padding: 0; }
  .shell { grid-template-columns: 1fr; border-radius: 0; }
  .side { display: none; }
  .suggests { grid-template-columns: 1fr; }
  .bubble { max-width: 92%; }
  .msgs, .composer-wrap { padding-left: 1rem; padding-right: 1rem; }
}
