/* Round 7 (public/round7.js): mistakes notebook, journey map, owl levels and wardrobe,
   daily missions, progress insights. Uses the notebook tokens from style.css; private vars are --r7-*. */

:root {
  --r7-sand: color-mix(in srgb, var(--marker) 26%, var(--paper-raised));
  --r7-shallow: color-mix(in srgb, var(--ink-soft) 10%, transparent);
  --r7-gold: var(--star);
  --r7-silver: #b9c1cf;
  --r7-bronze: #c8834f;
  --r7-stamp: var(--red);
}

@media (prefers-color-scheme: dark) {
  :root {
    --r7-sand: color-mix(in srgb, var(--marker) 15%, var(--paper-raised));
    --r7-silver: #c9d0dc;
    --r7-bronze: #d9925e;
  }
}

.r7-intro {
  max-width: 40rem;
}

.r7-note {
  color: var(--pencil);
  font-weight: 700;
}

.r7-icon-mistakes svg,
.r7-icon-map svg,
.r7-icon-hanger svg,
.r7-icon-chart svg,
.r7-icon-kids svg,
.r7-icon-target svg {
  width: 100%;
  height: 100%;
}

/* ------------------------------------------------------------- home: owl level */

.r7-hero-owl {
  display: grid;
  justify-items: center;
  gap: 6px;
  flex: none;
}

/* phones: the owl and its level side by side, not stacked */
@media (max-width: 760px) {
  .r7-hero-owl {
    grid-auto-flow: column;
    align-items: center;
    gap: 16px;
  }
}

.r7-levelchip {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 9.5rem;
  min-height: 44px;
  padding: 6px 12px 8px;
  border: 2px solid var(--ink);
  border-radius: 12px 14px 11px 13px;
  background: var(--paper-raised);
  color: var(--text);
  cursor: pointer;
  transform: rotate(-2deg);
  box-shadow: 0 3px 0 var(--ink-deep);
  font: inherit;
}

.r7-levelchip:active {
  transform: rotate(-2deg) translateY(2px);
  box-shadow: 0 1px 0 var(--ink-deep);
}

.r7-levelchip-n {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--ink);
}

.r7-levelchip-name {
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.2;
  background: linear-gradient(176deg, transparent 12%, var(--marker-soft) 14% 88%, transparent 90%);
  padding: 0 4px;
}

.r7-levelchip-xp {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--pencil);
}

.r7-xpbar {
  display: block;
  width: 100%;
  min-width: 7rem;
  height: 9px;
  margin: 3px 0 1px;
  border-radius: 999px;
  background: var(--grid-line);
  border: 1px solid var(--grid-strong);
  overflow: hidden;
}

.r7-xpbar.is-thin {
  height: 6px;
  border: 0;
}

.r7-xpfill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--star);
}

/* the level card at the top of the shared header menu (its .mh-menu-top draws the frame) */
.r7-menu-level {
  display: grid;
  gap: 2px;
}

.r7-menu-level-text {
  font-weight: 800;
  color: var(--ink);
  font-size: 0.98rem;
}

.r7-menu-level-xp {
  font-size: 0.82rem;
  color: var(--pencil);
  font-weight: 700;
}

/* ------------------------------------------------------------- home: tiles */

.tile {
  position: relative;
}

.r7-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 999px;
  border: 2px solid var(--paper-raised);
  background: var(--red);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  transform: rotate(6deg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.r7-badge[hidden] {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .r7-badge {
    color: #1a0f12;
  }
}

/* ---------------------------------------------------------- daily missions */

.r7-missions {
  display: grid;
  gap: 10px;
  max-width: 34rem;
  padding: 16px 18px 14px;
  border: 2px solid var(--ink-soft);
  border-radius: 13px 16px 12px 15px;
  background: var(--paper-raised);
  outline: none;
}

.r7-missions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.r7-mission {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  min-height: calc(var(--cell) * 3);
  padding: 8px 0;
  border-top: 1px solid var(--grid-strong);
}

.r7-mission:first-child {
  border-top: 0;
}

.r7-mission-icon {
  font-size: 1.6rem;
  text-align: center;
  line-height: 1;
}

.r7-mission-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.r7-mission-text {
  font-weight: 700;
  line-height: 1.3;
}

.r7-mission-meter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.r7-meter {
  display: block;
  flex: 1 1 auto;
  max-width: 10rem;
  height: 8px;
  border-radius: 999px;
  background: var(--grid-line);
  overflow: hidden;
}

.r7-meter-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--ink-soft);
}

.r7-mission.is-done .r7-meter-fill {
  background: var(--ink);
}

.r7-mission-count {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.r7-mission-reward {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--pencil);
  white-space: nowrap;
}

.r7-claim {
  min-height: 46px;
  padding: 0 14px;
  font-size: 0.98rem;
  gap: 6px;
}

.r7-claim .btn-icon {
  width: 20px;
  height: 20px;
}

/* claimed: the teacher's red tick, the line crossed off */
.r7-mission.is-claimed .r7-mission-text {
  color: var(--pencil);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--red) 70%, transparent);
  text-decoration-thickness: 2px;
}

.r7-mission.is-claimed .r7-mission-icon {
  filter: grayscale(0.6);
  opacity: 0.7;
}

.r7-mission-tick {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: var(--red);
}

.r7-tick {
  width: 38px;
  height: 38px;
}

@media (max-width: 480px) {
  .r7-mission {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .r7-mission > :last-child {
    grid-column: 2;
    justify-self: start;
  }

  .r7-mission-tick {
    grid-column: 3 !important;
    grid-row: 1;
    width: 40px;
    height: 40px;
  }

  .r7-mission.is-claimed {
    grid-template-columns: 32px minmax(0, 1fr) auto;
  }
}

.r7-float {
  position: fixed;
  z-index: 60;
  translate: -50% -100%;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.9rem;
  color: var(--red);
  white-space: nowrap;
  pointer-events: none;
  animation: r7-float-up 1.7s ease-out forwards;
}

@keyframes r7-float-up {
  0% { opacity: 0; transform: translateY(8px) scale(0.8); }
  15% { opacity: 1; transform: translateY(0) scale(1.05); }
  100% { opacity: 0; transform: translateY(-46px) scale(1); }
}

/* ----------------------------------------------------------- mistakes notebook */

.r7-mistakes,
.r7-map-page,
.r7-wardrobe,
.r7-insights,
.r7-kids {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  max-width: 56rem;
}

.r7-map-page {
  max-width: none;
}

.r7-tally {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-weight: 800;
  color: var(--pencil);
}

.r7-tally-item.is-due {
  color: var(--text);
  background: linear-gradient(176deg, transparent 12%, var(--marker-soft) 14% 88%, transparent 90%);
  padding: 0 4px;
}

.r7-tally-item.is-cleared {
  color: var(--ink);
}

.r7-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 34rem;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.7rem;
  line-height: 1.1;
  color: var(--red);
}

.r7-notice-icon {
  width: 32px;
  height: 32px;
  flex: none;
}

.r7-mistakes-go {
  margin: 6px 0 18px;
}

.r7-btn-count {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--paper-raised);
  color: var(--ink);
  font-size: 1.05rem;
}

.r7-empty {
  max-width: 34rem;
  margin: 6px 0 18px;
  padding: 12px 16px;
  border-left: 5px solid var(--marker);
  background: var(--paper-raised);
  font-weight: 700;
}

.r7-list-title {
  margin-top: 8px;
}

.r7-mlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  max-width: 44rem;
}

.r7-mitem {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 4px 14px;
  min-height: calc(var(--cell) * 3);
  padding: 6px 6px;
  border-bottom: 1px solid var(--grid-strong);
}

.r7-mitem-emoji {
  font-size: 1.6rem;
  text-align: center;
}

.r7-mitem-title {
  font-weight: 800;
  color: var(--ink);
  min-width: 0;
}

.r7-stars {
  display: inline-flex;
  gap: 2px;
  color: var(--muted);
}

.r7-star {
  display: inline-block;
  width: 20px;
  height: 20px;
}

.r7-star svg {
  width: 100%;
  height: 100%;
  display: block;
}

.r7-due {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--pencil);
  white-space: nowrap;
  min-width: 5.5rem;
  text-align: right;
}

.r7-due.is-today {
  font-family: var(--font-hand);
  font-size: 1.4rem;
  line-height: 1;
  color: var(--red);
}

@media (max-width: 480px) {
  .r7-mitem {
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }

  .r7-mitem .r7-boxes {
    grid-column: 2;
    grid-row: 2;
  }

  .r7-mitem .r7-due {
    grid-column: 3;
    grid-row: 1 / span 2;
    min-width: 0;
  }
}

/* review problem */
.r7-review-sheet {
  position: relative;
}

.r7-boxline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: -4px 0 10px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--pencil);
}

.r7-boxline .r7-star {
  width: 22px;
  height: 22px;
}

.r7-boxline.is-fresh .r7-star.is-on:last-of-type {
  animation: r7-pop 0.6s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}

@keyframes r7-pop {
  from { transform: scale(0.2) rotate(-40deg); }
  to { transform: scale(1) rotate(0); }
}

/* learnt: the problem is rubbed out and stamped */
.r7-review-sheet.is-cleared .problem-text {
  color: var(--pencil);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--pencil) 60%, transparent);
  opacity: 0.7;
}

.r7-stamp {
  position: relative;
  display: block;
  width: fit-content;
  margin: 6px 12px 4px auto;
  padding: 4px 14px 2px;
  border: 4px double var(--r7-stamp);
  border-radius: 10px;
  color: var(--r7-stamp);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: clamp(1.4rem, 5vw, 2.1rem);
  letter-spacing: 0.08em;
  transform: rotate(-11deg);
  opacity: 0.85;
  mix-blend-mode: multiply;
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  .r7-stamp {
    mix-blend-mode: normal;
  }
}

.r7-stamp.is-new {
  animation: r7-stamp 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes r7-stamp {
  0% { opacity: 0; transform: rotate(-24deg) scale(2.2); }
  60% { opacity: 0.95; transform: rotate(-9deg) scale(0.94); }
  100% { opacity: 0.85; transform: rotate(-11deg) scale(1); }
}

/* ------------------------------------------------------------------ the map */

.r7-map-hint {
  display: none;
  font-size: 0.92rem;
  color: var(--pencil);
}

.r7-map-frame {
  position: relative;
  max-width: 100%;
  min-width: 0;
  padding: 10px 0;
}

/* two strips of tape hold the map down */
.r7-map-frame::before,
.r7-map-frame::after {
  content: "";
  position: absolute;
  z-index: 2;
  top: -2px;
  width: 92px;
  height: 24px;
  background: var(--tape);
  border: 1px solid color-mix(in srgb, var(--grid-strong) 60%, transparent);
  pointer-events: none;
}

.r7-map-frame::before {
  left: 18px;
  transform: rotate(-4deg);
}

.r7-map-frame::after {
  right: 18px;
  transform: rotate(3deg);
}

.r7-map-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  border: 2px solid var(--ink-soft);
  border-radius: 6px 10px 8px 12px;
  background: color-mix(in srgb, var(--paper) 55%, transparent);
  scrollbar-width: thin;
}

.r7-map-scroll:focus-visible {
  outline-offset: 2px;
}

.r7-map {
  position: relative;
  width: max(100%, calc(var(--w) * 0.75px));
}

.r7-map-art,
.r7-map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.r7-map-svg * {
  vector-effect: non-scaling-stroke;
}

.r7-wave {
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.6;
  stroke-linecap: round;
  opacity: 0.55;
}

.r7-map-tier {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 36px;
  fill: var(--ink);
}

.r7-map-tier-line {
  fill: none;
  stroke: var(--red);
  stroke-width: 2.4;
  stroke-linecap: round;
  opacity: 0.75;
}

.r7-isle-ring {
  fill: var(--r7-shallow);
  stroke: var(--ink-soft);
  stroke-width: 1.4;
  stroke-dasharray: 3 5;
}

.r7-isle-land {
  fill: var(--r7-sand);
  stroke: var(--ink);
  stroke-width: 2.4;
  stroke-linejoin: round;
}

.r7-isle-hatch {
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.4;
  stroke-linecap: round;
  opacity: 0.6;
}

/* never visited: only pencilled in */
.r7-isle.is-new .r7-isle-land {
  fill: transparent;
  stroke: var(--pencil);
  stroke-dasharray: 7 5;
}

.r7-isle.is-stars-3 .r7-isle-land {
  fill: color-mix(in srgb, var(--star) 38%, var(--paper-raised));
}

.r7-route {
  fill: none;
  stroke: var(--red);
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 0.5 11;
}

.r7-route.is-future {
  stroke: var(--pencil);
  stroke-width: 2.2;
  stroke-dasharray: 0.5 12;
  opacity: 0.55;
}

.r7-start circle {
  fill: var(--paper-raised);
  stroke: var(--red);
  stroke-width: 3;
}

.r7-start text {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 26px;
  fill: var(--red);
}

.r7-flag-pole {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.4;
  stroke-linecap: round;
}

.r7-flag-foot {
  fill: var(--ink);
}

.r7-flag-cloth {
  stroke: var(--ink);
  stroke-width: 1.8;
  stroke-linejoin: round;
  fill: var(--paper-raised);
}

.is-gold .r7-flag-cloth { fill: var(--r7-gold); }
.is-silver .r7-flag-cloth { fill: var(--r7-silver); }
.is-bronze .r7-flag-cloth { fill: var(--r7-bronze); }

.r7-compass circle {
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.6;
}

.r7-compass circle.is-inner {
  stroke-dasharray: 2 4;
}

.r7-compass circle.is-pin {
  fill: var(--ink);
  stroke: none;
}

.r7-compass-n {
  fill: var(--red);
  stroke: var(--ink);
  stroke-width: 1.4;
}

.r7-compass-s,
.r7-compass-ew {
  fill: var(--paper-raised);
  stroke: var(--ink);
  stroke-width: 1.4;
}

/* island buttons sit on the drawn islands */
.r7-isle-btn {
  position: absolute;
  z-index: 1;
  translate: -50% -50%;
  display: grid;
  justify-items: center;
  gap: 0;
  min-width: 56px;
  min-height: 56px;
  padding: 4px 6px 5px;
  border: 2px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.r7-isle-btn:hover {
  border-color: var(--ink-soft);
  background: color-mix(in srgb, var(--paper-raised) 70%, transparent);
}

.r7-isle-btn.is-on {
  border-color: var(--ink);
  background: var(--paper-raised);
  box-shadow: var(--shadow);
}

.r7-isle-btn:focus-visible {
  outline-offset: 0;
}

.r7-isle-emoji {
  font-size: 1.9rem;
  line-height: 1.1;
  filter: drop-shadow(0 1px 0 var(--paper-raised));
}

.r7-isle-btn .r7-star {
  width: 15px;
  height: 15px;
}

.r7-map-owl {
  position: absolute;
  z-index: 1;
  translate: -50% -94%;
  pointer-events: none;
}

/* the island card: a note pinned under the map */
.r7-isle-card {
  position: relative;
  display: grid;
  gap: 8px;
  justify-items: start;
  max-width: 30rem;
  margin: 6px 0 10px;
  padding: 16px 18px 18px;
  color: var(--note-ink);
  background: var(--note);
  border: 1px solid var(--note-edge);
  border-radius: 3px 3px 14px 3px;
  box-shadow: var(--shadow);
  transform: rotate(-0.8deg);
  outline: none;
  animation: r7-note-in 0.32s cubic-bezier(0.3, 1.4, 0.5, 1) both;
}

.r7-isle-card:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.r7-isle-card[hidden] {
  display: none;
}

@keyframes r7-note-in {
  from { opacity: 0; transform: translateY(-8px) rotate(-3deg); }
  to { opacity: 1; transform: rotate(-0.8deg); }
}

.r7-isle-close {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 11px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--note-ink);
  cursor: pointer;
}

.r7-isle-close .icon {
  width: 20px;
  height: 20px;
}

.r7-isle-close svg {
  width: 100%;
  height: 100%;
}

.r7-isle-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 40px;
}

.r7-isle-card-emoji {
  font-size: 2.4rem;
  line-height: 1;
}

.r7-isle-name {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.05;
}

.r7-isle-tier {
  font-size: 0.9rem;
  font-weight: 700;
  opacity: 0.75;
}

.r7-isle-stars .r7-star {
  width: 26px;
  height: 26px;
}

.r7-isle-stars .r7-stars {
  color: color-mix(in srgb, var(--note-ink) 45%, transparent);
}

.r7-isle-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 18px;
  font-weight: 800;
}

.r7-isle-next {
  font-size: 0.98rem;
}

.r7-journey {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.r7-journey-count {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  color: var(--pencil);
  margin-left: 6px;
}

.r7-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 12.5rem), 1fr));
  gap: 6px 20px;
  max-width: 56rem;
}

.r7-legend-item {
  display: grid;
  grid-template-columns: 26px auto 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border-bottom: 1px solid var(--grid-strong);
}

.r7-legend-flag svg {
  width: 24px;
  height: 32px;
  display: block;
  overflow: visible;
}

.r7-legend-name {
  font-weight: 800;
}

.r7-legend-rule {
  font-size: 0.85rem;
  color: var(--pencil);
}

.r7-legend-n {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--ink);
}

@media (max-width: 760px) {
  .r7-map-hint {
    display: block;
  }
}

/* --------------------------------------------------------------- wardrobe */

.r7-ward-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 30px;
  margin-bottom: 18px;
}

.r7-ward-stage {
  display: grid;
  place-items: end center;
  width: 190px;
  height: 180px;
  padding-bottom: 6px;
}

.r7-ward-level {
  display: grid;
  gap: 4px;
  flex: 1 1 16rem;
  max-width: 26rem;
}

.r7-ward-levelname {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 2.2rem;
  line-height: 1.05;
  color: var(--ink);
}

.r7-ward-level .r7-xpbar {
  height: 14px;
}

.r7-ward-next {
  font-weight: 800;
}

.r7-ward-info {
  font-size: 0.92rem;
  color: var(--pencil);
}

.r7-ward-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr));
  gap: 14px;
  max-width: 56rem;
}

.r7-ward-item {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 2px;
  width: 100%;
  min-height: 170px;
  padding: 10px 8px 12px;
  border: 2px solid var(--ink-soft);
  border-radius: 14px 12px 16px 13px;
  background: var(--paper-raised);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: center;
}

.r7-ward-item:hover:not(:disabled) {
  border-color: var(--ink);
}

.r7-ward-item.is-on {
  border: 3px solid var(--ink);
  background: linear-gradient(176deg, transparent 70%, var(--marker-soft) 72% 92%, transparent 94%), var(--paper-raised);
  box-shadow: 0 4px 0 var(--ink-deep);
  cursor: default;
}

.r7-ward-item.is-locked {
  border-style: dashed;
  border-color: var(--grid-strong);
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  cursor: not-allowed;
}

.r7-ward-item.is-locked .r7-ward-owl {
  filter: grayscale(1);
  opacity: 0.38;
}

.r7-ward-owl {
  display: grid;
  place-items: center;
  height: 92px;
}

.r7-ward-name {
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink);
}

.r7-ward-item.is-locked .r7-ward-name {
  color: var(--pencil);
}

.r7-ward-sub {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 1.4em;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--pencil);
}

.r7-ward-item.is-on .r7-ward-sub {
  color: var(--red);
  font-family: var(--font-hand);
  font-size: 1.35rem;
}

.r7-ward-check {
  width: 24px;
  height: 24px;
  color: var(--red);
}

/* ---------------------------------------------------------- level up moment */

.r7-lu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 48;
  display: grid;
  place-items: center;
  padding: 16px;
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  backdrop-filter: blur(2px);
  animation: r7-fade 0.25s ease both;
}

.r7-lu-backdrop.is-leaving {
  animation: r7-fade-out 0.26s ease forwards;
}

@keyframes r7-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes r7-fade-out {
  to { opacity: 0; }
}

.r7-lu {
  display: grid;
  justify-items: center;
  gap: 4px;
  width: min(100%, 24rem);
  padding: 22px 22px 24px;
  text-align: center;
  background: var(--paper-raised);
  border: 3px solid var(--ink);
  border-radius: 18px 14px 20px 15px;
  box-shadow: var(--shadow), 0 18px 40px rgba(0, 0, 0, 0.2);
  animation: r7-lu-in 0.5s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}

@keyframes r7-lu-in {
  from { opacity: 0; transform: translateY(24px) scale(0.85) rotate(-3deg); }
  to { opacity: 1; transform: none; }
}

.r7-lu-owl {
  display: grid;
  place-items: center;
  min-height: 150px;
}

.r7-lu-kicker {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
  color: var(--red);
}

.r7-lu-title {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 4rem;
  line-height: 0.95;
  color: var(--ink);
}

.r7-lu-name {
  font-weight: 800;
  font-size: 1.3rem;
  padding: 0 8px;
  background: linear-gradient(176deg, transparent 12%, var(--marker-soft) 14% 88%, transparent 90%);
}

.r7-lu-item {
  min-height: 1.4em;
  margin-top: 4px;
  font-weight: 700;
  color: var(--pencil);
}

.r7-lu-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

/* -------------------------------------------------------------- insights */

/* calm, parent-friendly: plain numbers, little decoration */
.r7-insights {
  max-width: 60rem;
}

.r7-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr));
  gap: 0 22px;
  margin: 0 0 14px;
  max-width: 56rem;
}

.r7-stat {
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--grid-strong);
}

.r7-stat.is-wide {
  grid-column: span 2;
}

@media (max-width: 480px) {
  .r7-stat.is-wide {
    grid-column: 1 / -1;
  }

  .r7-stats {
    grid-template-columns: 1fr 1fr;
  }
}

.r7-stat-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--pencil);
}

.r7-stat-value {
  margin: 0;
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.r7-stat.is-wide .r7-stat-value {
  font-size: 1.15rem;
  line-height: 1.4;
}

.r7-ins-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-top: 18px;
  min-width: 0;
}

.r7-ins-title {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1.1;
  color: var(--ink);
}

.r7-ins-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 0 32px;
  max-width: 56rem;
}

.r7-chart-wrap {
  max-width: 44rem;
}

.r7-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.r7-chart-base {
  stroke: var(--ink);
  stroke-width: 2;
}

.r7-chart-att {
  fill: color-mix(in srgb, var(--ink-soft) 16%, transparent);
  stroke: var(--ink-soft);
  stroke-width: 1.6;
  stroke-dasharray: 4 3;
}

.r7-chart-sol {
  fill: var(--ink);
}

.r7-chart-n {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 18px;
  fill: var(--text);
}

.r7-chart-x {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 17px;
  fill: var(--pencil);
}

.r7-chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--pencil);
}

.r7-key {
  display: inline-block;
  width: 16px;
  height: 12px;
  border-radius: 2px;
  margin-left: 8px;
}

.r7-key:first-child {
  margin-left: 0;
}

.r7-key.is-sol {
  background: var(--ink);
}

.r7-key.is-att {
  background: color-mix(in srgb, var(--ink-soft) 16%, transparent);
  border: 1.6px dashed var(--ink-soft);
}

.r7-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.r7-chip {
  display: flex;
  align-items: center;
  gap: 4px 10px;
  min-height: 52px;
  padding: 4px 6px 4px 12px;
  border: 2px solid var(--ink-soft);
  border-radius: 26px;
  background: var(--paper-raised);
  font-weight: 800;
}

.r7-chip.is-weak {
  border-color: color-mix(in srgb, var(--red) 70%, var(--paper-raised));
}

.r7-chip-emoji {
  font-size: 1.3rem;
}

.r7-chip-name {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
}

.r7-chip-pct {
  color: var(--pencil);
  font-variant-numeric: tabular-nums;
}

.r7-chip-go {
  flex: none;
  min-height: 44px;
  padding: 0 14px;
  font-size: 1rem;
  border-radius: 999px;
}

.r7-cats {
  width: 100%;
  max-width: 56rem;
  border-collapse: collapse;
  font-size: 1rem;
}

.r7-cats th,
.r7-cats td {
  padding: 8px 10px 8px 0;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--grid-strong);
}

.r7-cats thead th {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--pencil);
  border-bottom: 2px solid var(--ink-soft);
}

.r7-cats tbody th {
  font-weight: 800;
  color: var(--ink);
}

.r7-cats tbody th > span:last-child {
  overflow-wrap: break-word;
}

.r7-cat-emoji {
  display: inline-block;
  width: 1.8em;
}

.r7-cats tr.is-never th,
.r7-cats tr.is-never td {
  color: var(--pencil);
  font-weight: 600;
}

.r7-cats td {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.r7-acc {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.r7-acc-bar {
  display: inline-block;
  width: clamp(3.5rem, 14vw, 9rem);
  height: 9px;
  border-radius: 999px;
  background: var(--grid-line);
  overflow: hidden;
}

.r7-acc-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--ink-soft);
}

.r7-acc-fill.is-low {
  background: var(--red);
}

.r7-acc-n {
  min-width: 2.6em;
  font-weight: 800;
}

.r7-col-trend {
  text-align: center !important;
  width: 3.2rem;
}

.r7-trend {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--pencil);
  font-weight: 800;
}

.r7-trend-icon {
  width: 22px;
  height: 22px;
}

.r7-trend-icon svg {
  width: 100%;
  height: 100%;
}

.r7-trend.is-up {
  color: var(--ink);
}

.r7-trend.is-down {
  color: var(--red);
}

@media (max-width: 480px) {
  .r7-cats {
    font-size: 0.92rem;
  }

  .r7-cats th,
  .r7-cats td {
    padding-right: 6px;
  }

  .r7-cat-emoji {
    display: none;
  }

  .r7-acc-bar {
    display: none;
  }
}

/* root: the list of children */
.r7-kidlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-width: 36rem;
}

.r7-kid {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  padding: 10px 14px;
  border: 2px solid var(--ink-soft);
  border-radius: 14px 12px 16px 13px;
  background: var(--paper-raised);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.r7-kid:hover {
  border-color: var(--ink);
}

.r7-kid-main {
  display: grid;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}

.r7-kid-name {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.r7-kid-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 14px;
  font-size: 0.9rem;
  color: var(--pencil);
  font-weight: 700;
}

.r7-kid-status {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--red);
}

.r7-kid-go {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--ink);
  transform: rotate(-90deg);
}

/* ------------------------------------------------------------ reduced motion */

@media (prefers-reduced-motion: reduce) {
  .r7-float,
  .r7-stamp.is-new,
  .r7-lu,
  .r7-lu-backdrop,
  .r7-isle-card,
  .r7-boxline.is-fresh .r7-star.is-on:last-of-type {
    animation: none !important;
  }

  .r7-float {
    display: none;
  }
}

/* phones: bigger chart lettering (the chart is scaled down) */
@media (max-width: 560px) {
  .r7-chart-n { font-size: 26px; }
  .r7-chart-x { font-size: 22px; }
}
