/* Мозаика дня: демо для корпоративного портала.
   Светлая тёплая бумага, как у портала, а не у игры: сотрудник открывает её
   между задачами. Заголовок Unbounded, текст Golos. Цвет бренда компании
   через ?accent=, у команд свои цвета, они не меняются. */

@font-face {
  font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(/fonts/golos-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(/fonts/golos-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F, U+2122;
}
@font-face {
  font-family: "Unbounded"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(/fonts/unbounded-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Unbounded"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(/fonts/unbounded-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F, U+2116;
}

:root {
  --accent: #1f5eff;        /* бренд компании; в демо синий портала */
  --accent-ink: #fff;
  --bg: #f6f1e7;
  --card: #fffdf8;
  --ink: #1d1a16;
  --ink-2: #5d574d;
  --ink-3: #948c7f;
  --line: rgba(29, 26, 22, .1);
  --hole: #e6dfd2;
  --t1: #ff6b57;  /* Продажи */
  --t2: #1fb8a6;  /* Разработка */
  --t3: #f2b632;  /* Поддержка */
  --t4: #8a63e8;  /* Маркетинг */
  --t5: #4caf50;  /* Логистика */
  --sans: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Unbounded", "Golos Text", sans-serif;
  --r: 18px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}
:root[data-accent="red"] { --accent: #e0263f; }
:root[data-accent="green"] { --accent: #1fa463; }
:root[data-accent="orange"] { --accent: #ff7a1a; }
:root[data-accent="ink"] { --accent: #1d1a16; }

* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: light; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; font: 15px/1.45 var(--sans); color: var(--ink); background: var(--bg); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--ink-2); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { position: relative; max-width: 520px; margin: 0 auto; padding: calc(10px + var(--sat)) 14px calc(24px + var(--sab)); }

/* шапка портала */
.top { display: flex; align-items: center; gap: 10px; padding: 6px 4px 12px; }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand__mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font: 700 15px var(--display); }
.brand__name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.top__crumb { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.top__tools { margin-left: auto; display: flex; gap: 2px; }
.icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2); }
.icon:hover { background: rgba(29, 26, 22, .06); color: var(--ink); }
.embed .top { display: none; }

.title { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 12px; margin: 4px 4px 12px; }
.title h1 { margin: 0; font: 800 26px/1.1 var(--display); letter-spacing: -.01em; }
.title span { color: var(--ink-3); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }

/* полоса: открыто столько-то */
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.bar__track { flex: 1; height: 8px; border-radius: 4px; background: var(--hole); overflow: hidden; }
.bar__fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width .6s var(--ease); }
.bar__n { font: 800 18px/1 var(--display); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar__n small { display: block; font: 500 10px var(--sans); color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; text-align: right; }

/* мозаика 6×4 */
.board { position: relative; margin-top: 12px; border-radius: var(--r); overflow: hidden; background: var(--hole); box-shadow: 0 20px 50px -24px rgba(29, 26, 22, .5); }
.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; background: #cfc6b5; }
.cell { position: relative; aspect-ratio: 1; background: var(--hole); overflow: hidden; }
.cell--on { background-image: var(--pic); background-size: 600% 400%; }
.cell--on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--team); }
.cell--new { animation: pop .6s var(--ease); z-index: 1; }
@keyframes pop { 0% { transform: scale(1.25); box-shadow: 0 0 0 4px #fff; } 100% { transform: scale(1); } }
.cell--off { background: repeating-linear-gradient(135deg, var(--hole) 0 8px, #ddd5c6 8px 10px); cursor: pointer; }
.cell--off:hover { filter: brightness(.96); }
.cell--mine { outline: 3px solid var(--accent); outline-offset: -3px; cursor: pointer; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { outline-color: transparent; } }
.cell__tag { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 3px 7px; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font: 700 10px var(--display); white-space: nowrap; letter-spacing: .04em; }
.board--done .grid { gap: 0; }
.board--done .cell--on::after { display: none; }
.msg { margin-top: 10px; padding: 14px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); animation: rise .6s var(--ease); }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.msg small { display: block; color: var(--ink-3); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 4px; }
.msg p { margin: 0; font-weight: 600; }
.msg i { display: block; margin-top: 4px; color: var(--ink-2); font-size: 12px; font-style: normal; }
.msg--wait { background: transparent; border-style: dashed; }
.msg--wait p { font-weight: 500; color: var(--ink-2); font-size: 14px; }

.note { margin: 10px 4px 0; color: var(--ink-2); font-size: 14px; }
.note b { color: var(--ink); }

/* действия */
.acts { display: grid; gap: 8px; margin-top: 12px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 10px 14px; border-radius: 14px;
  font-weight: 700; text-align: center; line-height: 1.2; transition: transform .12s, filter .2s, opacity .2s; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn--main { background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 28px -10px var(--accent); }
.btn--main:hover:not(:disabled) { filter: brightness(1.06); }
.btn--ghost { background: var(--card); border: 1px solid var(--line); }
.btn--ghost:hover { background: #fff; }
.btn small { display: block; font-weight: 500; font-size: 12px; opacity: .75; }

/* команды */
.teams { margin-top: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
.teams__h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.teams__h h2 { margin: 0; font: 800 15px var(--display); }
.teams__h span { color: var(--ink-3); font-size: 12px; }
.team { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.team i { width: 14px; height: 14px; border-radius: 4px; background: var(--team); }
.team b { font-variant-numeric: tabular-nums; }
.team--me { font-weight: 700; }
.team--me span::after { content: " · вы"; color: var(--ink-3); font-weight: 500; }
.team__bar { grid-column: 2 / 4; height: 5px; border-radius: 3px; background: var(--hole); overflow: hidden; margin-top: -2px; }
.team__bar i { display: block; height: 100%; border-radius: 3px; background: var(--team); width: 0; animation: grow .8s var(--ease) forwards; }
@keyframes grow { to { width: var(--w); } }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; text-align: center; }
.stats div { padding: 10px 6px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.stats b { display: block; font: 800 20px var(--display); color: var(--accent); }
.stats span { color: var(--ink-2); font-size: 12px; line-height: 1.25; display: block; }

.hr { margin-top: 12px; padding: 12px 14px; border-radius: 14px; border: 1px dashed rgba(29, 26, 22, .3); background: rgba(255, 253, 248, .6); }
.hr__top { color: var(--ink-3); font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: .1em; }
.hr__p { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }
.demo-note { color: var(--ink-3); font-size: 12px; text-align: center; margin: 10px 0 0; }
.foot { margin: 18px 4px 0; color: var(--ink-3); font-size: 12px; text-align: center; }

/* кусочек: поворотная головоломка 3×3 */
.sheet { position: fixed; inset: 0; z-index: 1000; display: grid; align-items: end; background: rgba(29, 26, 22, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet__box { max-width: 520px; width: 100%; margin: 0 auto; padding: 16px 16px calc(16px + var(--sab)); border-radius: 24px 24px 0 0; background: var(--bg); animation: up .35s var(--ease); max-height: 96vh; overflow: auto; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet__h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sheet__h h2 { margin: 0; font: 800 18px var(--display); flex: 1; }
.sheet__sub { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; }
.puzzle { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 3px; width: min(100%, 330px); margin: 0 auto; aspect-ratio: 1; padding: 3px; border-radius: 14px; background: #cfc6b5; }
.piece { position: relative; width: 100%; height: 100%; min-height: 0; background-image: var(--pic); background-repeat: no-repeat; transition: transform .22s var(--ease); cursor: pointer; border-radius: 4px; overflow: hidden; }
.piece:active { filter: brightness(1.08); }
.puzzle--done { background: var(--team); }
.puzzle--done .piece { cursor: default; }
.ctx { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; width: 132px; margin: 12px auto 0; padding: 2px; border-radius: 8px; background: #cfc6b5; }
.ctx i { aspect-ratio: 1; background: var(--hole); background-size: 600% 400%; display: block; }
.ctx i.hole { background: repeating-linear-gradient(135deg, #fff 0 4px, #e6dfd2 4px 6px); outline: 2px solid var(--accent); outline-offset: -2px; }
.ctx__cap { text-align: center; color: var(--ink-3); font-size: 12px; margin-top: 6px; }
.sheet__meta { display: flex; justify-content: center; gap: 18px; margin-top: 10px; color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.sheet__meta b { color: var(--ink); }
.sheet .acts { margin-top: 12px; }

/* выбор команды и правила */
.modal { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; padding: 16px; background: rgba(29, 26, 22, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal__box { position: relative; width: 100%; max-width: 420px; padding: 20px 20px 18px; border-radius: 20px; background: var(--bg); box-shadow: 0 30px 60px rgba(0, 0, 0, .3); }
.modal__box h2 { margin: 0 0 10px; font: 800 20px var(--display); }
.modal__box ul { margin: 0 0 10px; padding-left: 18px; }
.modal__box li { margin-bottom: 6px; }
.modal__box p { color: var(--ink-2); margin: 0 0 14px; }
.modal__box .btn { width: 100%; }
.modal__x { position: absolute; top: 10px; right: 10px; }
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; }
.chip { display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-weight: 600; text-align: left; }
.chip i { width: 14px; height: 14px; border-radius: 4px; background: var(--team); flex: none; }
.chip:hover { border-color: var(--ink-3); }

.toast { position: fixed; left: 50%; bottom: calc(22px + var(--sab)); transform: translateX(-50%); z-index: 1200; padding: 12px 16px; border-radius: 12px;
  background: var(--ink); color: #fff; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); white-space: nowrap; }

@media (max-width: 360px) { .top__crumb { display: none; } .title h1 { font-size: 22px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
