/* Silabica — caiet dictando, pix albastru și pix roșu. Doar fonturi de sistem. */
:root {
  --bg: #f3f5f9;
  --paper: #ffffff;
  --text: #1f2328;
  --muted: #555d6b;
  --ink: #1d3f91;
  --ink-hover: #163276;
  --ink-soft: #e7edfa;
  --red: #c62f25;
  --red-soft: #fdeceb;
  --line: #d6dce6;
  --notebook: #dbe4f4;
  --margin: #ec8c86;
  --focus: #f2a900;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Avenir Next", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { .peek-paper { transition: transform .25s ease; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--sans); }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--ink-hover); }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.015em; line-height: 1.12; margin: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 6px; z-index: 10; }
.skip:focus { left: 12px; }

/* marca: silabele numelui, cu arce */
.brand { display: inline-flex; align-items: flex-start; min-height: 40px; padding-top: 4px; gap: 1px; font: 800 23px/1 var(--display); text-decoration: none; letter-spacing: -0.01em; }
.brand span { position: relative; padding-bottom: 7px; }
.brand span:nth-child(odd) { color: var(--ink); }
.brand span:nth-child(even) { color: var(--red); }
.brand span::after { content: ""; position: absolute; left: 2px; right: 2px; bottom: 0; height: 6px; border: 2px solid currentColor; border-top: 0; border-radius: 0 0 50% 50% / 0 0 100% 100%; }
.brand.small { font-size: 18px; min-height: 0; padding-top: 0; }

.bar { display: flex; align-items: center; gap: 28px; padding: 14px max(16px, calc((100% - 1240px) / 2)); background: #fff; border-bottom: 1px solid var(--line); }
.bar nav { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.bar nav a { padding: 9px 12px; border-radius: 6px; text-decoration: none; color: var(--text); font-weight: 600; font-size: 15px; }
.bar nav a:hover { background: var(--ink-soft); color: var(--ink); }

/* ---------- verificare: pagină de caiet dictando ---------- */
.check {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 48px; align-items: start;
  padding: 30px max(16px, calc((100% - 1240px) / 2)) 34px;
  background-color: #fff;
  background-image:
    linear-gradient(90deg, transparent 0, transparent calc(max(16px, (100% - 1240px) / 2) - 18px), var(--margin) calc(max(16px, (100% - 1240px) / 2) - 18px), var(--margin) calc(max(16px, (100% - 1240px) / 2) - 16px), transparent calc(max(16px, (100% - 1240px) / 2) - 16px)),
    repeating-linear-gradient(180deg, transparent 0 35px, var(--notebook) 35px 36px);
  border-bottom: 1px solid var(--line);
}
.check-main { min-width: 0; }
.peek { display: block; text-decoration: none; color: var(--text); position: relative; }
.peek-paper { display: block; position: relative; background: #fff; transform: rotate(1.2deg); box-shadow: 0 1px 2px rgba(20, 30, 60, 0.14), 0 14px 34px rgba(29, 63, 145, 0.14); }
.peek-paper svg { display: block; width: 100%; height: auto; aspect-ratio: 210 / 297; }
.peek-paper:empty { aspect-ratio: 210 / 297; } /* rezervă locul până desenează scriptul fișa */
.peek-paper .paper-stamp { font-size: 14px; }
.peek-cap { display: flex; flex-direction: column; gap: 2px; margin-top: 16px; font-size: 15px; }
.peek-cap b { font-family: var(--display); font-size: 17px; }
.peek-cap span { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.peek:hover .peek-paper { transform: rotate(0deg); }
.check h1 { font-size: clamp(32px, 3.5vw, 46px); font-weight: 800; }
.lede { font-size: 17px; color: var(--muted); max-width: 34em; margin: 10px 0 18px; }
.check-form label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.check-row { display: flex; gap: 10px; max-width: 620px; }
.check-row input { flex: 1; min-width: 0; height: 56px; padding: 0 16px; font-size: 24px; border: 2px solid var(--ink); border-radius: 8px; background: #fff; }
.check-row button, .btn.primary { height: 56px; padding: 0 22px; border: 0; border-radius: 8px; background: var(--ink); color: #fff; font-weight: 700; font-size: 17px; cursor: pointer; }
.check-row button:hover, .btn.primary:hover { background: var(--ink-hover); }
.check-help { font-size: 14px; color: var(--muted); margin: 10px 0 0; }
.check-out { padding: 18px 0 0; min-height: 230px; }
.board { min-height: 108px; display: flex; align-items: center; }
.board-count { font-size: 18px; font-weight: 700; margin: 6px 0 12px; }
.why { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 7px; font-size: 15px; }
.why li { padding-left: 14px; border-left: 3px solid var(--ink); }
.why li b { font-family: var(--display); margin-right: 4px; }
.why li.keep { border-left-color: #8aa0d6; }
.why li.alt { border-left-color: #6b9e5a; }
.why li.warn { border-left-color: var(--red); background: var(--red-soft); padding: 6px 10px 6px 14px; }
.link-btn { border: 0; background: none; padding: 8px 0; min-height: 40px; color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* silabe cu arce dedesubt (convenția de la clasă) */
.syls { display: inline-flex; flex-wrap: wrap; column-gap: 0.14em; row-gap: 0.2em; font-weight: 700; }
.syl { position: relative; padding: 0 0.03em 0.3em; }
.syl.s0 { color: var(--ink); }
.syl.s1 { color: var(--red); }
.syl::after { content: ""; position: absolute; left: 0.1em; right: 0.1em; bottom: 0; height: 0.26em; border: 0.075em solid currentColor; border-top: 0; border-radius: 0 0 50% 50% / 0 0 100% 100%; opacity: 0.85; }
.board.multi { flex-wrap: wrap; align-items: baseline; align-content: center; gap: 12px 22px; font: 700 clamp(22px, 2.6vw, 30px)/1.25 var(--display); }
.phrase-word { display: inline-flex; align-items: baseline; gap: 5px; }
.phrase-word small { font: 700 12px/1 var(--sans); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 6px; background: var(--paper); }
.syls.big { font: 700 clamp(40px, 5.4vw, 74px)/1.05 var(--display); column-gap: 0.18em; letter-spacing: -0.01em; }

/* ---------- fișa ---------- */
.tool { padding: 26px max(16px, calc((100% - 1240px) / 2)) 56px; }
.tool-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.tool-head h2 { font-size: clamp(28px, 3vw, 38px); font-weight: 800; }
.status { margin: 6px 0 0; color: var(--muted); max-width: 52em; }
.stamp, .paper-stamp { display: inline-block; border: 2px solid var(--red); color: var(--red); font: 800 13px/1 var(--display); letter-spacing: 0.14em; text-transform: uppercase; padding: 5px 8px 4px; border-radius: 4px; transform: rotate(-3deg); margin-right: 6px; background: #fff; }
.btn { height: 46px; padding: 0 18px; border-radius: 8px; border: 1.5px solid var(--ink); background: #fff; color: var(--ink); font-weight: 700; font-size: 16px; cursor: pointer; }
.btn:hover { background: var(--ink-soft); }
.btn.ghost { border-color: var(--line); color: var(--text); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.options { display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center; margin: 16px 0 18px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chips-label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-right: 2px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 999px; background: #fff; font-size: 15px; font-weight: 600; cursor: pointer; user-select: none; }
.chip span::before { content: ""; width: 14px; height: 14px; border: 1.5px solid #9aa3b2; border-radius: 3px; background: #fff; }
.chip input:checked + span { border-color: var(--ink); background: var(--ink-soft); color: var(--ink); }
.chip input:checked + span::before { background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3 7.4l2.6 2.6L11 4.6' fill='none' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E") center/12px no-repeat; border-color: var(--ink); }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.title-field { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 14px; }
.title-field label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.title-field input, .words textarea, .row-ans { border: 1.5px solid #b7c0ce; border-radius: 8px; background: #fff; padding: 8px 12px; }
.title-field input { height: 42px; }

.work { display: grid; grid-template-columns: minmax(0, 1fr) 410px; gap: 32px; align-items: start; }
.preview-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin-bottom: 18px; }
.tabs { display: flex; gap: 4px; }
.tabs button { border: 0; background: none; padding: 10px 14px; min-height: 44px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; font-size: 16px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs button:disabled { opacity: 0.4; cursor: not-allowed; }
.pages-note { font-size: 14px; color: var(--muted); padding-bottom: 10px; }
.sheet-view { display: grid; gap: 22px; justify-items: center; }
.paper { position: relative; margin: 0; width: 100%; max-width: 760px; background: #fff; box-shadow: 0 1px 2px rgba(20, 30, 60, 0.12), 0 10px 30px rgba(29, 63, 145, 0.08); }
.paper svg { display: block; width: 100%; height: auto; aspect-ratio: 210 / 297; }
.paper-stamp { position: absolute; top: 3.2%; right: 4%; font-size: 15px; padding: 7px 10px 6px; transform: rotate(-6deg); pointer-events: none; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.actions .btn.primary { height: 50px; }
.action-note { min-height: 24px; margin: 10px 0 0; font-size: 15px; color: var(--muted); }

.words { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--ink); border-radius: 0 0 10px 10px; padding: 18px 18px 8px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.words-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.words-head h3 { font-size: 22px; }
.count { font-size: 14px; color: var(--muted); font-weight: 600; }
.grades { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 12px 0 14px; }
.grades-label { font-size: 13px; color: var(--muted); width: 100%; }
.grades button { min-height: 40px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 6px; background: #fff; font-weight: 700; font-size: 14px; cursor: pointer; }
.grades button:hover { border-color: var(--ink); color: var(--ink); }
.words-label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.words textarea { width: 100%; resize: vertical; min-height: 120px; font-size: 16px; line-height: 1.5; }
.hint, .rows-help { font-size: 14px; color: var(--muted); margin: 6px 0 10px; }
.rows-help { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.error { color: var(--red); background: var(--red-soft); padding: 8px 12px; border-radius: 6px; font-size: 15px; margin: 6px 0; }

.rows { list-style: none; margin: 0; padding: 0; }
.row { padding: 10px 0; border-bottom: 1px solid #e8ecf2; }
.row-top { display: flex; align-items: center; gap: 8px; }
.row-n { width: 22px; flex: none; font-size: 13px; font-weight: 700; color: var(--muted); }
.letters { display: flex; flex-wrap: wrap; align-items: center; font: 700 23px/1 var(--display); flex: 1; min-width: 0; }
.lt.s0 { color: var(--ink); }
.lt.s1 { color: var(--red); }
.gap { position: relative; width: 4px; height: 34px; padding: 0; border: 0; border-radius: 3px; background: transparent; color: var(--red); font: 700 20px/1 var(--display); cursor: pointer; }
.gap::before { content: ""; position: absolute; top: 0; bottom: 0; left: -5px; right: -5px; }
.gap:hover { background: var(--ink-soft); }
.gap.on { width: 13px; }
.row-cnt { font-size: 13px; color: var(--muted); white-space: nowrap; }
.row-del { width: 40px; height: 40px; flex: none; border: 0; border-radius: 6px; background: none; font-size: 22px; color: var(--muted); cursor: pointer; }
.row-del:hover { background: var(--red-soft); color: var(--red); }
.row-bottom { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 6px 0 0 30px; }
.row-ans { width: 170px; height: 40px; font-size: 16px; }
.row-ans[aria-invalid="true"] { border-color: var(--red); }
.tag, .tag-btn { font-size: 12.5px; font-weight: 700; padding: 3px 8px; border-radius: 4px; line-height: 1.4; }
.tag.doom { background: var(--ink-soft); color: var(--ink); }
.tag.warn { background: var(--red-soft); color: var(--red); }
.tag.mine { background: #eef5ea; color: #3f6d31; }
.tag-btn { border: 1px solid var(--line); background: #fff; cursor: pointer; min-height: 32px; }
.tag-btn:hover { border-color: var(--ink); color: var(--ink); }
.row-note, .row-msg { margin: 6px 0 0 30px; font-size: 13.5px; color: var(--muted); }
.row-msg { color: var(--red); }

/* ---------- reguli ---------- */
.rules, .faq { padding: 52px max(16px, calc((100% - 1240px) / 2)); }
.rules { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rules h2, .faq h2 { font-size: clamp(26px, 2.8vw, 34px); font-weight: 800; }
.rules-intro { max-width: 52em; color: var(--muted); font-size: 17px; }
.rule-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 26px 0 18px; border-top: 2px solid var(--text); }
.rule-grid article { padding: 16px 18px 20px 0; border-bottom: 1px solid var(--line); }
.rule-grid article + article { padding-left: 18px; border-left: 1px solid var(--line); }
.rule-grid article:nth-child(4n + 1) { padding-left: 0; border-left: 0; }
.rule-grid h3 { font-size: 17px; margin-bottom: 6px; }
.rule-grid p { margin: 0 0 10px; font-size: 15px; color: var(--muted); }
.rule-grid .ex { display: flex; flex-wrap: wrap; gap: 6px 16px; font: 700 21px/1.2 var(--display); margin: 0; }
.sources { font-size: 14px; color: var(--muted); max-width: 60em; }

.faq details { border-bottom: 1px solid var(--line); max-width: 860px; }
.faq summary { cursor: pointer; padding: 16px 0; font-weight: 700; font-size: 17px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--ink); font-size: 22px; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 18px; color: var(--muted); max-width: 46em; }

.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 26px max(16px, calc((100% - 1240px) / 2)); background: #fff; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.foot nav { display: flex; gap: 18px; margin-left: auto; }
.foot nav a { padding: 8px 0; }

.print-pages { display: none; }

/* ---------- pagini simple (despre, confidențialitate) ---------- */
.doc { max-width: 760px; margin: 0 auto; padding: 44px 16px 64px; }
.doc h1 { font-size: clamp(30px, 4vw, 42px); font-weight: 800; margin-bottom: 18px; }
.doc h2 { font-size: 22px; margin: 30px 0 8px; }
.doc p, .doc li { font-size: 17px; }
.doc .back { display: inline-flex; align-items: center; min-height: 40px; margin-top: 20px; font-weight: 700; }

/* ---------- ecrane mici ---------- */
@media (max-width: 1080px) {
  .check { grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; }
  .work { grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; }
  .rule-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rule-grid article:nth-child(4n + 1) { padding-left: 18px; border-left: 1px solid var(--line); }
  .rule-grid article:nth-child(2n + 1) { padding-left: 0; border-left: 0; }
}
@media (max-width: 860px) {
  .bar { gap: 10px; flex-wrap: wrap; }
  .bar nav { margin-left: 0; width: 100%; }
  .bar nav a { padding: 10px 10px; }
  .check { grid-template-columns: 1fr; gap: 0; padding-top: 22px; }
  .check-main, .check-out { display: contents; }
  .check h1 { order: 1; } .lede { order: 2; } .check-form { order: 3; } .board { order: 4; min-height: 0; margin-top: 18px; }
  .board-count { order: 5; } .peek { order: 6; max-width: 440px; margin: 6px 0 22px; } .why { order: 7; } #check-add { order: 8; justify-self: start; }
  .peek-paper { height: 250px; overflow: hidden; transform: none; }
  .peek-cap { margin-top: 10px; }
  .work { grid-template-columns: 1fr; }
  .words { position: static; max-height: none; order: -1; }
  .options { gap: 14px; }
}
@media (max-width: 560px) {
  .bar nav { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
  .bar nav a { min-height: 40px; display: flex; align-items: center; }
  .check-row { flex-direction: column; }
  .check-row input { flex: none; width: 100%; }
  .check-row button { width: 100%; }
  .chips-label { width: 100%; }
  .lede { font-size: 16px; }
  .rule-grid { grid-template-columns: 1fr; }
  .rule-grid article + article, .rule-grid article:nth-child(4n + 1), .rule-grid article:nth-child(2n + 1) { padding-left: 0; border-left: 0; }
  .tool-head .btn { width: 100%; }
  .actions .btn { flex: 1 1 100%; }
  .row-bottom, .row-note, .row-msg { margin-left: 0; }
  .row-ans { width: 100%; }
  .tag-btn { min-height: 40px; }
  .foot nav a { min-height: 40px; display: inline-flex; align-items: center; }
  .foot nav { margin-left: 0; }
  .paper-stamp { font-size: 12px; padding: 4px 6px 3px; }
}

/* ---------- tipar: doar paginile fișei ---------- */
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  body > *:not(.print-pages) { display: none !important; }
  .print-pages { display: block !important; }
  .print-pages svg { display: block; width: 210mm; height: 297mm; break-after: page; page-break-after: always; }
  .print-pages svg:last-child { break-after: auto; page-break-after: auto; }
}
