/* ITALIANO — neo-brutalist flashcards */
:root {
  --paper:  #f2efe6;
  --card:   #ffffff;
  --ink:    #121210;
  --green:  #00a063;
  --red:    #e5352b;
  --blue:   #2f55ff;
  --yellow: #ffd23f;
  --dot:    rgba(18,18,16,.06);
  --sh:    5px 5px 0 var(--ink);
  --sh-sm: 3px 3px 0 var(--ink);
  --bd:  3px solid var(--ink);
  --bd2: 2px solid var(--ink);
  --sans: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --mono: 'Space Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Screens */
.screen { display: none; max-width: 600px; margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px calc(34px + env(safe-area-inset-bottom)); }
.screen.active { display: block; }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 12px; padding: 6px 0 18px; }
.brand { font-family: var(--sans); font-weight: 700; font-size: 26px; letter-spacing: -.04em; }
.flagbox { display: inline-grid; place-items: center; width: 30px; height: 30px;
  border: var(--bd2); vertical-align: middle; font-size: 16px; transform: translateY(-2px); }
.ghost { font-family: var(--mono); font-weight: 700; text-transform: uppercase; font-size: 13px;
  letter-spacing: .04em; background: none; border: none; color: var(--ink); cursor: pointer; padding: 6px; }
.topbar #reset-btn, .topbar .counter { margin-left: auto; }
.topbar .ghost:first-child { margin-left: -6px; }

/* Buttons */
.btn { font-family: var(--sans); font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
  font-size: 16px; color: var(--ink); background: var(--card); border: var(--bd);
  box-shadow: var(--sh); cursor: pointer; padding: 14px 18px;
  transition: transform .05s ease, box-shadow .05s ease; }
.btn:active { transform: translate(5px,5px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: .45; box-shadow: var(--sh-sm); }
.btn.block { display: block; width: 100%; }

/* Hero */
.hero { border: var(--bd); background: var(--yellow); box-shadow: var(--sh); padding: 20px; }
.hero-grid { display: flex; align-items: center; gap: 18px; }
.hero-num { font-family: var(--sans); font-weight: 700; font-size: 92px; line-height: .8;
  letter-spacing: -.05em; }
.hero-label { font-family: var(--mono); font-weight: 700; text-transform: uppercase;
  font-size: 15px; line-height: 1.15; letter-spacing: .04em; }
.stat-line { font-family: var(--mono); font-size: 12px; letter-spacing: .02em; margin: 14px 0 0;
  border-top: var(--bd2); padding-top: 10px; }
.study-all { background: var(--ink); color: var(--paper); font-size: 18px; margin-top: 14px; }
.chip { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .02em;
  background: var(--card); box-shadow: var(--sh-sm); margin-top: 10px; width: 100%; padding: 11px; }

/* How it works */
.howto { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; border: var(--bd2);
  background: var(--card); padding: 12px 14px; margin-top: 16px; }
.howto strong { color: var(--ink); }
.howto em { font-style: normal; background: var(--yellow); padding: 0 4px; border: 1.5px solid var(--ink); }
.kw { font-weight: 700; }
.kw.red { color: var(--red); } .kw.green { color: var(--green); } .kw.blue { color: var(--blue); }

/* Section title */
.section-title { font-family: var(--mono); font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; font-size: 13px; margin: 26px 2px 12px; }

/* Deck list */
.deck-list { display: flex; flex-direction: column; gap: 12px; }
.deck { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--card); border: var(--bd); box-shadow: var(--sh); padding: 13px; cursor: pointer;
  transition: transform .05s ease, box-shadow .05s ease; }
.deck:active { transform: translate(5px,5px); box-shadow: 0 0 0 var(--ink); }
.deck-emoji { flex: 0 0 auto; width: 56px; height: 56px; display: grid; place-items: center;
  font-size: 28px; border: var(--bd2); background: var(--paper); }
.deck-body { flex: 1; min-width: 0; }
.deck-name { font-family: var(--sans); font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.deck-blurb { font-family: var(--mono); font-size: 11px; color: #57544c; margin: 2px 0 8px; }
.deck-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
.tag { font-family: var(--mono); font-weight: 700; font-size: 10px; text-transform: uppercase;
  letter-spacing: .03em; padding: 2px 6px; border: var(--bd2); }
.tag.due { background: var(--red); color: #fff; }
.tag.new { background: var(--green); color: #fff; }
.tag.ok { background: var(--paper); }
.tag.mastered { background: var(--yellow); }
.bar { height: 12px; border: var(--bd2); background: var(--paper); overflow: hidden; }
.bar-fill { height: 100%; background: var(--green); }
.deck-arrow { font-weight: 700; font-size: 22px; flex: 0 0 auto; }
.foot { font-family: var(--mono); font-size: 11px; text-align: center; color: #57544c;
  letter-spacing: .03em; margin-top: 24px; }

/* Study bar */
.study-bar { gap: 10px; }
.progress-wrap { flex: 1; height: 14px; border: var(--bd2); background: var(--card); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--ink); transition: width .2s ease; }
.counter { font-family: var(--mono); font-weight: 700; font-size: 13px; min-width: 46px; text-align: right; }

/* Card */
.study-body { display: flex; flex-direction: column; }
.card { width: 100%; background: var(--card); border: var(--bd); box-shadow: var(--sh);
  min-height: 330px; display: flex; flex-direction: column; cursor: pointer; overflow: hidden; }
.card-top { display: flex; justify-content: space-between; align-items: center;
  border-bottom: var(--bd2); padding: 9px 13px; background: var(--paper); }
.meta-tag { font-family: var(--mono); font-weight: 700; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .06em; }
.meta-tag.hint { color: var(--green); }
.prompt { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 28px 20px; }
.answer { border-top: 3px dashed var(--ink); display: flex; flex-direction: column; align-items: center;
  gap: 13px; padding: 22px 20px; background: var(--paper); }
.answer[hidden] { display: none; } /* author display rule otherwise overrides the [hidden] attr */
.card.revealed .answer { animation: reveal .14s ease; }
@keyframes reveal { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.word { font-family: var(--sans); font-weight: 700; text-align: center; line-height: 1.04;
  letter-spacing: -.035em; }
.word.it { font-size: 46px; }
.word.en { font-size: 34px; }
.phon { font-family: var(--mono); font-size: 15px; color: #57544c; }
.note { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; border: var(--bd2);
  background: var(--yellow); color: var(--ink); padding: 9px 12px; max-width: 100%; }
.speak { width: 58px; height: 58px; display: grid; place-items: center; font-size: 24px;
  border: var(--bd); background: var(--green); color: #fff; box-shadow: var(--sh-sm); cursor: pointer;
  transition: transform .05s ease, box-shadow .05s ease; }
.speak:active { transform: translate(3px,3px); box-shadow: 0 0 0 var(--ink); }

.reveal { background: var(--yellow); margin-top: 16px; }

/* Rating */
.rating { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-top: 16px; }
.rate { display: flex; flex-direction: column; align-items: center; gap: 3px; color: #fff;
  padding: 14px 6px; font-size: 16px; }
.rate small { font-family: var(--mono); font-weight: 700; font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .04em; opacity: .92; }
.rate.again { background: var(--red); } .rate.good { background: var(--green); } .rate.easy { background: var(--blue); }

/* Done */
.done-wrap { text-align: center; padding-top: 13vh; }
.done-emoji { font-size: 54px; line-height: 1; }
.done-wrap h2 { font-family: var(--sans); font-weight: 700; text-transform: uppercase;
  letter-spacing: -.03em; font-size: 40px; line-height: .95; margin: 16px 0 12px; }
#done-summary { font-family: var(--mono); font-size: 14px; line-height: 1.9; }
.done-tag { display: inline-block; border: var(--bd2); padding: 2px 9px; font-family: var(--mono);
  font-weight: 700; font-size: 12px; color: #fff; margin: 3px; }
.done-tag.again { background: var(--red); } .done-tag.good { background: var(--green); } .done-tag.easy { background: var(--blue); }
.done-wrap .study-all { max-width: 300px; margin: 26px auto 0; }

/* ===== Matching game ===== */
.match-launch { background: var(--blue); color: #fff; margin-top: 10px; }
.match-headline { flex: 1; text-align: center; font-family: var(--mono); font-weight: 700;
  font-size: 14px; letter-spacing: .04em; }
.match-controls { display: flex; gap: 10px; margin: 2px 0 16px; }
.msel { flex: 1; font-family: var(--mono); font-weight: 700; font-size: 13px; letter-spacing: .02em;
  color: var(--ink); background: var(--card); border: var(--bd); box-shadow: var(--sh-sm);
  padding: 11px 12px; cursor: pointer; border-radius: 0; }
.chip2 { font-family: var(--mono); font-weight: 700; font-size: 13px; letter-spacing: .03em;
  border: var(--bd); background: var(--yellow); color: var(--ink); box-shadow: var(--sh-sm);
  padding: 11px 15px; cursor: pointer; white-space: nowrap; }
.chip2:active { transform: translate(3px,3px); box-shadow: 0 0 0 var(--ink); }
.match-board { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.mcol { display: flex; flex-direction: column; gap: 10px; }
.tile { font-family: var(--sans); font-weight: 700; font-size: 15px; line-height: 1.12; text-align: center;
  color: var(--ink); background: var(--card); border: var(--bd); box-shadow: var(--sh-sm);
  min-height: 62px; padding: 10px 8px; display: grid; place-items: center; cursor: pointer;
  word-break: break-word; transition: transform .05s ease, box-shadow .05s ease, background .12s ease; }
.tile.en { font-family: var(--mono); font-size: 12.5px; font-weight: 700; }
.tile.sel { background: var(--yellow); transform: translate(3px,3px); box-shadow: 0 0 0 var(--ink); }
.tile.matched { background: var(--green); color: #fff; border-color: var(--green);
  box-shadow: none; opacity: .5; cursor: default; pointer-events: none; }
.tile.wrong { background: var(--red); color: #fff; border-color: var(--red); animation: shake .32s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-5px)}
  40%{transform:translateX(5px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }
.match-win { text-align: center; padding-top: 10vh; }
.match-win-h { font-family: var(--sans); font-weight: 700; text-transform: uppercase;
  letter-spacing: -.03em; font-size: 40px; line-height: .95; margin: 14px 0 12px; }
#match-win-sub { font-family: var(--mono); font-size: 14px; line-height: 1.8; }
.match-win .study-all { max-width: 300px; margin: 24px auto 0; }

/* ===== Multiple-choice mode ===== */
.choices { display: grid; gap: 10px; margin-top: 16px; }
.opt { font-family: var(--sans); font-weight: 700; font-size: 17px; text-align: left; color: var(--ink);
  background: var(--card); border: var(--bd); box-shadow: var(--sh); padding: 14px 15px; cursor: pointer;
  display: flex; align-items: center; gap: 12px; width: 100%;
  transition: transform .05s ease, box-shadow .05s ease, background .12s ease, opacity .12s ease; }
.opt:active { transform: translate(5px,5px); box-shadow: 0 0 0 var(--ink); }
.opt .key { font-family: var(--mono); font-weight: 700; font-size: 12px; flex: 0 0 auto;
  width: 24px; height: 24px; display: grid; place-items: center; border: var(--bd2); }
.opt .opt-text { flex: 1; min-width: 0; }
.opt:disabled { cursor: default; }
.opt.correct { background: var(--green); color: #fff; border-color: var(--green); }
.opt.wrong { background: var(--red); color: #fff; border-color: var(--red); }
.opt.correct .key, .opt.wrong .key { border-color: rgba(255,255,255,.7); }
.opt.dim { opacity: .42; box-shadow: var(--sh-sm); }
