@font-face { font-family: "Cabinet Grotesk"; src: url("fonts/cabinet-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Cabinet Grotesk"; src: url("fonts/cabinet-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Satoshi"; src: url("fonts/satoshi-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Satoshi"; src: url("fonts/satoshi-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Satoshi"; src: url("fonts/satoshi-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  /* paleta: 8 barev, nic dalšího */
  --paper: #F4F0E6;
  --card: #FFFCF5;
  --ink: #1C1B19;
  --muted: #57534A;
  --line: #DDD6C6;
  --marker: #FFD43B;
  --pen: #B3261E;
  --ok: #24694A;

  /* odvozené, mění se s režimem */
  --on-marker: #1C1B19;
  --rule: rgba(28, 27, 25, .05);
  --desk: #E9E3D5;
  --hl-from: 58%;
  --lift: 0 8px 24px rgba(28, 27, 25, .1);

  --display: "Cabinet Grotesk", "Satoshi", sans-serif;
  --body: "Satoshi", sans-serif;
  --r: 8px;
  --tabs-h: 72px;
}
:root[data-theme="dark"] {
  --paper: #191816;
  --card: #24221F;
  --ink: #F2EEE4;
  --muted: #B8B2A5;
  --line: #3B3833;
  --pen: #FF8E7F;
  --ok: #7FD1A6;
  --rule: rgba(242, 238, 228, .04);
  --desk: #100F0E;
  --hl-from: 84%;
  --lift: 0 8px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--marker); color: var(--on-marker); }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.app {
  max-width: 560px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  overflow-x: clip;
  /* linky sešitu */
  background: repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px);
}
@media (min-width: 600px) {
  body { background: var(--desk); }
  .app { background-color: var(--paper); box-shadow: 0 0 0 1px var(--line); }
}

.view { padding: 24px 16px calc(var(--tabs-h) + 40px); outline: none; }
.view > * { animation: rise .32s ease-out both; }
.view > *:nth-child(2) { animation-delay: .04s; }
.view > *:nth-child(3) { animation-delay: .08s; }
.view > *:nth-child(4) { animation-delay: .12s; }
.view > *:nth-child(n+5) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .view > * { animation: none; } }
/* tiché obnovení stejné obrazovky: bez náběhové animace, ať to neproblikává */
.view--still > * { animation: none; }

/* ---------- typografie ---------- */
.h1 { font: 800 32px/1.1 var(--display); letter-spacing: -.01em; }
.h2 { font: 700 20px/1.25 var(--display); margin: 32px 0 12px; }
.meta { font-size: 16px; color: var(--muted); }
.lead { margin-top: 8px; color: var(--muted); }
.hl { background: linear-gradient(transparent var(--hl-from), var(--marker) var(--hl-from) 92%, transparent 92%); padding: 0 2px; }
.top .hl { white-space: nowrap; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-weight: 500; text-decoration: none; margin: -12px 0 4px -4px; padding: 0 4px; }
.back:hover { text-decoration: underline; }

/* hlavička obrazovky s tlačítkem nastavení */
.top__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin-bottom: 8px; }
.gear {
  flex: none; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 12px; margin-left: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 24px;
  font-weight: 500; text-decoration: none;
  transition: border-color .12s ease;
}
.gear:hover { border-color: var(--ink); }

/* ---------- tlačítka ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border: 2px solid var(--ink); border-radius: var(--r);
  background: var(--ink); color: var(--paper);
  font-weight: 700; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease;
  box-shadow: 0 0 0 var(--marker);
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--marker); }
.btn:active { transform: none; box-shadow: none; }
.btn--ghost { background: var(--card); color: var(--ink); }
.btn--wide { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.link-btn { background: none; border: 0; padding: 0 4px; min-height: 44px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-align: left; }
.link-btn--pen { color: var(--pen); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 140px; }

/* ---------- karty ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
}
.stack { display: grid; gap: 8px; }
.empty { border: 2px dashed var(--line); border-radius: var(--r); padding: 20px 16px; color: var(--muted); background: var(--card); }

/* termín: červená linka okraje jako v sešitě */
.due { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 12px; text-decoration: none; transition: border-color .12s ease; }
.due:hover { border-color: var(--ink); }
/* dlaždice s datem jako list z kalendáře */
.due__day { display: grid; justify-items: center; align-content: center; gap: 2px; height: 56px; background: var(--paper); border-radius: 6px; line-height: 1; }
.due__day span { font-size: 13px; font-weight: 500; color: var(--muted); }
.due__day strong { font: 800 17px/1 var(--display); white-space: nowrap; }
.due__title { font-weight: 700; line-height: 1.3; }
.due__in { white-space: nowrap; font-weight: 700; }
.due--soon .due__day { background: var(--pen); }
.due--soon .due__day span, .due--soon .due__day strong { color: var(--card); }

.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 4px; font-size: 16px; font-weight: 500; background: var(--paper); border: 1px solid var(--line); }
.tag--ai { background: var(--marker); border-color: var(--marker); color: var(--on-marker); }
.tag--pen { color: var(--pen); border-color: var(--pen); background: var(--card); }
.tag--ok { color: var(--ok); border-color: var(--ok); background: var(--card); }

/* štítek předmětu */
.badge {
  flex: none; display: grid; place-items: center;
  width: 48px; height: 48px;
  border: 2px solid var(--ink); border-radius: var(--r);
  font: 800 16px/1 var(--display); letter-spacing: .02em;
  background: var(--card);
}
.badge svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.subject { display: flex; align-items: center; gap: 12px; text-decoration: none; transition: transform .12s ease, box-shadow .12s ease; }
.subject:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--marker); }
.subject__name { font: 700 17px/1.25 var(--display); }
.subject__arrow { margin-left: auto; font-size: 20px; }

/* příspěvek */
.post__head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.post__who { font-weight: 700; }
.post__text { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.post__foot { margin-top: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.post__foot .link-btn { margin-left: auto; }
.post__img { margin-top: 12px; max-width: 100%; max-height: 240px; border-radius: 4px; border: 1px solid var(--line); display: block; }

/* ---------- formuláře ---------- */
.field { display: grid; gap: 8px; margin-top: 16px; }
.field label, .label { font-weight: 700; }
.input, .textarea {
  width: 100%; min-height: 52px; padding: 12px 16px;
  background: var(--card); border: 2px solid var(--ink); border-radius: var(--r);
}
.textarea { min-height: 160px; resize: vertical; line-height: 1.55; }
.textarea--short { min-height: 96px; }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: 1; }
.hint { font-size: 16px; color: var(--muted); }
.error { color: var(--pen); font-weight: 500; margin-top: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two .field { margin-top: 16px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: 44px; padding: 0 16px;
  background: var(--card); border: 2px solid var(--line); border-radius: 24px;
  font-weight: 500; transition: border-color .12s ease, background-color .12s ease;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--marker); border-color: var(--ink); color: var(--on-marker); font-weight: 700; }

.photo-btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; border: 2px dashed var(--ink); border-radius: var(--r); background: var(--card); font-weight: 700; cursor: pointer; transition: background-color .12s ease; }
.photo-btn:hover { background: var(--marker); color: var(--on-marker); }
.photo-btn svg, .tabs svg, .gear svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* výsledek zařazení */
.result { border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--marker); }
.result__where { font: 800 24px/1.2 var(--display); margin: 8px 0; }
.result__more { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.thinking { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); animation: blink 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* ---------- vstup do třídy ---------- */
.view--gate { padding-bottom: 24px; }
.gate { min-height: calc(100dvh - 48px); display: grid; align-content: center; }
.gate__brand { display: flex; align-items: center; gap: 12px; font: 800 20px/1 var(--display); }
.gate__brand svg { width: 40px; height: 40px; }
.gate__peek { position: relative; height: 148px; margin: 24px 0 20px; }
.peek { position: absolute; width: 76%; box-shadow: var(--lift); }
.peek--a { left: 4px; top: 0; transform: rotate(-2deg); }
.peek--b { right: 4px; top: 76px; transform: rotate(1.5deg); }
.peek--b p { margin-top: 8px; line-height: 1.4; }
.gate .h1 { font-size: 48px; }

/* ---------- chat ---------- */
.chat { display: grid; gap: 12px; margin-top: 24px; }
.msg { max-width: 92%; overflow-wrap: anywhere; }
.msg--me { justify-self: end; background: var(--ink); color: var(--paper); border-color: var(--ink); }
.msg__part + .msg__part { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.msg__src { display: inline-flex; margin-bottom: 8px; }
.msg ul { margin: 8px 0 0; padding-left: 20px; }
.msg li + li { margin-top: 4px; }
.ask {
  position: fixed; left: 0; right: 0; bottom: var(--tabs-h);
  max-width: 560px; margin: 0 auto; padding: 8px 16px;
  display: flex; gap: 8px;
  background: var(--paper); border-top: 1px solid var(--line);
}
.ask .input { min-height: 48px; }
.ask .btn { flex: none; padding: 0 16px; }
.view--ai { padding-bottom: calc(var(--tabs-h) + 104px); }

.quiz__q { font-weight: 700; margin-bottom: 8px; }
.quiz__opts { display: grid; gap: 8px; }
.quiz__opt { min-height: 48px; padding: 8px 16px; text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: var(--r); font-weight: 500; transition: border-color .12s ease; }
.quiz__opt:hover:not([disabled]) { border-color: var(--ink); }
.quiz__opt.is-right { border-color: var(--ok); color: var(--ok); font-weight: 700; }
.quiz__opt.is-wrong { border-color: var(--pen); color: var(--pen); }
.quiz__opt[disabled] { cursor: default; }

/* ---------- návrhy ---------- */
.idea { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.idea__text { overflow-wrap: anywhere; }
.vote {
  display: grid; justify-items: center; align-content: center; min-width: 56px; min-height: 56px; padding: 4px 8px;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r);
  font: 800 17px/1.1 var(--display); transition: border-color .12s ease, background-color .12s ease;
}
.vote small { font: 500 13px/1.2 var(--body); }
.vote:hover { border-color: var(--ink); }
.vote[aria-pressed="true"] { background: var(--marker); border-color: var(--ink); color: var(--on-marker); }

/* ---------- spodní menu ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  max-width: 560px; margin: 0 auto;
  height: var(--tabs-h); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 2px solid var(--ink);
}
.tabs[hidden] { display: none; }
.tabs a {
  display: grid; justify-items: center; align-content: center; gap: 4px;
  font-size: 13px; font-weight: 500; text-decoration: none; color: var(--muted);
  transition: color .12s ease;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabs a[aria-current="page"] span { background: linear-gradient(transparent var(--hl-from), var(--marker) var(--hl-from)); padding: 0 4px; }
.tabs__add svg {
  width: 48px; height: 48px; padding: 10px; margin-top: -28px;
  background: var(--marker); color: var(--on-marker);
  border: 2px solid var(--ink); border-radius: 50%;
  transition: transform .12s ease;
}
.tabs__add { color: var(--ink) !important; font-weight: 700 !important; }
.tabs__add:hover svg { transform: rotate(90deg); }

.demo-note { margin-top: 24px; font-size: 16px; color: var(--muted); }
