:root {
  --bg: #f7f2e8;
  --bg-2: #efe7d9;
  --panel: #fffdf8;
  --panel-2: #f4ecdf;
  --text: #1f2933;
  --muted: #6f7c86;
  --primary: #945637;
  --primary-2: #b66a44;
  --primary-soft: #f4e2d7;
  --success: #2f7a5a;
  --danger: #b1494b;
  --border: rgba(31, 41, 51, .14);
  --shadow: 0 14px 30px rgba(49, 38, 26, .10);
  --shadow-soft: 0 6px 16px rgba(49, 38, 26, .08);
  --radius: 16px;
  --display: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Times New Roman', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 12%, rgba(182, 106, 68, .09), transparent 42%),
    radial-gradient(circle at 86% 18%, rgba(42, 96, 130, .08), transparent 34%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 12px 13px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(148, 86, 55, .44);
  box-shadow: 0 0 0 3px rgba(182, 106, 68, .14);
}
textarea { min-height: 96px; resize: vertical; }

.app-shell { display: grid; grid-template-columns: 290px 1fr; min-height: 100vh; }
.sidebar {
  padding: 22px;
  background: linear-gradient(180deg, #f3ebdf, #ede3d2);
  border-right: 1px solid rgba(31, 41, 51, .1);
  position: sticky; top: 0; height: 100vh; backdrop-filter: blur(18px);
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; }
.brand-logo {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--primary), #7e462e);
  color: #fff;
  box-shadow: var(--shadow-soft);
}
.brand strong { display: block; font-size: 1.35rem; }
.brand-name { color: #1f2f3f; letter-spacing: .02em; }
.brand small, .muted { color: var(--muted); }
.sidebar-close-btn {
  margin-left: auto;
  min-width: 36px;
  padding: 6px 8px;
  line-height: 1;
}
.nav { display: grid; gap: 8px; }
.nav-main { padding-bottom: 190px; }
.sidebar-bottom {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 12px;
}
.nav-btn, .ghost, .primary, .danger, .success, .icon-btn, .file-btn {
  border-radius: 12px;
  padding: 11px 13px;
  color: var(--text);
  transition: .2s ease;
  background: transparent;
}
.nav-btn { text-align: left; color: #3f5367; }
.nav-btn:hover, .nav-btn.active {
  background: rgba(148, 86, 55, .14);
  color: #3f2418;
}
.nav-btn.active { box-shadow: inset 3px 0 0 #945637; }
.side-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 253, 248, .86);
  box-shadow: var(--shadow-soft);
}
.side-card strong { display: block; font-size: 2rem; }

.main { padding: 26px; overflow: visible; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -26px -26px 22px;
  padding: 18px 26px;
  background: rgba(247, 242, 232, .94);
  border-bottom: 1px solid rgba(31, 41, 51, .1);
  backdrop-filter: blur(8px);
}
.topbar h1 { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -.03em; font-size: clamp(1.7rem, 3vw, 2.6rem); }
.topbar > div:not(.top-actions):not(.profile-slot) { min-width: 0; flex: 1; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.icon-btn { display: none; background: #fff; border: 1px solid var(--border); }
.primary {
  background: linear-gradient(145deg, var(--primary), var(--primary-2));
  color: #fff;
  border: 1px solid rgba(124, 67, 43, .56);
  box-shadow: 0 6px 14px rgba(148, 86, 55, .22);
}
.ghost {
  border: 1px solid var(--border);
  background: #fff;
}
.danger {
  background: linear-gradient(145deg, var(--danger), #99373e);
  color: #fff;
  border: 1px solid rgba(125, 33, 44, .48);
}
.success {
  background: linear-gradient(145deg, var(--success), #245f46);
  color: #fff;
  border: 1px solid rgba(37, 89, 64, .5);
}
.primary:hover, .danger:hover, .success:hover { transform: translateY(-1px); }

.view { display: none; animation: fade .22s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.arrival {
  position: relative;
  overflow: hidden;
  margin-bottom: 18px;
  padding: 28px 28px 18px;
  border: 1px solid rgba(31, 41, 51, .1);
  border-radius: 28px;
  background:
    radial-gradient(560px 280px at 92% 0%, rgba(217, 138, 95, .32), transparent 68%),
    radial-gradient(420px 240px at 0% 100%, rgba(42, 96, 130, .12), transparent 70%),
    linear-gradient(165deg, #fffdf8 0%, #f3e7d6 100%);
  box-shadow: 0 18px 40px rgba(49, 38, 26, .1);
  animation: hero-in .55s ease both;
}
.arrival-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, .85fr);
  gap: 12px 28px;
  align-items: center;
}
.arrival-copy { min-width: 0; max-width: 40rem; }
.arrival-copy h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.35rem, 4.6vw, 4.15rem);
  margin: .12em 0 .28em;
  letter-spacing: -.03em;
  line-height: .98;
  text-wrap: balance;
}
.arrival-copy > p:last-of-type { margin: 0; max-width: 38rem; color: #3d4c5c; font-size: 1.05rem; }
.arrival-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.arrival-scene {
  position: relative;
  height: 300px;
  display: grid;
  place-items: center;
}
.arrival-disc {
  position: relative;
  z-index: 1;
  width: 196px;
  height: 196px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 36%, #3a4554, #12161c 72%);
  box-shadow: 0 22px 44px rgba(18, 22, 28, .32), 0 0 0 6px rgba(255, 253, 248, .78);
}
.arrival-disc::before {
  content: '';
  position: absolute;
  inset: -22px;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 138, 95, .42), transparent 68%);
  pointer-events: none;
}
.arrival-disc .rank-emblem { width: 158px; height: 158px; }
.arrival-disc .rank-emblem svg,
.arrival-disc .rank-emblem .rank-logo-img {
  width: 158px;
  height: 158px;
  filter: drop-shadow(0 10px 16px rgba(81, 225, 255, .28));
}
.arrival-float {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 7px;
  border-radius: 999px;
  background: rgba(255, 253, 248, .94);
  border: 1px solid rgba(31, 41, 51, .1);
  box-shadow: 0 12px 28px rgba(49, 38, 26, .14);
  animation: arrival-float 6.5s ease-in-out infinite alternate;
}
.arrival-float--streak { left: 0; top: 16px; }
.arrival-float--due {
  right: 0;
  bottom: 78px;
  padding: 8px 14px;
  animation-delay: -2.4s;
}
.arrival-float small { font-weight: 800; color: #3f2418; }
.arrival-float--due strong {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.55rem;
  line-height: 1;
  color: #945637;
}
.arrival-float .streak-orb {
  position: relative;
  width: 42px;
  min-width: 42px;
  height: 42px;
  animation: none;
}
.arrival-float .streak-orb span { font-size: .95rem; }
.arrival-float .streak-orb.streak-cosmic::after { display: none; }
.arrival-float .streak-orb.streak-pop { animation: pop .7s; }
.arrival-spark {
  position: absolute;
  z-index: 2;
  left: 0;
  bottom: 8px;
  width: 138px;
  height: 74px;
  display: flex;
  align-items: flex-end;
  gap: 5px;
  padding: 20px 10px 8px;
  border-radius: 16px;
  background: rgba(255, 253, 248, .94);
  border: 1px solid rgba(31, 41, 51, .1);
  box-shadow: 0 12px 28px rgba(49, 38, 26, .14);
}
.arrival-spark small {
  position: absolute;
  left: 10px;
  top: 6px;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.arrival-spark i {
  position: relative;
  flex: 1;
  height: 42px;
  border-radius: 4px;
  background: rgba(148, 86, 55, .14);
  overflow: hidden;
}
.arrival-spark i::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--h, 8) * 1%);
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, #e7b08a, #945637);
}
.arrival-spark i.is-today::after { background: linear-gradient(180deg, #ffe7b0, #d98a5f); }
.arrival-facts {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  margin: 16px 0 2px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}
.arrival-facts .stat {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
  width: auto;
  padding: 0;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.arrival-facts .stat + .stat { box-shadow: none; }
.arrival-facts .stat:first-child { flex-basis: 100%; }
#dashboard .arrival-facts .stat::before { display: none; }
.arrival-facts .stat span,
.arrival-facts .stat small {
  text-transform: none;
  letter-spacing: 0;
  font-size: .95rem;
  font-weight: 650;
  color: #4e5d6c;
}
.arrival-facts .stat:first-child span { display: none; }
.arrival-facts .stat:not(:first-child) small { display: none; }
.arrival-facts .stat:not(:first-child)::before {
  content: '·';
  color: #b7a898;
  margin-right: 8px;
}
.arrival-facts .stat:nth-child(2)::before { content: none; margin: 0; }
.arrival-facts .stat strong,
#dashboard .arrival-facts .stat:first-child strong {
  font-family: inherit;
  font-weight: 800;
  font-size: 1.02rem;
  color: var(--text);
  margin: 0;
  letter-spacing: 0;
}
#dashboard .arrival-facts .stat:first-child strong {
  font-size: 1.55rem;
}
@keyframes hero-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes arrival-float { to { transform: translateY(-8px); } }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .14em;
  color: #8a4f32;
  font-weight: 800;
}
#dashboard .stats-grid {
  margin-bottom: 6px;
}
.dashboard-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
#dashboard .dashboard-quick {
  margin-top: 16px;
}
.dashboard-extra-row { align-items: stretch; }
.dashboard-secondary-row { margin-top: 4px; opacity: .96; }
.suggested-review { display: grid; gap: 10px; }
.suggested-card {
  border: 1px solid rgba(31, 41, 51, .1);
  border-radius: 18px;
  background: linear-gradient(165deg, #fffdf8, #f6ede0);
  padding: 16px;
  box-shadow: var(--shadow-soft);
}
.suggested-card strong { font-size: 1.05rem; }
.activity-heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14px, 1fr));
  gap: 6px;
}
.heat-cell {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 5px;
  border: 0;
  background: #ece4d6;
  transition: transform .15s ease;
}
.heat-cell.level-1 { background: #f0d3bf; }
.heat-cell.level-2 { background: #e5aa84; }
.heat-cell.level-3 { background: #c97a4d; color: #fffdf8; }
.heat-cell.level-4 { background: #945637; color: #fffdf8; }
.heat-cell.level-3 .heat-day-label,
.heat-cell.level-4 .heat-day-label { color: rgba(255, 253, 248, .86); }
.heat-cell.is-today { box-shadow: inset 0 0 0 2px #1f2933; }
.activity-heatmap--stats .heat-cell:hover { transform: scale(1.12); z-index: 1; }

.stats-summary-grid { margin-top: 12px; }
.stats-page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.stats-chart-panel { min-width: 0; }
.stats-chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 220px;
  max-width: 100%;
  overflow: hidden;
}
.stats-chart-canvas-wrap--tall { height: 280px; }
#statistics .stats-chart-canvas-wrap {
  height: 260px;
}
#statistics .stats-chart-canvas-wrap.stats-chart-canvas-wrap--tall {
  height: 320px;
}
#statistics .stats-chart-canvas-wrap canvas {
  cursor: pointer;
}
.stats-chart-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.stats-chart-meta { margin: 0 0 10px; font-size: .92rem; }
.stats-day-detail { margin-top: 10px; min-height: 2.6em; }
.stats-calendar-heatmap { overflow: auto; }
.activity-heatmap--stats.activity-heatmap--range-7 {
  grid-template-columns: repeat(7, minmax(44px, 1fr));
  gap: 10px;
}
.activity-heatmap--stats.activity-heatmap--range-30 {
  grid-template-columns: repeat(7, minmax(28px, 1fr));
  gap: 7px;
}
.activity-heatmap--stats.activity-heatmap--range-90 {
  grid-template-columns: repeat(10, minmax(18px, 1fr));
  gap: 5px;
}
.activity-heatmap--stats.activity-heatmap--range-365 {
  grid-template-columns: repeat(auto-fill, minmax(11px, 1fr));
  gap: 4px;
}
.activity-heatmap--labeled .heat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  border-radius: 8px;
  aspect-ratio: auto;
}
.activity-heatmap--stats.activity-heatmap--range-7 .heat-cell {
  min-height: 72px;
  border-radius: 12px;
}
.activity-heatmap--stats.activity-heatmap--range-30 .heat-cell {
  min-height: 52px;
}
.heat-day-count { font-size: .95rem; line-height: 1; }
.heat-day-label { font-size: .68rem; color: #5d738a; text-transform: capitalize; }
.stats-heat-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 10px;
  font-size: .82rem;
  color: var(--muted);
}
.stats-heat-legend .heat-cell {
  width: 16px;
  height: 16px;
  aspect-ratio: 1 / 1;
  min-height: 0;
}

.community-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.community-tab {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 10px 14px;
  color: var(--text);
}
.community-tab.active {
  background: rgba(148, 86, 55, .14);
  border-color: rgba(148, 86, 55, .45);
  color: #3f2418;
  font-weight: 700;
}
.community-pane { display: block; }
.community-pane.hidden { display: none !important; }

.library-cards-root { display: grid; gap: 16px; }
.library-cards-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.library-cards-toolbar h3 { margin: 0; }
.stats-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stats-page-head { align-items: flex-start; }
.home-stats-charts {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}
.home-stats-charts .stats-chart-card { grid-column: span 2; }
.home-stats-charts .stats-chart-card.is-featured { grid-column: span 3; }
.stats-chart-card {
  border: 1px solid rgba(31, 41, 51, .1);
  border-radius: 20px;
  padding: 14px 14px 10px;
  background: #fffdf8;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 10px 24px rgba(49, 38, 26, .06);
}
.stats-chart-card .stats-chart-canvas-wrap {
  flex: 0 0 220px;
  height: 220px;
}
.stats-chart-card.is-featured .stats-chart-canvas-wrap {
  flex-basis: 250px;
  height: 250px;
}
.home-stats-charts .stats-chart-canvas-wrap canvas {
  cursor: pointer;
}
.stats-chart-card .stats-open-full {
  align-self: flex-start;
  margin-top: auto;
  flex-shrink: 0;
}
.stats-chart-card[data-chart-key="calendar"] .stats-chart-canvas-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
}
.activity-heatmap--home-card {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  min-width: 0;
}
.home-week-heatmap-row {
  display: grid;
  gap: 6px;
}
.home-week-heatmap-row--weekdays {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.home-week-heatmap-row--weekend {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 40%;
  margin-inline: auto;
}
.activity-heatmap--home-card .heat-cell {
  aspect-ratio: auto;
  width: 100%;
  min-height: 0;
  height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 2px;
  border-radius: 8px;
}
.activity-heatmap--home-card .heat-day-label {
  font-size: .62rem;
  line-height: 1.1;
  text-align: center;
}
.activity-heatmap--home-card .heat-day-count {
  font-size: .78rem;
}
.stats-chart-card.is-featured {
  border-color: rgba(217, 138, 95, .55);
  box-shadow: 0 16px 32px rgba(148, 86, 55, .12);
}
.stats-chart-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.stats-chart-card-head h4 { margin: 0; font-size: 1rem; font-weight: 800; }
.stats-featured-badge {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #7a3f24;
  background: #f4e2d7;
  border-radius: 999px;
  padding: 4px 8px;
}
.activity-heatmap--dashboard.activity-heatmap--range-7 {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.activity-heatmap--dashboard.activity-heatmap--range-30 {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.stats-home-head { align-items: center; }
.android-only { display: none !important; }
body.is-native-app .android-only { display: inline-flex !important; }

.streak-orb {
  position: relative;
  min-width: 150px;
  height: 150px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #1f2933;
  text-align: center;
  animation: pulse 2.6s infinite;
  border: 1px solid rgba(31, 41, 51, .14);
}
.streak-orb span { font-size: 3rem; font-weight: 900; line-height: .8; }
.streak-orb small { font-weight: 900; }
.streak-warm { background: radial-gradient(circle, #fff5e5, #efcba9 60%, #d99d72); box-shadow: 0 10px 22px rgba(153, 89, 57, .24); }
.streak-blue { background: radial-gradient(circle, #eef5fa, #c5dceb 58%, #8cb0c9); box-shadow: 0 10px 20px rgba(58, 97, 126, .2); animation-duration: 1.9s; }
.streak-violet { background: radial-gradient(circle, #f4edf8, #d8c3e8 58%, #af8fca); box-shadow: 0 10px 22px rgba(103, 76, 136, .22); animation-duration: 1.45s; }
.streak-cosmic { background: radial-gradient(circle, #fff7ed, #f1d8ba 35%, #c8966b 72%); box-shadow: 0 12px 24px rgba(146, 92, 57, .26); animation: pulse 1.4s infinite; }
.streak-cosmic::after { content: '✦ ✧ ✦'; position: absolute; top: 15px; color: #6f3f28; text-shadow: none; }
@keyframes pulse { 50% { transform: scale(1.035); filter: saturate(1.2); } }
@keyframes cosmicFlame { from { filter: hue-rotate(0deg) saturate(1.1); transform: scale(1); } to { filter: hue-rotate(22deg) saturate(1.6); transform: scale(1.055) rotate(-1deg); } }

.rank-showcase {
  --rank-a:#7a5b42;
  --rank-b:#c28a55;
  display: grid;
  grid-template-columns: 1fr 250px;
  gap: 20px;
  align-items: center;
  margin: 18px 0;
  padding: 22px 24px;
  border: 1px solid rgba(31, 41, 51, .1);
  border-radius: 24px;
  background:
    radial-gradient(380px 160px at 100% 0%, rgba(217, 138, 95, .18), transparent 70%),
    linear-gradient(145deg, #fffdf8, #f6ecde);
  box-shadow: var(--shadow);
}
.rank-emblem, .rank-mini-emblem { display: grid; place-items: center; background: transparent; border: 0; box-shadow: none; }
.rank-emblem {
  width: 170px;
  height: 170px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.rank-emblem svg, .rank-mini-emblem svg, .rank-logo-img { width: 165px; height: 165px; display: block; filter: none; }
.rank-emblem svg, .rank-emblem .rank-logo-img { width: 118px; height: 118px; }
.rank-logo-img { object-fit: contain; border-radius: 0; background: transparent; box-shadow: none; }
.rank-info h2 { margin: .1em 0 .4em; font-family: var(--display); font-weight: 600; letter-spacing: -.03em; font-size: clamp(1.8rem, 4vw, 3.1rem); }
.rank-progress { height: 10px; border-radius: 999px; background: rgba(31, 41, 51, .08); overflow: hidden; border: 0; }
.rank-progress span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--rank-a), var(--rank-b)); box-shadow: 0 0 14px rgba(194, 138, 85, .45); transition: width .55s ease; }
.rank-progress.boss-hp {
  height: 22px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.55);
}
.rank-progress.boss-hp span {
  background: linear-gradient(90deg, #ef4444 0%, #f97316 45%, #facc15 100%);
  box-shadow: 0 0 18px rgba(248, 113, 113, 0.75);
}
.rank-progress.small { height: 10px; margin-top: 8px; }
.shield-card, .mini-rank-status {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 253, 248, .92);
}
.shield-card strong, .mini-rank-status strong { display: block; font-size: 1.4rem; margin: .35rem 0; }
.shield-card button { width: 100%; font-size: .9rem; }
.rank-guide-head { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 22px; }
.rank-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; margin-top: 20px; }
.rank-row {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 16px;
  align-items: center;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fffdf8;
  box-shadow: var(--shadow-soft);
  opacity: .72;
}
.rank-row.reached { opacity: 1; }
.rank-row.current { outline: 2px solid var(--rank-b); box-shadow: 0 0 0 4px rgba(194, 138, 85, .18); }
.rank-row .rank-mini-emblem svg, .rank-row .rank-logo-img { width: 110px; height: 110px; }
.rank-row-info strong { display: block; font-size: 1.38rem; }
.rank-row-info span, .rank-row-info small { color: var(--muted); }

.stats-grid, .cards-grid, .mode-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.stat, .panel, .list-card, .mode-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}
.stat { padding: 20px; }
#dashboard .stat { position: relative; overflow: hidden; }
#dashboard .stat::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--primary-2), var(--primary));
}
.stat span { color: var(--muted); font-size: .82rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.stat strong { display: block; font-size: 2.2rem; margin: 8px 0; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
#dashboard .stat:first-child strong { color: var(--primary); font-size: 2.6rem; }
.panel { padding: 20px; margin-top: 18px; border-radius: 22px; }
#dashboard .dashboard-stats-panel {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 6px 0 0;
}
.stats-chart-card-head h4 { font-weight: 800; }
.panel-row { display: grid; grid-template-columns: 1.25fr .75fr; gap: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel h3 { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.list-stack, .level-stack, .table-list { display: grid; gap: 10px; }
.list-item, .card-row, .level-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 18px; background: #fff; }
.list-card { padding: 18px; }
.list-card h4 { font-size: 1.25rem; margin: 0 0 6px; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 10px; font-weight: 800; font-size: .82rem; }
.badge.l1 { background: #d9e3ef; color: #23476d; }
.badge.l2 { background: #d7efe6; color: #1f5b44; }
.badge.l3 { background: #d8ecf7; color: #1e5372; }
.badge.l4 { background: #e6def6; color: #553882; }
.badge.l5 { background: #f8e7d2; color: #7a4e20; }
.type-badge { display: inline-flex; border-radius: 999px; padding: 5px 9px; background: #e7edf4; color: #334155; font-size: .78rem; font-weight: 800; }
.card-row main p strong { color: #122033; font-weight: 800; }
.card-row main p { color: #2a3d50; }
.card-row main small { color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions button { padding: 8px 10px; border-radius: 12px; }
.card-form, .card-type-fields { display: grid; gap: 12px; }
.filters { display: flex; gap: 10px; min-width: 300px; }
.card-row { align-items: flex-start; }
.card-row main { padding: 0; flex: 1; }
.card-row p { margin: .35rem 0; color: var(--text); }
.empty-state {
  color: var(--muted);
  padding: 16px;
  border: 1px dashed rgba(31, 41, 51, .22);
  border-radius: 12px;
  background: rgba(255, 255, 255, .55);
}
.quizlet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.quizlet-area { min-height: 200px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; margin-bottom: 12px; }

.lists-library-panel { margin-top: 0; }
.lists-library-head { align-items: flex-start; flex-wrap: wrap; gap: 14px; }
.lists-library-subtitle { margin: 4px 0 0; font-size: .95rem; }
.lists-toolbar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.subtle-btn {
  font-size: .88rem;
  padding: 8px 11px;
  border-color: rgba(30, 42, 53, .14);
  color: #4f6277;
  background: #f5f8fb;
}
.subtle-btn:hover,
.subtle-btn.active {
  border-color: rgba(148, 86, 55, .4);
  color: #5b321f;
  background: var(--primary-soft);
}
.lists-library-root { display: grid; gap: 10px; }
.folder-accordion {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fffdf8;
  overflow: hidden;
}
.folder-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background .16s ease;
}
.folder-summary:hover { background: #f8f1e6; }
.folder-summary::-webkit-details-marker { display: none; }
.folder-summary-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding-left: 22px;
  position: relative;
}
.folder-summary-main::before {
  content: '▸';
  position: absolute;
  left: 0;
  top: 2px;
  color: #845036;
  font-size: .95rem;
}
details[open] > .folder-summary .folder-summary-main::before { content: '▾'; }
.folder-title { font-size: 1.02rem; }
.folder-desc, .folder-meta { font-size: .88rem; line-height: 1.35; }
.folder-summary-actions { flex-wrap: wrap; justify-content: flex-end; }
.folder-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
  background: #f7efe3;
}
.list-row-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}
.list-row-main h4 { margin: 0 0 4px; font-size: 1.06rem; }
.list-row-stats { margin: 6px 0 0; font-size: .92rem; color: #4f6277; }
.list-move { display: grid; gap: 4px; margin-top: 8px; max-width: 240px; font-size: .85rem; }
.list-move select { padding: 8px 10px; font-size: .9rem; }
.list-row-actions { justify-content: flex-end; }
.list-tool-panel {
  border-style: dashed;
  background: #fafafa;
}
.list-tool-panel .panel-head h3 { font-size: 1.02rem; }
.list-tool-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.list-tool-form .primary { grid-column: 1 / -1; justify-self: start; width: auto; min-width: 180px; }
.list-folder-field { display: grid; gap: 6px; }
.inline-empty { margin: 0; padding: 12px; font-size: .92rem; }

.leaderboard-list { display: grid; gap: 10px; }
.leaderboard-row {
  display: grid;
  grid-template-columns: 70px 1fr 160px;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}
.leaderboard-pos { font-weight: 900; color: var(--text); }
.leaderboard-user { display: flex; gap: 12px; align-items: center; min-width: 0; }
.leaderboard-meta { min-width: 0; }
.leaderboard-meta strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leaderboard-pp { text-align: right; font-weight: 900; }
.leaderboard-badge { width: 44px; height: 44px; display: grid; place-items: center; }
.rank-badge-img, .rank-badge-svg { width: 44px; height: 44px; display: block; }

.achievements-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.achievement-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  transition: .2s ease;
}
.achievement-card:hover { transform: translateY(-2px); border-color: rgba(148, 86, 55, .45); }
.achievement-card.locked { opacity: .45; filter: grayscale(1); }
.achievement-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: rgba(63,122,167,.12); font-size: 1.3rem; }
.achievement-info strong { display: block; }

.qcm-panel, .match-panel { margin-top: 14px; padding: 18px; border: 1px solid var(--border); border-radius: 22px; background: #fff; }
.qcm-question, .match-question { color: #122033; }
.qcm-option, .match-item { color: #1e2a35; background: #f8fafc; }
.level-mode-grid { align-items: end; }
.field-inline { display: grid; gap: 6px; font-size: .92rem; color: #4f6277; }
.level-mode-hint { margin: 8px 2px 0; font-size: .9rem; }
.qcm-question, .match-question { margin: 0 0 10px; font-size: 1.3rem; }
.qcm-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.qcm-option { text-align: left; }
.qcm-option.qcm-wrong { background: linear-gradient(135deg, #e7b5b7, #cf7d82) !important; color: #3c171a; }
.qcm-option.qcm-correct { background: linear-gradient(135deg, #bfe7d2, #7dc9a5) !important; color: #123828; }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.match-title { margin: 0 0 8px; color: var(--muted); font-weight: 900; letter-spacing: .04em; text-transform: uppercase; font-size: .82rem; }
.match-col { display: grid; gap: 10px; }
.match-item { text-align: left; }
.match-item.selected { outline: 2px solid rgba(214,167,95,.62); }
.match-item.solved { background: linear-gradient(135deg, #5fbf8f, #327c62) !important; opacity: .95; }
.match-wrong { animation: shake .35s; background: rgba(212,95,101,.25) !important; }

.study-setup h3 { font-size: 1.5rem; }
.mode-card { text-align: left; color: var(--text); padding: 20px; min-height: 130px; }
.mode-card:hover {
  transform: translateY(-3px);
  border-color: rgba(148, 86, 55, .45);
  background: #fff8f0;
}
.mode-card strong { display: block; font-size: 1.2rem; margin-bottom: 8px; }
.mode-card span { color: var(--muted); }
.study-options { margin-top: 16px; display: grid; gap: 12px; }
.option-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.quick-list-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px,1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.quick-list-picker label { display: flex; gap: 8px; align-items: center; }
.quick-list-picker input { width: auto; }
.study-session { max-width: 840px; margin: 0 auto; }
.session-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
#prevCard:disabled { opacity: .45; cursor: default; }
.session-end { margin-top: 18px; }
.session-end-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.session-end-actions .primary, .session-end-actions .ghost { width: auto; }
.flip-card { height: 430px; perspective: 1200px; }
.flip-card:focus { outline: none; }
.flip-card:focus-visible { outline: 2px solid rgba(42, 96, 130, .45); outline-offset: 4px; border-radius: 16px; }
.flip-inner { height: 100%; position: relative; transition: transform .55s; transform-style: preserve-3d; }
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-card.no-flip-transition .flip-inner { transition: none !important; transform: rotateY(0deg) !important; }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; display: grid; place-items: center; text-align: center; padding: 28px; border-radius: 34px; border: 1px solid #c9d6e3; background: #ffffff; box-shadow: var(--shadow); overflow: hidden; }
.flip-face.front { background: linear-gradient(170deg, #fffdf8, #f7efe2); border-color: #d7c8b1; }
.flip-face p {
  color: #122033;
  font-size: clamp(1.2rem, 4.2vw, 3.2rem);
  font-weight: 800;
  line-height: 1.22;
  margin: 0;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.flip-face p.text-long {
  font-size: clamp(1rem, 3vw, 2.25rem);
  line-height: 1.3;
}
.flip-face p.text-very-long {
  font-size: clamp(.9rem, 2.4vw, 1.65rem);
  line-height: 1.36;
}
.flip-face p.has-image {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.flip-face p.has-image .study-face-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
}
.flip-face small { position: absolute; top: 22px; left: 24px; color: #5d738a; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.flip-face.back { transform: rotateY(180deg); background: linear-gradient(170deg, #f3f8fc, #e6eff7); border-color: #b4c9dd; }
.session-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.session-actions .danger::after { content: '  ←'; }
.session-actions .success::after { content: '  →'; }
.hint { text-align: center; color: var(--muted); }

.cloze-form { gap: 14px; }
.cloze-large-text {
  min-height: 260px;
  max-height: 72vh;
  overflow: auto;
  line-height: 1.45;
}
.cloze-session-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.cloze-session-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.cloze-prompt-text {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 14px;
  min-height: 220px;
  max-height: 62vh;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.58;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
}
.cloze-word {
  display: inline;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
}
.cloze-word.is-hidden,
.cloze-word.is-hidden-static,
.cloze-word.is-revealed {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 2px;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.cloze-word.is-hidden {
  cursor: pointer;
  background: rgba(148, 86, 55, .14);
  color: #6b3d29;
}
.cloze-word.is-hidden:hover {
  border-color: rgba(148, 86, 55, .6);
  transform: translateY(-1px);
}
.cloze-word.is-hidden-static {
  background: #f3f6fa;
  color: #5e6c79;
}
.cloze-word.is-revealed {
  background: rgba(47, 122, 90, .15);
  color: #215940;
}
.cloze-initial {
  color: #335372;
  font-weight: 800;
  letter-spacing: .03em;
}
.cloze-initial-static {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  margin: 0 2px;
  border-radius: 10px;
  border: 1px dashed rgba(214,167,95,.45);
  background: rgba(184,138,68,.08);
}
.cloze-rewrite {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}
.cloze-feedback-success { color: #8de7b8; }
.cloze-feedback-error { color: #f2a4a8; }
.cloze-library-panel { margin-bottom: 0; }
.cloze-preview {
  max-height: 110px;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.45;
}

.settings-row, .button-row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.settings-row label { min-width: 220px; }
.sync-status {
  display: grid;
  gap: 4px;
  margin: 16px 0 18px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.sync-status strong { font-size: 1.1rem; }
.sync-status code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.file-btn { display: inline-flex; background: #fff; border: 1px solid var(--border); }
.file-btn input { display: none; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(80px);
  background: #fffdf8;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: .25s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.hidden { display: none !important; }
.shake { animation: shake .35s; }
.streak-pop { animation: pop .7s; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-4px); } }
@keyframes pop { 40% { transform: scale(1.16) rotate(-3deg); } 70% { transform: scale(.96); } }
dialog { border: 1px solid var(--border); border-radius: 24px; background: #fff; color: var(--text); box-shadow: var(--shadow); width: min(540px, 92vw); }
dialog::backdrop { background: rgba(0,0,0,.65); }
menu { display: flex; justify-content: flex-end; gap: 10px; padding: 0; }
.list-editor-dialog { width: min(760px, 96vw); max-height: 88vh; padding: 0; }
.list-editor-form { display: grid; gap: 12px; padding: 18px 18px 14px; margin: 0; }
.list-editor-form h3 { margin: 0 0 4px; }
.list-editor-form label { display: grid; gap: 6px; font-size: .92rem; color: #4f6277; }
.list-editor-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 4px; }
.list-editor-cards {
  display: grid;
  gap: 10px;
  max-height: 52vh;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fafc;
}
.list-editor-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.list-editor-card-main p { margin: .35rem 0 0; }
.list-editor-card-main p strong { color: #122033; }
.list-editor-actions { justify-content: flex-start; margin-top: 4px; padding: 0; }

.bottom-tabbar {
  display: none;
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 30;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  padding: 6px;
  border-radius: 28px;
  background: rgba(255, 253, 248, .94);
  border: 1px solid rgba(31, 41, 51, .1);
  box-shadow: 0 14px 34px rgba(49, 38, 26, .18);
  backdrop-filter: blur(16px);
}
.bottom-tabbar,
.bottom-tab-btn {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.bottom-tab-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  width: 100%;
  min-height: 48px;
  overflow: hidden;
  white-space: nowrap;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: #667584;
  font-size: .66rem;
  font-weight: 700;
  line-height: 1.1;
  padding: 6px 1px 5px;
  -webkit-appearance: none;
  appearance: none;
}
.bottom-tab-btn:focus { outline: none; }
.bottom-tab-btn:focus-visible { outline: 2px solid rgba(148, 86, 55, .45); outline-offset: -2px; }
.bottom-tab-btn:active { background: rgba(148, 86, 55, .12); color: #5b321f; }
.bottom-tab-btn .tab-ico { font-size: 1.15rem; line-height: 1; }
.bottom-tab-btn .tab-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bottom-tab-btn.active {
  color: #5b321f;
  background: rgba(148, 86, 55, .16);
}
#bottomDueBadge {
  position: absolute;
  top: 3px;
  right: calc(50% - 20px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  font-size: .62rem;
  padding: 0 4px;
  background: #b1494b;
  color: #fff;
}
#bottomDueBadge.is-zero { display: none; }

.profile-slot { position: relative; flex: none; }
.profile-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
}
.profile-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #945637, #c48462);
  color: #fffdf8;
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: .02em;
  box-shadow: 0 6px 16px rgba(148, 86, 55, .28);
}
.profile-avatar.is-guest {
  background:
    radial-gradient(circle at 50% 36%, #fffdf8 0 4.5px, transparent 5px),
    radial-gradient(ellipse at 50% 78%, #fffdf8 0 8px, transparent 8.5px),
    linear-gradient(145deg, #945637, #c48462);
}
.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  width: min(280px, calc(100vw - 28px));
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 20px;
  background: #fffdf8;
  border: 1px solid rgba(31, 41, 51, .12);
  box-shadow: 0 18px 40px rgba(49, 38, 26, .18);
}
.profile-menu[hidden] { display: none; }
.profile-identity { margin: 0; font-weight: 800; }
.profile-hint { margin: 0; color: var(--muted); font-size: .9rem; }
.profile-menu .primary,
.profile-menu .ghost { width: 100%; }
@media (max-width: 640px) {
  .profile-menu {
    position: fixed;
    top: 68px;
    right: 12px;
    left: 12px;
    width: auto;
  }
}

.sidebar-open-btn {
  position: fixed;
  left: 14px;
  top: 14px;
  z-index: 40;
}

body.sidebar-collapsed .sidebar {
  position: fixed;
  left: 0;
  top: 0;
  transform: translateX(-105%);
  pointer-events: none;
  z-index: 20;
}
body.sidebar-collapsed .app-shell {
  grid-template-columns: 1fr;
}
body.sidebar-collapsed .main {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}

body.is-native-app .app-shell { grid-template-columns: 1fr; }
body.is-native-app .sidebar {
  position: fixed;
  z-index: 20;
  width: min(86vw, 320px);
  transform: translateX(-105%);
  transition: .25s;
}
body.is-native-app .sidebar.open { transform: none; }
body.is-native-app .icon-btn { display: inline-flex; }
body.is-native-app .sidebar-close-btn { display: inline-flex; }
body.is-native-app .top-actions { display: none; }
body.is-native-app .bottom-tabbar { display: grid; }
body.is-native-app .main { padding-bottom: 118px; }

body.focus-mode .sidebar,
body.focus-mode .topbar,
body.focus-mode .bottom-tabbar,
body.focus-mode .sidebar-open-btn {
  display: none !important;
}
body.focus-mode .app-shell {
  grid-template-columns: 1fr;
}
body.focus-mode .main {
  padding: 12px 18px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  grid-column: 1 / -1;
}
body.focus-mode #study.view.active,
body.focus-mode #cloze.view.active {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
body.focus-mode #study.view.active #studySession,
body.focus-mode #cloze.view.active #clozeSessionPanel {
  width: 100%;
  max-width: min(1080px, 100%);
  margin-inline: auto;
}
body.focus-mode #cloze.view.active > .panel:not(#clozeSessionPanel) {
  display: none !important;
}
body.focus-mode #cloze.view.active #clozeSessionPanel {
  margin-top: 0;
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 20; transform: translateX(-105%); transition: .25s; width: 290px; }
  .sidebar.open { transform: none; }
  .main { padding: 18px; }
  .topbar { margin: -18px -18px 18px; padding: 14px 18px; }
  .icon-btn { display: inline-flex; }
  .stats-grid, .cards-grid, .mode-grid, .panel-row { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .arrival-layout { grid-template-columns: 1fr; }
  .arrival-scene { height: 270px; }
  .home-stats-charts { grid-template-columns: 1fr; }
  .home-stats-charts .stats-chart-card,
  .home-stats-charts .stats-chart-card.is-featured { grid-column: auto; }
  .filters { min-width: 0; flex-direction: column; }
  .rank-showcase { grid-template-columns: 1fr; }
  .shield-card { grid-column: 1 / -1; }
  .bottom-tabbar { display: grid; }
  .main { padding-bottom: 118px; }
  .sidebar-close-btn { display: inline-flex; }
}

@media (max-width: 900px) {
  .list-row-card { grid-template-columns: 1fr; }
  .list-row-actions { justify-content: flex-start; }
  .folder-summary { flex-direction: column; align-items: stretch; }
  .folder-summary-actions { justify-content: flex-start; }
}

@media (max-width: 900px) {
  .stats-page-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .arrival, .streak-orb, .view, .arrival-float { animation: none; }
  .rank-progress span { transition: none; }
}
@media (max-width: 640px) {
  .topbar { align-items: flex-start; }
  .top-actions { display: none; }
  .stats-grid, .cards-grid, .mode-grid, .panel-row, .option-grid, .rank-showcase { grid-template-columns: 1fr; }
  .arrival { padding: 20px 16px 14px; }
  .arrival-actions { flex-direction: column; }
  .arrival-actions .primary, .arrival-actions .ghost { width: 100%; }
  .arrival-facts { display: flex; }
  .rank-showcase { text-align: center; }
  .rank-emblem { display: grid; place-items: center; }
  .flip-card { height: 360px; }
  .flip-face { padding: 18px; }
  .flip-face p {
    font-size: clamp(1rem, 6vw, 1.6rem);
    padding: 8px;
  }
  .settings-row, .button-row, .session-actions { display: grid; grid-template-columns: 1fr; }
  .card-row, .list-item, .level-row, .rank-guide-head { display: grid; }
  .sidebar { width: 86vw; }
  .leaderboard-row { grid-template-columns: 1fr; text-align: left; }
  .leaderboard-pp { text-align: left; }
  .qcm-options { grid-template-columns: 1fr; }
  .match-grid { grid-template-columns: 1fr; }
  .cloze-session-controls { grid-template-columns: 1fr; }
  .cloze-large-text { min-height: 210px; }
  .cloze-prompt-text { min-height: 170px; }
  .lists-toolbar { width: 100%; justify-content: flex-start; }
  .list-tool-form { grid-template-columns: 1fr; }
  .dashboard-quick { flex-direction: column; }
  .sidebar-open-btn { top: 10px; left: 10px; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; }
}

input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  accent-color: #8a5a3b;
  flex: 0 0 auto;
}
.check-field {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}
.shadow-badge { background: #ece7df; color: #5c5148; }
.settings-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 12px;
}
.settings-nav button {
  text-align: left;
  background: rgba(255, 255, 255, .55);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  color: inherit;
}
.settings-nav button.active { background: #fff; font-weight: 800; }
.changelog-list { display: grid; gap: 10px; margin-top: 14px; }
.changelog-summary {
  width: 100%;
  display: grid;
  gap: 6px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  color: inherit;
}
.changelog-version { font-weight: 800; }
.changelog-tags, .changelog-details p { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.changelog-tag {
  display: inline-flex;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: .78rem;
  background: #efe7df;
}
.tag-bugfix { background: #f8d7d2; }
.tag-amélioration { background: #d9ecff; }
.tag-graphiques { background: #efe4ff; }
.tag-utilitaire { background: #e5f4df; }
.changelog-details { padding: 4px 6px 8px; }
.changelog-details p { display: block; margin: 10px 0; }

@media (max-width: 800px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .settings-nav button { flex: 1 1 auto; }
}