/* "Sticker Sheet" design: lilac ground, ink outlines, hard offset shadows. */

@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url('../fonts/bricolage-grotesque-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url('../fonts/bricolage-grotesque-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/dm-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/dm-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #1B1B1F;
  --ground: #EDE7FF;
  --muted: #3A3945;
  --white: #FFFFFF;
  --lemon: #FFD84D;
  --tomato: #FF6B4A;
  --mint: #7DE0B5;
  --cobalt: #3D5AFE;
  --line: 2.5px solid var(--ink);
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
}
a { color: inherit; }
h1, h2, h3, p, ul, ol, dl, dd, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ---------- layout ---------- */

.page {
  max-width: 1232px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 56px) 72px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}
.main { display: flex; flex-direction: column; gap: 36px; }
.section { display: flex; flex-direction: column; gap: 22px; }
.section-head, .page-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
}
.section-actions, .button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.columns {
  display: grid; gap: 28px; align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
}

/* ---------- type ---------- */

.display {
  font-family: var(--display); font-weight: 800; line-height: 0.95; letter-spacing: -0.02em;
  font-size: clamp(40px, 6vw, 72px); text-wrap: balance;
}
.display-small { font-size: clamp(34px, 5vw, 52px); }
.h1 { font-family: var(--display); font-weight: 800; font-size: clamp(30px, 4vw, 40px); line-height: 1.05; letter-spacing: -0.01em; }
.h2 { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1.1; }
.lead { font-size: 18px; color: var(--muted); max-width: 46ch; }
.muted { color: var(--muted); }
.strong { font-weight: 700; }
.small { font-size: 14px; }
.hint { font-size: 14px; color: var(--muted); }

/* ---------- colours ---------- */

.is-white { background: var(--white); color: var(--ink); }
.is-lemon { background: var(--lemon); color: var(--ink); }
.is-mint { background: var(--mint); color: var(--ink); }
.is-tomato { background: var(--tomato); color: var(--ink); }
.is-cobalt { background: var(--cobalt); color: var(--white); }
.is-ink { background: var(--ink); color: var(--white); }

/* ---------- small parts ---------- */

.pill {
  display: inline-flex; align-items: center; padding: 3px 11px;
  border: 2px solid var(--ink); border-radius: 999px;
  font-weight: 700; font-size: 12.5px; line-height: 1.4; white-space: nowrap;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  background: var(--white); color: var(--ink);
  border: var(--line); border-radius: 999px; box-shadow: 3px 3px 0 var(--ink);
  font-family: var(--body); font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn-small { min-height: 40px; padding: 0 14px; font-size: 14px; box-shadow: 2px 2px 0 var(--ink); }
.btn-big {
  min-height: 60px; padding: 0 24px; border-radius: 18px; box-shadow: 4px 4px 0 var(--ink);
  font-family: var(--display); font-weight: 800; font-size: 18px;
}
.btn-mint { background: var(--mint); }
.btn-lemon { background: var(--lemon); }
.btn-tomato { background: var(--tomato); }
.btn-ink { background: var(--ink); color: var(--white); box-shadow: 3px 3px 0 rgba(27, 27, 31, 0.28); }
.btn-ink:hover { box-shadow: 4px 4px 0 rgba(27, 27, 31, 0.28); }
.btn-ink:active { box-shadow: 0 0 0 rgba(27, 27, 31, 0.28); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; padding: 0;
  background: var(--white); color: var(--ink);
  border: var(--line); border-radius: 50%; box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer; text-decoration: none; transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.icon-btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.icon-btn-small { box-shadow: 2px 2px 0 var(--ink); }
.icon-btn-small:hover { background: var(--tomato); }

.bar {
  display: block; height: 16px; overflow: hidden;
  background: var(--white); border: var(--line); border-radius: 999px;
}
.bar-thin { height: 12px; border-width: 2px; }
.bar-fill { display: block; height: 100%; background: var(--ink); transition: width 0.3s ease; }

.panel {
  display: flex; flex-direction: column; gap: 18px;
  padding: clamp(20px, 3vw, 28px);
  background: var(--white); border: var(--line); border-radius: 24px; box-shadow: 6px 6px 0 var(--ink);
}
.panel.is-lemon { background: var(--lemon); }
.panel.is-mint { background: var(--mint); }
.panel-narrow { max-width: 560px; }
.tilt-left { transform: rotate(-1deg); }

.flash {
  align-self: flex-start; padding: 10px 18px;
  background: var(--mint); border: var(--line); border-radius: 14px; box-shadow: 4px 4px 0 var(--ink);
  font-weight: 700; transform: rotate(-1deg);
}
.errors {
  padding: 12px 18px; background: var(--tomato); border: var(--line); border-radius: 14px;
  font-weight: 700; display: flex; flex-direction: column; gap: 4px;
}

/* ---------- top bar ---------- */

.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.topbar-end { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.logo {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  background: var(--lemon); border: var(--line); border-radius: 14px; box-shadow: 4px 4px 0 var(--ink);
  font-family: var(--display); font-weight: 800; font-size: 24px;
}
.logo-big { font-size: 30px; min-height: 52px; padding: 0 20px; }
/* Logo sticker with a small "by plunge" label stuck over its bottom edge. */
.brand {
  flex: none; display: inline-flex; flex-direction: column; align-items: flex-start;
  text-decoration: none; transform: rotate(-2deg);
}
.byline {
  position: relative; margin: -6px 0 0 20px; padding: 1px 8px 2px;
  background: var(--white); border: 2px solid var(--ink); border-radius: 999px;
  font-size: 11px; font-weight: 500; line-height: 1.3; white-space: nowrap;
  transform: rotate(4deg);
}
.byline b { font-family: var(--display); font-weight: 800; letter-spacing: 0.01em; }
.brand-big .byline { margin: -7px 0 0 26px; padding: 2px 10px 3px; font-size: 13px; }
.nav { display: flex; align-items: center; gap: 8px; }
.nav-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px;
  border-radius: 999px; font-weight: 700; font-size: 15px; text-decoration: none;
}
.nav-link:hover { background: var(--white); }
.nav-link.is-active { background: var(--ink); color: var(--white); }
.lang {
  display: flex; overflow: hidden;
  background: var(--white); border: var(--line); border-radius: 999px;
}
.lang-btn {
  min-width: 44px; min-height: 40px; padding: 0 10px;
  background: transparent; border: 0; font-weight: 700; font-size: 13px; cursor: pointer;
}
.lang-btn:hover { background: var(--lemon); }
.lang-btn.is-active { background: var(--ink); color: var(--white); }
.lang-btn:focus-visible { outline-offset: -3px; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 46px; height: 46px;
  background: var(--mint); border: var(--line); border-radius: 50%;
  font-family: var(--display); font-weight: 800; font-size: 18px; text-decoration: none;
}
.avatar.is-active { background: var(--ink); color: var(--white); }
.avatar-static.is-white { background: var(--white); }

/* ---------- home ---------- */

.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 40px; }
.hero-text { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.hero-card {
  flex: 1 1 380px; min-width: 0;
  display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding: 28px;
  border: var(--line); border-radius: 24px; box-shadow: 8px 8px 0 var(--ink);
  text-decoration: none; transform: rotate(1.5deg); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
a.hero-card:hover { transform: rotate(0.5deg) translate(-2px, -2px); box-shadow: 11px 11px 0 var(--ink); }
.hero-card .bar, .hero-card-foot { align-self: stretch; }
.hero-card-title { font-family: var(--display); font-weight: 800; font-size: clamp(28px, 3.4vw, 36px); line-height: 1.05; }
.hero-card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 24px; }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 14px;
  min-height: 220px; padding: 20px;
  border: var(--line); border-radius: 20px; box-shadow: 5px 5px 0 var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tile:nth-child(4n + 1) { transform: rotate(-1deg); }
.tile:nth-child(4n + 2) { transform: rotate(1deg); }
.tile:nth-child(4n + 3) { transform: rotate(-0.5deg); }
.tile:nth-child(4n + 4) { transform: rotate(0.8deg); }
.tile:hover, .tile:focus-within { transform: rotate(0deg) translate(-2px, -3px); box-shadow: 8px 9px 0 var(--ink); }
.tile-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile-title { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1.08; overflow-wrap: anywhere; }
.tile-link { text-decoration: none; }
.tile-link::after { content: ""; position: absolute; inset: 0; border-radius: 18px; }
.tile-foot { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.tile-foot .bar, .tile-meta { align-self: stretch; }
.tile-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 500; }
.tile-edit {
  position: absolute; z-index: 1; top: -14px; right: 14px;
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px;
  background: var(--white); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 999px; box-shadow: 2px 2px 0 var(--ink);
  font-weight: 700; font-size: 13px; text-decoration: none;
}
.tile-edit:hover { background: var(--lemon); }

/* ---------- forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field > legend { font-weight: 700; font-size: 14px; }
.field > legend { margin-bottom: 6px; }
.field small { font-size: 13px; color: var(--muted); }
.field-row { display: flex; flex-wrap: wrap; gap: 16px; }
.field-grow { flex: 1 1 240px; }
input[type="text"], input[type="password"], input[type="date"], select, textarea {
  width: 100%; min-height: 46px; padding: 9px 14px;
  background: var(--white); border: var(--line); border-radius: 12px; font-size: 16px;
}
textarea { resize: vertical; line-height: 1.4; }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--ink); }
.choice { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
fieldset:disabled .choice, input:disabled { cursor: not-allowed; opacity: 0.6; }

.form-grid {
  display: grid; gap: 28px; align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
}
.form-wide { grid-column: 1 / -1; }
.stack-form { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }

.grants { display: flex; flex-direction: column; border-top: 2px solid var(--ink); }
.grant {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  padding: 12px 0; border-bottom: 2px solid var(--ink);
}
.grant-until { display: flex; align-items: center; gap: 10px; }
.grant-until input { width: auto; min-height: 40px; padding: 6px 10px; }

.swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.swatch {
  position: relative; width: 48px; height: 48px;
  border: var(--line); border-radius: 14px; cursor: pointer;
}
.swatch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.swatch:has(input:checked) { box-shadow: 4px 4px 0 var(--ink); transform: translate(-2px, -2px) rotate(-4deg); }
.swatch:has(input:focus-visible) { outline: 3px solid var(--cobalt); outline-offset: 3px; }

.danger {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border: 2.5px dashed var(--ink); border-radius: 18px; font-size: 15px;
}

.details summary { font-weight: 700; cursor: pointer; }
.facts { display: flex; flex-direction: column; gap: 10px; }
.facts div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }
.facts dt { font-weight: 500; }
.facts dd { font-weight: 700; }

/* ---------- admin lists ---------- */

.rows { display: flex; flex-direction: column; gap: 14px; }
.row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 18px;
  background: var(--white); border: var(--line); border-radius: 18px; box-shadow: 4px 4px 0 var(--ink);
}
.row-main { flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.row-title { font-family: var(--display); font-weight: 800; font-size: 19px; line-height: 1.2; }
.row-tags { display: flex; flex-wrap: wrap; gap: 8px; }

.card-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; flex: 1 1 0; min-width: 0; }
.panel.card-form { flex-direction: row; }
.card-list { display: flex; flex-direction: column; gap: 12px; }
.card-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--white); border: var(--line); border-radius: 16px;
}
.card-row .card-form { align-items: center; }
.card-row:target { background: var(--lemon); }
.card-number { flex: none; min-width: 26px; font-family: var(--display); font-weight: 800; font-size: 16px; text-align: center; }

/* ---------- login ---------- */

.page-center { min-height: 100vh; }
.login { position: relative; width: 100%; max-width: 440px; margin: clamp(8px, 5vh, 56px) auto 0; }
.login-card { position: relative; }
.login-deco { position: absolute; inset: 0; border: var(--line); border-radius: 24px; }
.login-deco-a { background: var(--cobalt); transform: rotate(5deg); }
.login-deco-b { background: var(--tomato); transform: rotate(-4deg); }

/* ---------- study ---------- */

.page-study { max-width: 560px; min-height: 100vh; min-height: 100dvh; padding-top: 20px; padding-bottom: 24px; gap: 0; }
.page-study .main { flex: 1; }
.study { flex: 1; display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.study-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.study-title { flex: 1; min-width: 0; text-align: center; font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.study-position { font-family: var(--display); font-weight: 800; font-size: 15px; padding: 5px 12px; border-width: 2.5px; }
.study-round { flex: 1; display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.study-done { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 24px 6px; }

.stack { position: relative; flex: 1; display: flex; min-height: 300px; max-height: 640px; padding: 14px 8px 18px; }
.stack-sheet { position: absolute; border: var(--line); border-radius: 28px; }
.stack-sheet.is-cobalt { inset: 20px 10px 12px 14px; transform: rotate(4deg); }
.stack-sheet.is-tomato { inset: 18px 14px 14px 10px; transform: rotate(-3deg); }

.flip {
  position: relative; flex: 1; padding: 0; background: none; border: 0; border-radius: 28px;
  cursor: pointer; perspective: 1400px; -webkit-tap-highlight-color: transparent;
}
.flip-inner {
  position: absolute; inset: 0; display: block;
  transform-style: preserve-3d; transition: transform 0.5s cubic-bezier(0.3, 1.35, 0.5, 1);
}
.flip.is-flipped .flip-inner { transform: rotateY(180deg); }
.flip.no-anim .flip-inner { transition: none; }
.flip.is-dealt { animation: deal 0.32s cubic-bezier(0.2, 1.2, 0.4, 1); }
@keyframes deal {
  from { transform: translate(24px, 18px) rotate(5deg); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}
.face {
  position: absolute; inset: 0; padding: 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--white); border: var(--line); border-radius: 28px; box-shadow: 6px 6px 0 var(--ink);
  backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden;
}
.face-back { background: var(--lemon); transform: rotateY(180deg); }
.face .pill { align-self: flex-start; border-width: 2.5px; font-size: 13px; padding: 4px 12px; }
.face-text {
  flex: 1; min-height: 0; width: 100%; overflow-y: auto;
  display: flex; flex-direction: column; justify-content: center;
  font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1.1; letter-spacing: -0.01em;
  text-align: center; text-wrap: balance; white-space: pre-line; overflow-wrap: anywhere;
}
.face-text.is-short { font-size: 46px; line-height: 1; letter-spacing: -0.02em; }
.face-text.is-long { font-size: 24px; line-height: 1.2; }
.face-text.is-very-long { font-family: var(--body); font-weight: 500; font-size: 18px; line-height: 1.4; letter-spacing: 0; justify-content: flex-start; }
.face-hint { font-weight: 500; font-size: 15px; color: var(--muted); }

.answer-row { display: flex; gap: 14px; }
.answer-row .btn { flex: 1; white-space: normal; }
.keys-hint { text-align: center; }
@media (hover: none) { .keys-hint { display: none; } }

/* ---------- small screens ---------- */

@media (max-width: 560px) {
  .page { gap: 28px; padding-top: 20px; }
  .card-row { flex-wrap: wrap; }
  .nav-link { padding: 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
