/* alloflife — тёплая «детская» палитра, крупные эмодзи, мягкие карточки */
:root {
  --bg: #fff6ec;
  --bg2: #ffeedd;
  --card: #ffffff;
  --ink: #2c2420;
  --muted: #8b7d72;
  --line: #f1e3d3;
  --accent: #ff6a48;
  --accent-ink: #fff;
  --teal: #16a394;
  --gold: #f4b23a;
  --violet: #7b61ff;
  --red: #e5484d;
  --green: #2e9e5b;
  --r: 18px;
  --shadow: 0 1px 2px rgba(80, 50, 20, 0.06), 0 6px 24px rgba(80, 50, 20, 0.07);
  --font: ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 var(--font);
  color: var(--ink);
  background: radial-gradient(1200px 600px at 10% -10%, #ffe2c8 0%, transparent 60%), radial-gradient(900px 500px at 110% 10%, #ffe7f0 0%, transparent 55%), var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.4em; }
h1 { font-size: clamp(28px, 4vw, 44px); letter-spacing: -0.02em; }
h2 { font-size: 22px; }
h3 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
p { margin: 0 0 0.6em; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
input {
  font: inherit;
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fffdfa;
  outline: none;
  transition: border-color 0.15s;
}
input:focus { border-color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s, filter 0.15s, opacity 0.15s;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
}
.btn:hover:not(:disabled) { filter: brightness(1.05); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.big { padding: 14px 26px; font-size: 17px; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn.ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }
.btn.pay { background: linear-gradient(135deg, #ffb13b, #ff6a48); }
.btn.luck { background: #eafaf2; color: var(--green); border: 1.5px solid #c8eed9; box-shadow: none; font-size: 13px; padding: 7px 14px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: 13px; }
.link.danger { color: var(--muted); margin: 4px auto 16px; display: block; }
.link.danger:hover { color: var(--red); }

.card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 18px;
}

.logo { font-weight: 800; font-size: 22px; letter-spacing: -0.03em; color: var(--ink); white-space: nowrap; }
.logo b { color: var(--accent); font-weight: 800; }
.logo.big { font-size: 34px; margin-bottom: 18px; }

.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 246, 236, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top .grow { flex: 1; }
.top .who { display: flex; align-items: center; gap: 8px; }
.top .login { font-weight: 700; }
.online { font-size: 13px; color: var(--muted); }

.foot {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  justify-content: center;
  padding: 18px 20px 24px;
  font-size: 12px;
  color: var(--muted);
}
.foot a { color: var(--muted); }

.fatal { max-width: 420px; margin: 20vh auto; text-align: center; }

/* ── вход ───────────────────────────────────────────── */
.auth {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 7vh 24px 24px;
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 48px;
  align-items: center;
}
.hero .lead { font-size: 18px; color: #5b4d43; max-width: 560px; }
.perks { list-style: none; padding: 0; margin: 22px 0; display: grid; gap: 10px; }
.perks li { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; }
.perks li span { font-size: 22px; line-height: 1.1; }
.hero .stats { font-size: 13px; color: var(--muted); }
.authcard { padding: 24px; }
.authcard form { display: grid; gap: 14px; margin-top: 16px; }
.authcard label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.err { color: var(--red); margin: 0; min-height: 1.2em; font-size: 14px; }

.tabs { display: flex; gap: 4px; background: var(--bg2); padding: 4px; border-radius: 999px; }
.tab { flex: 1; border: 0; background: none; padding: 8px 12px; border-radius: 999px; cursor: pointer; font-weight: 700; color: var(--muted); position: relative; white-space: nowrap; }
.tab.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.tab.unread::after { content: ''; position: absolute; top: 7px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* ── создание персонажа ─────────────────────────────── */
.create { width: 100%; max-width: 1000px; margin: 0 auto; padding: 28px 24px 0; }
.create .lead { font-size: 17px; color: #5b4d43; max-width: 680px; }
.step { margin-top: 30px; }
.step h2 { display: flex; align-items: center; gap: 10px; }
.step .n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 15px; }
.grid { display: grid; gap: 10px; margin-top: 14px; }
.countries { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.races { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.conts { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.pick {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  padding: 14px;
  border-radius: 16px;
  border: 2px solid transparent;
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.pick:hover:not(:disabled) { transform: translateY(-2px); }
.pick.on { border-color: var(--accent); background: #fff4ef; }
.pick small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.pick .flag { font-size: 30px; line-height: 1; }
.pick .ava { font-size: 44px; line-height: 1.1; }
.races .pick { align-items: center; text-align: center; }
.cont .ci { font-size: 30px; }
.cont .ages { color: var(--accent); font-weight: 700; }
.cont .check { position: absolute; top: 10px; right: 12px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; font-weight: 800; font-size: 13px; }
.cont.on .check { background: var(--accent); border-color: var(--accent); color: #fff; }
.cont.past { opacity: 0.45; }
.born { position: sticky; bottom: 0; margin: 30px -24px 0; padding: 18px 24px; background: linear-gradient(transparent, var(--bg) 30%); text-align: center; }
.born .sum { font-weight: 700; }

/* ── игра ───────────────────────────────────────────── */
.game {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 20px 0;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}
.col { display: grid; gap: 14px; }
.col.me, .col.world { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; scrollbar-width: thin; padding-bottom: 4px; }
.row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }

.hero-card { text-align: center; }
.ava-wrap { position: relative; width: 104px; height: 104px; margin: 4px auto 10px; }
.ava-wrap .ava { width: 104px; height: 104px; border-radius: 50%; background: linear-gradient(135deg, #ffe0c8, #ffd0dc); display: grid; place-items: center; font-size: 60px; }
.ava-wrap .badge { position: absolute; right: -4px; bottom: -2px; width: 38px; height: 38px; border-radius: 50%; background: #fff; box-shadow: var(--shadow); display: grid; place-items: center; font-size: 20px; }
.hero-card h2 { margin-bottom: 0; }
.dead { color: var(--violet); font-weight: 700; }

.bar { margin: 9px 0; text-align: left; }
.bl { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.bl b { color: var(--ink); }
.track { height: 8px; border-radius: 99px; background: #f6ece2; overflow: hidden; margin-top: 3px; }
.track i { display: block; height: 100%; border-radius: inherit; background: var(--violet); transition: width 0.5s ease; }
.bar.health i { background: var(--green); }
.bar.happy i { background: var(--gold); }
.bar.low i { background: var(--red); }
.bar.skill i { background: linear-gradient(90deg, #8e7bff, #ff8fb1); }
.money { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 8px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); }
.money b { color: var(--ink); font-size: 17px; }
.money b.neg { color: var(--red); }
.money small { width: 100%; text-align: right; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 12px 0 0; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-weight: 600; }
.count { color: var(--accent); }
.memstrip { display: flex; flex-wrap: wrap; gap: 4px; font-size: 22px; min-height: 30px; margin: 4px 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: #f6efe8; color: var(--muted); }
.chip.on { background: #fff0ea; color: var(--accent); font-weight: 700; }
.chip.past { opacity: 0.55; }
.lives { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }

.scene { display: flex; align-items: center; gap: 18px; background: linear-gradient(135deg, #fff, #fff3e8); }
.scene-emoji { font-size: 58px; width: 88px; height: 88px; display: grid; place-items: center; border-radius: 24px; background: #fff; box-shadow: var(--shadow); flex: none; }
.scene-text { flex: 1; min-width: 0; }
.scene h2 { margin-bottom: 2px; }
.scene .mini { display: none; margin: 4px 0 0; font-size: 13px; font-weight: 600; }
.stageprog { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.stageprog .track { flex: 1; margin: 0; }
.stageprog .track i { background: var(--accent); }
.stageprog small { color: var(--muted); white-space: nowrap; }
.st-kindergarten { background: linear-gradient(135deg, #fff, #fff1f6); }
.st-school { background: linear-gradient(135deg, #fff, #eef6ff); }
.st-institute { background: linear-gradient(135deg, #fff, #f2efff); }
.st-adult { background: linear-gradient(135deg, #fff, #eefaf5); }
.st-pension { background: linear-gradient(135deg, #fff, #fffbe6); }

.feedcard { padding: 6px; }
.feed { max-height: min(46vh, 520px); min-height: 180px; overflow: auto; padding: 8px 10px; scrollbar-width: thin; }
.entry { display: flex; gap: 12px; padding: 10px 6px; border-bottom: 1px solid #f8efe6; }
.entry:last-child { border-bottom: 0; }
.entry .ei { font-size: 22px; width: 30px; text-align: center; flex: none; line-height: 1.2; }
.entry p { margin: 0; }
.entry .em { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; align-items: center; }
.entry .age { font-size: 12px; color: var(--muted); }
.d { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.d.up { background: #e7f7ee; color: var(--green); }
.d.down { background: #fdecec; color: var(--red); }
.k-fail p { color: #6d5d52; }
.k-milestone, .k-death { background: #fff7ef; border-radius: 12px; }
.k-milestone p, .k-death p { font-weight: 600; }
.k-memory { padding-top: 4px; padding-bottom: 4px; }
.k-memory p { color: var(--violet); font-weight: 700; font-size: 13px; }
.k-skip { background: #f5f3ff; border-radius: 12px; }
.k-pay { background: #fff6e0; border-radius: 12px; }
.k-event p { font-style: italic; }
.entry.fresh { animation: pop 0.5s ease both; }
.entry.fresh:nth-last-child(2) { animation-delay: 0.08s; }
.entry.fresh:nth-last-child(1) { animation-delay: 0.16s; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.gate { border: 2px solid #ffd2c4; }
.gate h3 { color: var(--accent); text-transform: none; letter-spacing: 0; font-size: 19px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.offer { display: flex; gap: 14px; align-items: flex-start; background: linear-gradient(135deg, #fffaf0, #fff1e3); border: 1.5px dashed #ffc58a; }
.offer .oi { font-size: 30px; }
.offer p { margin: 2px 0 0; color: #6d5d52; }

.actions h3 { text-transform: none; letter-spacing: 0; font-size: 16px; color: var(--ink); }
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 10px; }
.act {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  text-align: left;
  padding: 12px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fffdfa;
  cursor: pointer;
  transition: transform 0.08s, border-color 0.15s, background 0.15s;
}
.act:hover:not(:disabled) { border-color: var(--accent); background: #fff6f1; transform: translateY(-1px); }
.act:disabled { opacity: 0.5; cursor: default; }
.act .ai { grid-row: span 2; font-size: 28px; }
.act .al { font-weight: 700; padding-right: 30px; line-height: 1.25; }
.act small { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.act .ch { position: absolute; top: 8px; right: 8px; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 99px; background: #f4ece4; color: var(--muted); }
.act .ch.lo { background: #fdecec; color: var(--red); }
.act .ch.hi { background: #e7f7ee; color: var(--green); }
.act .new { margin-left: 4px; font-size: 12px; }
.act.drift { border-style: dashed; background: transparent; }

.players h3, .chat h3 { margin-bottom: 4px; }
.plist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; }
.prow { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 12px; cursor: pointer; opacity: 0.6; }
.prow.on { opacity: 1; }
.prow:hover { background: #fff5ee; }
.prow.self { cursor: default; background: #fff8f3; }
.prow .pa { font-size: 26px; width: 34px; text-align: center; }
.prow .pt { flex: 1; min-width: 0; display: grid; }
.prow .pt b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .pt small { color: var(--muted); font-size: 12px; }
.prow .dot { width: 8px; height: 8px; border-radius: 50%; background: #d8cdc2; flex: none; }
.prow.on .dot { background: #31c46c; box-shadow: 0 0 0 3px #dff6e8; }
.alone { margin-top: 10px; padding: 12px; border-radius: 12px; background: #fff8f2; font-size: 13px; }

.chat { display: flex; flex-direction: column; gap: 10px; }
.msgs { height: 340px; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px; scrollbar-width: thin; }
.msgs .empty { margin: auto 0; text-align: center; }
.msg { display: flex; gap: 8px; align-items: flex-start; }
.msg .ma { font-size: 22px; line-height: 1.2; }
.msg .mh { font-size: 13px; }
.msg .mh small { color: var(--muted); font-size: 11px; }
.msg p { margin: 1px 0 0; background: #f7f1ea; padding: 6px 10px; border-radius: 4px 12px 12px 12px; display: inline-block; word-break: break-word; }
.msg.mine p { background: #ffeae2; }
.msg.sys { align-items: center; font-size: 12.5px; color: var(--muted); }
.msg.sys p { background: none; padding: 0; flex: 1; }
.msg.sys b { color: var(--ink); }
.msg.sys time { font-size: 11px; }
.say { display: flex; gap: 8px; }
.say input { padding: 10px 12px; }
.say .btn { padding: 10px 14px; }

/* ── модальные окна ─────────────────────────────────── */
.modal-back { position: fixed; inset: 0; background: rgba(44, 36, 32, 0.38); display: grid; place-items: center; padding: 20px; z-index: 50; animation: fade 0.15s ease; }
.modal { position: relative; background: #fff; border-radius: 22px; padding: 26px; width: 100%; max-width: 440px; max-height: calc(100vh - 40px); overflow: auto; box-shadow: 0 20px 60px rgba(60, 30, 10, 0.25); animation: rise 0.2s ease; }
.modal.wide { max-width: 760px; }
.modal .x { position: absolute; top: 10px; right: 14px; border: 0; background: none; font-size: 26px; cursor: pointer; color: var(--muted); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.birth, .pcard, .paywall { text-align: center; }
.birth .opts, .pcard .opts, .paywall .opts { justify-content: center; }
.bigava { font-size: 84px; line-height: 1.1; margin-bottom: 6px; }
.pw-icon { font-size: 56px; }
.price { font-size: 30px; font-weight: 800; margin: 4px 0 10px; }
.price small { font-size: 15px; color: var(--muted); font-weight: 600; }
.pcard .facts { max-width: 280px; margin: 14px auto 6px; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.mem { padding: 12px; border-radius: 14px; background: #fff7f0; display: grid; gap: 2px; align-content: start; }
.mem .mi { font-size: 30px; }
.mem p { font-size: 12.5px; color: #6d5d52; margin: 0; }
.mem small { color: var(--muted); font-size: 11px; }
.mem.locked { background: #f6f2ee; color: var(--muted); }
.mem.locked .mi { opacity: 0.5; }

#toasts { position: fixed; top: 74px; right: 20px; display: grid; gap: 8px; z-index: 60; max-width: min(360px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: center; background: #2c2420; color: #fff; padding: 10px 14px; border-radius: 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2); font-size: 14px; animation: rise 0.2s ease; transition: opacity 0.4s, transform 0.4s; }
.toast.mem { background: var(--violet); }
.toast.bad { background: var(--red); }
.toast.out { opacity: 0; transform: translateX(20px); }
.toast .ti { font-size: 20px; }

.mobtabs { display: none; }

/* ── адаптив ────────────────────────────────────────── */
@media (max-width: 1180px) {
  .game { grid-template-columns: 260px minmax(0, 1fr) 300px; gap: 14px; padding: 14px 14px 0; }
}
@media (max-width: 980px) {
  .auth { grid-template-columns: 1fr; gap: 28px; padding-top: 32px; }
  .top { padding: 10px 14px; }
  .online, .top .login { display: none; }
  .game { grid-template-columns: 1fr; padding-bottom: 76px; }
  .col.me, .col.world { position: static; max-height: none; overflow: visible; }
  .page-game.tab-life .col.me, .page-game.tab-life .col.world,
  .page-game.tab-me .col.life, .page-game.tab-me .col.world,
  .page-game.tab-world .col.me, .page-game.tab-world .col.life { display: none; }
  .page-game .foot { padding-bottom: 86px; }
  .mobtabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .mobtabs button { flex: 1; border: 0; background: none; display: grid; justify-items: center; font-size: 12px; color: var(--muted); padding: 4px; border-radius: 12px; cursor: pointer; }
  .mobtabs button span { font-size: 22px; }
  .mobtabs button.on { color: var(--accent); background: #fff2ec; font-weight: 700; }
  .feed { max-height: 36vh; min-height: 120px; }
  .scene .mini { display: block; }
  .msgs { height: 50vh; }
  #toasts { top: 64px; right: 12px; left: 12px; max-width: none; }
}
@media (max-width: 560px) {
  .agrid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .act { grid-template-columns: 1fr; padding: 10px; }
  .act .ai { grid-row: auto; font-size: 24px; }
  .act .al { padding-right: 34px; }
  .scene { gap: 12px; padding: 14px; }
  .scene-emoji { width: 64px; height: 64px; font-size: 40px; border-radius: 18px; }
  .btn.luck { font-size: 12px; padding: 6px 10px; }
  .countries { grid-template-columns: 1fr 1fr; }
  .races { grid-template-columns: 1fr 1fr; }
}
