/* Mini App Мимико. Цвета с аватарки: серебристо-розовая дымка фона, чёрное худи, розовые пряди, розовый боба-чай.
   Панели и пузырь — «худи» (почти чёрные), фон — светлая дымка. Кнопки плоские. */
:root {
  --haze-1: #c7c2c9;
  --haze-2: #d9b3c2;
  --haze-3: #b9a3b1;
  --hoodie: #1f1d24;
  --hoodie-2: #2c2933;
  --ink: #1f1d24;
  --ink-soft: #5b5160;
  --pink: #ff5fa8;
  --pink-soft: #ffc6dc;
  --boba: #f6c3d4;
  --silver: #f4f1f5;
  --gold: #ffd45e;
  --mint: #52e5c0;
  --mint-ink: #0a4a3c;
  --line: rgba(244, 241, 245, .12);
  --sea: #3a86c0;
  --sea-dim: #2a5878;
  --hit: #ff5fa8;
  --sunk: #a8123c;
  --light: #fdecf4;
  --dark: #d68cb5;
  --r: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background-color: var(--haze-1);
  background-image:
    radial-gradient(60% 45% at 100% 0%, rgba(255, 255, 255, .55) 0%, transparent 70%),
    radial-gradient(80% 60% at 0% 100%, rgba(255, 140, 185, .45) 0%, transparent 70%),
    linear-gradient(160deg, var(--haze-1) 0%, var(--haze-2) 60%, var(--haze-3) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font: 600 16px/1.4 "Nunito", system-ui, sans-serif;
  overscroll-behavior: none;
  user-select: none;
}
main { max-width: 520px; margin: 0 auto; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }
.loading { padding: 38vh 8px 0; text-align: center; color: var(--ink-soft); }

/* --- шапка ------------------------------------------------------------------------------------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
h1 { white-space: nowrap; font: 800 20px/1.15 "Unbounded", "Nunito", sans-serif; margin: 0; letter-spacing: -.2px; color: var(--ink); }
.chip { flex: none; padding: 6px 12px; border-radius: 999px; background: var(--hoodie); color: var(--silver); font-size: 14px; font-weight: 800; }
.chip b { font: 800 15px "Unbounded", sans-serif; color: var(--pink); margin-right: 4px; }

/* --- пузырь Мимико ----------------------------------------------------------------------------- */
.say { display: flex; align-items: flex-end; gap: 10px; margin: 14px 0 0; }
.say img { flex: none; width: 42px; height: 42px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--silver), 0 0 0 4px var(--pink); }
.bubble {
  position: relative; flex: 1; min-height: 44px; padding: 10px 14px; border-radius: 18px 18px 18px 6px;
  background: var(--hoodie); color: var(--silver); font-size: 15.5px; line-height: 1.38;
}
.bubble b { color: var(--pink); font-weight: 800; }
.bubble .sub { display: block; margin-top: 4px; color: #b9aebd; font-size: 14px; font-weight: 600; }
.bubble.win { box-shadow: inset 0 0 0 2px var(--gold); }
.bubble.win b { color: var(--gold); }
.bubble.lose { box-shadow: inset 0 0 0 2px var(--pink); }

/* --- кнопки: плоские, без нижней полосы --------------------------------------------------------- */
.actions { display: flex; gap: 10px; margin-top: 16px; }
.btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 18px; border: 0; border-radius: 999px;
  font: 800 16px "Nunito", sans-serif; color: #fff; background: var(--pink);
  cursor: pointer; transition: transform .1s ease, filter .1s ease;
}
.btn:active { transform: scale(.97); filter: brightness(.94); }
.btn.quiet { background: rgba(255, 255, 255, .55); color: var(--ink); box-shadow: inset 0 0 0 1.5px rgba(31, 29, 36, .14); }
.btn.dark { background: var(--hoodie); color: var(--silver); }
.btn:focus-visible, .cell:focus-visible, .sq:focus-visible { outline: 3px solid var(--hoodie); outline-offset: 2px; }
.btn[disabled] { opacity: .5; }

/* --- шахматы ----------------------------------------------------------------------------------- */
.players { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.pl { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 9px 12px; border-radius: var(--r); background: rgba(255, 255, 255, .5); font-size: 15px; transition: box-shadow .2s; }
.pl .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.pl.w .dot { background: #fff; box-shadow: 0 0 0 2px var(--ink); }
.pl.b .dot { background: var(--hoodie); box-shadow: 0 0 0 2px var(--pink-soft); }
.pl.turn { background: var(--hoodie); color: var(--silver); }
.pl.turn::after { content: "ходит"; margin-left: auto; flex: none; padding: 1px 8px; border-radius: 999px; background: var(--pink); color: #fff; font-size: 12px; font-weight: 800; }
.pl span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.board {
  position: relative; display: grid; width: 100%; aspect-ratio: 1;
  grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr));
  border-radius: 16px; overflow: hidden; box-shadow: 0 0 0 6px var(--hoodie), 0 18px 34px rgba(31, 29, 36, .35);
}
.sq { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; overflow: hidden; }
.sq.l { background: var(--light); }
.sq.d { background: var(--dark); }
.sq.last.l { background: #ffe28c; }
.sq.last.d { background: #e6be64; }
.sq.sel { background: var(--mint) !important; }
.sq.check { box-shadow: inset 0 0 0 4px #e61e3c; }
.sq .coord { position: absolute; font: 800 10px "Nunito", sans-serif; opacity: .75; pointer-events: none; }
.sq .coord.f { right: 3px; bottom: 1px; }
.sq .coord.r { left: 3px; top: 1px; }
.sq.l .coord { color: #a8507f; } .sq.d .coord { color: #fff3f9; }
.pc { font-family: "Noto Sans Symbols 2", "Segoe UI Symbol", sans-serif; font-size: min(10vw, 50px); line-height: 1; pointer-events: none; transform: translateY(1px); }
.pc.w { color: #fff; -webkit-text-stroke: 1.6px #2a0d28; paint-order: stroke fill; text-shadow: 0 2px 2px rgba(0, 0, 0, .25); }
.pc.b { color: #2a0d28; -webkit-text-stroke: .8px #ffd6ea; paint-order: stroke fill; text-shadow: 0 2px 2px rgba(0, 0, 0, .2); }
.sq .hint { position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(10, 74, 60, .55); pointer-events: none; }
.sq .ring { position: absolute; inset: 6%; border-radius: 50%; border: 4px solid rgba(255, 95, 168, .9); pointer-events: none; }

/* --- морской бой: поля лежат на тёмных панелях, чтобы вода и «пусто» читались ------------------ */
.field-head { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 2px 8px; }
.field-head span:first-child { font: 700 15px "Unbounded", sans-serif; }
.field-head .sub { color: var(--ink-soft); font-size: 14px; }
.panel { padding: 10px 10px 8px 4px; border-radius: 18px; background: var(--hoodie); }
.panel.small { display: inline-block; max-width: 76%; }
.grid { display: grid; grid-template-columns: 20px repeat(10, minmax(0, 1fr)); gap: 3px; }
.grid .lbl { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #b9aebd; }

.cell { position: relative; aspect-ratio: 1; border-radius: 6px; background: var(--sea); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .16); }
.grid.enemy .cell.free { cursor: pointer; }
.grid.enemy .cell.free:active { background: var(--gold); }
/* пусто: кораблей тут точно нет */
.cell.m { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.cell.m::after { content: ""; position: absolute; inset: 34%; border-radius: 50%; border: 2px solid rgba(244, 241, 245, .5); }
.cell.h { background: var(--hit); box-shadow: none; }
.cell.x { background: var(--sunk); box-shadow: inset 0 0 0 2px #ff7aa8; }
.cell.h::before, .cell.x::before {
  content: "✕"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font: 800 15px "Nunito", sans-serif; color: #fff;
}
.cell.s { background: var(--mint); box-shadow: none; }
.grid.mine .cell { border-radius: 4px; }
.grid.mine .cell:not(.s):not(.h):not(.x):not(.m) { background: var(--sea-dim); box-shadow: none; }
.grid.mine .cell::before { font-size: 10px; }
.grid.mine .cell.m::after { inset: 30%; border-width: 1.5px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 4px 2px 8px; font-size: 13px; color: #d4c8d6; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .cell { width: 16px; height: 16px; aspect-ratio: auto; border-radius: 4px; }
.legend .cell::before { font-size: 10px; }

.pop { animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* --- меню игр ---------------------------------------------------------------------------------- */
.menu { display: grid; gap: 10px; margin-top: 16px; }
.note { padding: 14px 16px; border-radius: var(--r); background: rgba(255, 255, 255, .5); line-height: 1.4; }
.note b { display: block; margin-bottom: 4px; }
.note code { font: inherit; font-weight: 800; color: #c2307a; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: 90%; padding: 10px 16px; border-radius: 999px; background: var(--hoodie); color: var(--silver); font-size: 15px; box-shadow: 0 6px 20px rgba(31, 29, 36, .35); z-index: 9; }

@media (prefers-reduced-motion: reduce) { .pop { animation: none; } .btn, .pl { transition: none; } }

/* --- что умеет бот: поиск и раскрывающиеся темы ------------------------------------------------- */
.search { position: relative; margin: 14px 0 12px; }
.search input {
  width: 100%; height: 48px; padding: 0 16px 0 44px; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .6); color: var(--ink); font: 700 16px "Nunito", sans-serif;
  box-shadow: inset 0 0 0 1.5px rgba(31, 29, 36, .12); outline: none; user-select: text;
}
.search input:focus { box-shadow: inset 0 0 0 2px var(--hoodie); }
.search::before { content: "🔍"; position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 16px; opacity: .7; }
.topics { display: grid; gap: 8px; }
.topic { border-radius: 18px; background: rgba(255, 255, 255, .5); overflow: hidden; transition: background .2s; }
.topic.open { background: var(--hoodie); color: var(--silver); }
.topic-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.topic-head .ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .7); font-size: 21px; }
.topic.open .topic-head .ico { background: var(--hoodie-2); }
.topic-head .name { flex: 1; min-width: 0; font: 700 15px "Unbounded", sans-serif; }
.topic-head .count { flex: none; color: var(--ink-soft); font-size: 13px; }
.topic.open .topic-head .count { color: #b9aebd; }
.topic-head .chev { flex: none; width: 10px; height: 10px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(45deg) translateY(-3px); transition: transform .2s; opacity: .6; }
.topic.open .topic-head .chev { transform: rotate(-135deg) translateY(-3px); }
.topic-body { display: none; padding: 0 14px 14px; }
.topic.open .topic-body { display: grid; gap: 10px; }
.cmd-row { display: grid; gap: 4px; padding-top: 10px; border-top: 1px solid var(--line); }
.cmd-row:first-child { border-top: 0; padding-top: 0; }
.cmd { justify-self: start; padding: 3px 10px; border: 0; border-radius: 999px; background: var(--pink); color: #fff; font: 800 14.5px "Nunito", sans-serif; cursor: pointer; }
.cmd:active { filter: brightness(.9); }
.cmd-row p { margin: 0; font-size: 14.5px; line-height: 1.4; color: #e6dde8; }
.cmd-row.note-row p { color: #b9aebd; }
.empty { padding: 24px 8px; text-align: center; color: var(--ink-soft); }
@media (prefers-reduced-motion: reduce) { .topic, .topic-head .chev { transition: none; } }
