@font-face {
  font-family: 'Quicksand';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/assets/quicksand.woff2') format('woff2');
}
@font-face {
  font-family: 'Alfa Slab One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/alfa-slab-one.woff2') format('woff2');
}

:root {
  --ink: #706354;
  --muted: #a39587;
  --paper: #fffdf7;
  --paper-soft: #fff8dc;
  --sun: #e9e0d1;
  --sun-deep: #d3c4a8;
  --grid: #baa892;
  --danger: #e85543;
  --danger-soft: #ffe1dc;
  --star: #cca76e;
  --teal: #2f9c95;
  --shadow: 0 8px 24px rgba(112, 99, 84, 0.2);
  --thin-shadow: 0 2px 8px rgba(112, 99, 84, 0.1);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #e3d4c0;
  color: var(--ink);
  font-family: "Quicksand", "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

h1, h2, h3, h4, h5, h6,
.modal-kicker,
.help-section-label {
  font-family: 'Alfa Slab One', "Trebuchet MS", serif;
  font-weight: normal;
  letter-spacing: 0.02em;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-underline-offset: 0.18em;
}

.game-body {
  background: transparent;
}

.app-shell {
  min-height: 100vh;
  background: radial-gradient(circle at 50% 30%, #efe3d1, #d8c8b2);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  background: transparent;
  backdrop-filter: none;
}

.brand-mark,
.date-chip,
.icon-button,
.profile-button,
.puzzle-action,
.month-button,
.modal-primary,
.modal-secondary {
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 8px rgba(112, 99, 84, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  color: var(--ink);
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.brand-mark:active,
.date-chip:active,
.icon-button:active,
.profile-button:active,
.puzzle-action:active,
.month-button:active,
.modal-primary:active,
.modal-secondary:active {
  transform: translateY(2px);
  box-shadow: 0 1px 4px rgba(112, 99, 84, 0.1);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  min-width: 44px;
  min-height: 40px;
}

.brand-mark img {
  display: block;
  width: 34px;
  height: 34px;
}

.brand-mark span {
  display: inline;
  padding: 0 4px 0 2px;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
}

.date-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 36px;
  padding: 0 9px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 7px;
  min-width: 0;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  font-weight: 900;
}

.profile-button {
  min-width: 54px;
  min-height: 36px;
  padding: 0 9px;
  font-size: 0.8rem;
  font-weight: 800;
}

.game-stage {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100svh - 58px);
  padding: 12px 14px 100px;
}

.game-wrap {
  width: min(100%, 470px);
  margin: 0 auto;
}

.board-frame {
  width: min(100%, 430px);
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.6);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.9), 0 10px 40px rgba(107, 93, 82, 0.15);
}

.puzzle-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--size, 10), minmax(0, 1fr));
  grid-template-rows: repeat(var(--size, 10), minmax(0, 1fr));
  width: 100%;
  height: 100%;
  background: #fff;
}

.region-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.puzzle-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border-style: solid;
  border-color: var(--grid);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
  touch-action: manipulation;
  overflow: hidden;
  appearance: none;
}

.puzzle-cell:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: -5px;
}

.cell-symbol {
  display: inline-grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  pointer-events: none;
  transform-origin: 50% 55%;
  will-change: transform, opacity;
}

.puzzle-cell.cell-star .cell-symbol {
  /* SVG handles styling */
}

.puzzle-cell.cell-dot .cell-symbol {
  color: #9a9495;
  font-size: 0.95rem;
  font-weight: 900;
}

.cell-symbol.is-placing-dot {
  animation: mark-pop 220ms cubic-bezier(0.18, 0.92, 0.2, 1.08);
}

.cell-symbol.is-placing-star {
  animation: star-pop 340ms cubic-bezier(0.19, 1.1, 0.28, 1);
}

.puzzle-cell.cell-warning {
  background: #fcfb95;
}

.puzzle-cell.cell-error {
  background: #ff756d;
}

.puzzle-cell.cell-hint {
  background: rgba(255, 215, 60, 0.4);
  animation: hint-flash 620ms ease;
}



.puzzle-action span {
  font-size: 1.05rem;
}

.puzzle-action.is-active {
  background: #e9e0d1;
  color: #8a7d6d;
  --action-bulb-inner: #e9e0d1;
  box-shadow: inset 0 2px 6px rgba(112, 99, 84, 0.2);
}

.game-status {
  min-height: 28px;
  margin: 16px auto 0;
  max-width: 360px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}

.game-status:not(:empty) {
  min-height: 0;
  padding: 14px 24px;
  border: none;
  border-radius: 16px;
  background: rgba(235, 222, 202, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 6px 20px rgba(112, 99, 84, 0.12), inset 0 2px 4px rgba(255, 255, 255, 0.7);
  text-align: center;
  font-weight: 700;
  color: var(--ink);
}

.game-status.status-error {
  color: #8c3f35;
}

.game-status.status-hint {
  color: #7a5c2b;
}

.game-status.status-win {
  color: #27756b;
}

.archive-topbar {
  grid-template-columns: auto auto 1fr;
}

.archive-back-button {
  text-decoration: none;
}

.archive-today-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

.archive-band {
  min-height: calc(100svh - 58px);
  padding: 22px 0 44px;
}

.archive-inner {
  display: grid;
  gap: 18px;
  width: min(100% - 24px, 560px);
  margin: 0 auto;
}

.archive-copy {
  min-width: 0;
  text-align: center;
}

.archive-kicker {
  margin: 0 0 8px;
  color: #9b3329;
  font-size: 0.85rem;
  font-weight: 900;
  text-transform: uppercase;
}

.archive-copy h1 {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.05rem;
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: 0;
}

.archive-copy p:not(.archive-kicker) {
  max-width: 420px;
  margin: 10px 0 0;
  margin-inline: auto;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.calendar-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: #fffdfb;
  box-shadow: 5px 5px 0 rgba(48, 39, 42, 0.92);
}

.calendar-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
}

.calendar-header h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.month-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 0 auto;
  padding: 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: #ff5b45;
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1;
}

.month-button:hover,
.month-button:focus-visible {
  background: #fff0d6;
  border-color: var(--ink);
  box-shadow: var(--thin-shadow);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 2px solid #8a8582;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 9px 8px;
}

.calendar-day {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1;
  border: 2px solid #cfcac7;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.calendar-day:hover,
.calendar-day:focus-visible {
  border-color: var(--ink);
  background: #fff4bf;
  box-shadow: 2px 2px 0 var(--ink);
  outline: none;
  transform: translate(-1px, -1px);
}

.calendar-day.is-locked {
  cursor: not-allowed;
  opacity: 0.42;
}

.calendar-day.is-locked:hover,
.calendar-day.is-locked:focus-visible {
  border-color: #cfcac7;
  background: #fff;
  box-shadow: none;
  transform: none;
}

.calendar-day.is-selected {
  border-color: var(--ink);
  background: var(--paper-soft);
  box-shadow: inset 0 0 0 2px rgba(48, 39, 42, 0.2);
}

.calendar-day.is-today::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
}

.calendar-day-empty {
  border-color: transparent;
  background: transparent;
}

.calendar-day-number {
  align-self: end;
  margin-bottom: 4px;
  color: #908b89;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.calendar-day-icons {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 18px;
  margin-top: 6px;
  color: #ff554c;
  font-size: 0.72rem;
  line-height: 1;
  text-shadow: 0 1px 0 var(--ink);
}

.difficulty-beginner .calendar-day-icons {
  color: #2f9c95;
}

.difficulty-medium .calendar-day-icons {
  color: #f0a42a;
}

.difficulty-hard .calendar-day-icons,
.difficulty-challenge .calendar-day-icons {
  color: #ff554c;
}

.archive-status {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
}

.archive-rules {
  display: grid;
  gap: 18px;
  padding: 4px 0 0;
  text-align: center;
}

.archive-rules p {
  width: min(100%, 440px);
  margin: 0 auto;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.55;
}

.difficulty-list {
  display: grid;
  gap: 0;
  text-align: left;
}

.difficulty-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  border-bottom: 2px solid rgba(232, 85, 67, 0.48);
  font-size: 1rem;
  font-weight: 900;
}

.difficulty-icons {
  display: inline-flex;
  gap: 3px;
  color: #ff554c;
  font-size: 0.9rem;
  text-shadow: 0 1px 0 var(--ink);
}

.difficulty-label {
  color: var(--muted);
  font-weight: 800;
}

.levels-band {
  min-height: calc(100svh - 58px);
  padding: 22px 0 44px;
}

.levels-inner {
  display: grid;
  gap: 18px;
  width: min(100% - 24px, 720px);
  margin: 0 auto;
}

.levels-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: #fffdfb;
  box-shadow: 5px 5px 0 rgba(48, 39, 42, 0.92);
}

.level-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding-bottom: 12px;
  border-bottom: 2px solid #8a8582;
}

.level-tab {
  min-width: 0;
  min-height: 40px;
  padding: 0 6px;
  border: 2px solid #d7d0ca;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 900;
  text-transform: uppercase;
  transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.level-tab:hover,
.level-tab:focus-visible,
.level-tab.is-active {
  border-color: var(--ink);
  background: #fff4bf;
  box-shadow: 2px 2px 0 var(--ink);
  outline: none;
  transform: translate(-1px, -1px);
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.levels-card .archive-status {
  color: var(--muted);
}

.level-tile {
  position: relative;
  display: grid;
  grid-template-rows: 18px minmax(0, 1fr) 16px;
  align-items: center;
  justify-items: center;
  min-width: 0;
  aspect-ratio: 1;
  padding: 5px 3px 4px;
  border: 2px solid #cfcac7;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.level-tile:hover,
.level-tile:focus-visible {
  border-color: var(--ink);
  background: #fff4bf;
  box-shadow: 2px 2px 0 var(--ink);
  outline: none;
  transform: translate(-1px, -1px);
}

.level-tile.is-completed {
  background: #ecfbf8;
  border-color: rgba(47, 156, 149, 0.72);
}

.level-tile.is-completed::after {
  content: "✓";
  position: absolute;
  right: 5px;
  bottom: 4px;
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1;
}

.level-tile-icons {
  display: inline-flex;
  gap: 1px;
  min-height: 14px;
  color: #ff554c;
  font-size: 0.58rem;
  line-height: 1;
  text-shadow: 0 1px 0 var(--ink);
}

.level-tile.difficulty-beginner .level-tile-icons {
  color: #2f9c95;
}

.level-tile.difficulty-medium .level-tile-icons {
  color: #f0a42a;
}

.level-tile.difficulty-hard .level-tile-icons {
  color: #ff554c;
}

.level-tile-number {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.level-tile-meta {
  max-width: 100%;
  color: #908b89;
  font-size: 0.52rem;
  font-weight: 900;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.content-band {
  background: var(--paper);
  border-top: 3px solid var(--ink);
}

.content-inner {
  width: min(100% - 32px, 760px);
  margin: 0 auto;
  padding: 44px 0 52px;
}

.content-inner h1,
.legal-page h1,
.modal h2 {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 900;
  letter-spacing: 0;
}

.content-inner h1 {
  font-size: 2rem;
  line-height: 1.08;
}

.content-inner h2,
.legal-page h2 {
  margin: 30px 0 10px;
  font-size: 1.08rem;
}

.content-inner p,
.legal-page p,
.rule-list {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.rule-list {
  padding-left: 1.15rem;
}

.rule-list li + li {
  margin-top: 8px;
}

.site-footer {
  display: grid;
  gap: 12px;
  padding: 28px 18px 34px;
  border-top: 2px solid rgba(48, 39, 42, 0.18);
  background: #fff;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 16px;
}

.modal {
  width: min(92vw, 760px);
  max-height: min(88vh, 720px);
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(26, 20, 22, 0.26);
}

.modal form {
  position: relative;
  min-height: 280px;
  padding: 28px 18px 26px;
}

.modal form::before {
  content: "";
  display: block;
  height: 1px;
  margin: 44px 0 28px;
  background: var(--ink);
  opacity: 0.85;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.75rem;
  line-height: 1;
}

.modal-kicker {
  margin: 0 0 16px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 900;
  text-align: center;
}

.modal h2 {
  margin-bottom: 18px;
  font-size: 2.3rem;
  line-height: 1.05;
  text-align: center;
}

.modal-copy {
  margin: 0 0 28px;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.6;
  text-align: center;
}

.modal-primary,
.modal-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  font-weight: 900;
}

.modal-primary {
  margin: 0 auto;
}

.modal-secondary {
  width: 100%;
  margin-top: 22px;
}

.modal-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  line-height: 1.7;
}

.modal-list li + li {
  margin-top: 10px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 46px;
  border-bottom: 1px solid #ded9d2;
  color: var(--ink);
  font-weight: 800;
}

.setting-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--teal);
}

.action-row {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 56px;
  justify-content: center;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(233, 224, 209, 0.5);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 10px 30px rgba(112, 99, 84, 0.15), inset 0 2px 4px rgba(255, 255, 255, 0.6);
  z-index: 100;
}

.puzzle-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 64px;
  height: 64px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #8a7d6d;
  color: #e9e0d1;
  box-shadow: 0 4px 12px rgba(112, 99, 84, 0.25);
  touch-action: manipulation;
  transition: transform 0.1s, box-shadow 0.1s;
}

.action-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 24px;
  height: 24px;
  background: #8a7d6d;
  color: #fff;
  font-family: "Quicksand", sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(233, 224, 209, 0.8);
  pointer-events: none;
}

.puzzle-action:active {
  transform: scale(0.92);
  box-shadow: 0 2px 6px rgba(112, 99, 84, 0.2);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.stats-grid span {
  display: grid;
  gap: 6px;
  padding: 13px 8px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
}

.stats-grid strong {
  color: var(--ink);
  font-size: 1.25rem;
}

.plain-body {
  background:
    radial-gradient(circle, rgba(48, 39, 42, 0.06) 1px, transparent 1px) 0 0 / 10px 10px,
    var(--sun);
}

.legal-shell {
  min-height: 100vh;
}

.legal-page {
  width: min(100% - 32px, 820px);
  margin: 0 auto;
  padding: 38px 0 56px;
}

.back-link {
  display: inline-block;
  margin-bottom: 34px;
  font-weight: 900;
}

.legal-page h1 {
  font-size: 2.3rem;
  line-height: 1.1;
}

.legal-page section {
  padding: 2px 0;
}

@keyframes hint-flash {
  0% {
    background: #fff8a6;
  }
  100% {
    background: #fff05a;
  }
}

@keyframes mark-pop {
  0% {
    opacity: 0;
    transform: translateY(-1px) scale(0.35) rotate(-10deg);
  }

  62% {
    opacity: 1;
    transform: translateY(0) scale(1.18) rotate(4deg);
  }

  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes star-pop {
  0% {
    opacity: 0;
    transform: translateY(-2px) scale(0.25) rotate(-18deg);
  }

  42% {
    opacity: 1;
    transform: translateY(0) scale(1.28) rotate(10deg);
  }

  68% {
    transform: scale(0.92) rotate(-4deg);
  }

  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@media (min-width: 560px) {
  .topbar {
    grid-template-columns: auto auto 1fr;
    padding-inline: 22px;
  }

  .game-stage {
    padding-top: 20px;
  }

  .content-inner h1 {
    font-size: 2.6rem;
  }

  .archive-inner {
    width: min(100% - 32px, 620px);
  }

  .levels-inner {
    width: min(100% - 36px, 760px);
  }

  .archive-copy h1 {
    font-size: 2.7rem;
  }

  .calendar-card {
    padding: 18px;
  }

  .calendar-header h2 {
    font-size: 1.55rem;
  }

  .calendar-grid {
    gap: 10px;
  }

  .levels-card {
    padding: 18px;
  }

  .level-grid {
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 10px;
  }

  .modal form {
    padding: 32px 34px 32px;
  }

  .modal h2 {
    font-size: 4.2rem;
  }
}

@media (max-width: 360px) {
  .topbar {
    gap: 6px;
    padding-inline: 10px;
  }

  .date-chip {
    padding-inline: 7px;
  }

  .icon-button {
    width: 34px;
    height: 34px;
  }

  .profile-button {
    min-width: 48px;
    padding-inline: 7px;
  }

  .action-row {
    gap: 8px;
  }

  .puzzle-action {
    font-size: 0.92rem;
  }

  .puzzle-cell {
    font-size: 1.25rem;
  }

  .archive-band {
    padding-top: 16px;
  }

  .archive-inner {
    width: min(100% - 18px, 560px);
  }

  .levels-inner {
    width: min(100% - 18px, 720px);
  }

  .calendar-card {
    padding: 10px;
  }

  .levels-card {
    padding: 10px;
  }

  .calendar-grid {
    gap: 7px 5px;
  }

  .level-grid {
    gap: 7px 5px;
  }

  .level-tab {
    font-size: 0.74rem;
  }

  .level-tile-number {
    font-size: 0.9rem;
  }

  .calendar-day-icons {
    font-size: 0.64rem;
  }

  .difficulty-row {
    font-size: 0.94rem;
  }
}

.help-modal form {
  padding-top: 24px;
}
.help-modal form::before {
  display: none;
}
.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.help-header h2 {
  margin: 0;
  font-size: 1.8rem;
  text-align: left;
}
.help-header .modal-close {
  position: static;
}
.help-divider {
  border: 0;
  border-top: 1px solid var(--ink);
  opacity: 0.25;
  margin: 18px 0;
}
.help-body {
  text-align: left;
}
.help-difficulty {
  font-size: 1.05rem;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.help-section-label {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 10px;
  font-weight: 800;
}
.help-list {
  padding-left: 1.2rem;
  margin: 0 0 26px;
  color: var(--ink);
  line-height: 1.6;
}
.help-list li + li {
  margin-top: 10px;
}
.help-cycle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 26px;
  font-size: 1rem;
}
.cycle-label {
  margin-right: 4px;
}
.cycle-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--grid);
  background: #fff;
  border-radius: 4px;
  font-weight: 900;
  font-size: 1.1rem;
}
.cycle-box.cycle-x {
  color: #9a9495;
  font-size: 0.9rem;
}
.cycle-box.cycle-star {
  color: var(--star);
  text-shadow: -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink), 1px 1px 0 var(--ink);
}
.cycle-arrow {
  color: var(--muted);
  font-size: 0.9rem;
}
.help-tutorial-btn {
  margin: 0 0 20px;
  width: auto;
}
.help-learn-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: underline;
  font-weight: 800;
  font-size: 0.95rem;
}

.pause-modal form {
  display: flex;
  flex-direction: column;
  min-height: 550px; /* Make it very tall like the reference */
}
.pause-content {
  margin-top: auto;
  margin-bottom: auto; /* Vertically center in the remaining space */
  display: flex;
  flex-direction: column;
  align-items: center;
}
.pause-title {
  font-size: 3.5rem;
  line-height: 1.05;
  margin: 10px 0 24px;
}
.pause-resume-btn {
  margin-top: 30px;
  width: auto;
  padding: 0 24px;
}

@media (max-width: 559px) {
  .archive-copy {
    display: none;
  }
  .levels-copy {
    display: none;
  }
  .content-band {
    display: none;
  }
  .site-footer {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  ::before,
  ::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    background-attachment: initial !important;
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
}

html.reduced-motion *,
html.reduced-motion *::before,
html.reduced-motion *::after {
  animation-duration: 1ms !important;
  transition-duration: 1ms !important;
}

.puzzle-cell.cell-hint-gray {
  background: #d0d0d0;
  animation: hint-flash 620ms ease;
}

@keyframes star-dance {
  0%, 100% { transform: scale(1, 1) rotate(0deg) translateY(0); }
  15% { transform: scale(1.2, 0.8) rotate(-15deg) translateY(10%); }
  35% { transform: scale(0.8, 1.2) rotate(10deg) translateY(-20%); }
  50% { transform: scale(1.05, 0.95) rotate(0deg) translateY(5%); }
  65% { transform: scale(1.15, 0.85) rotate(15deg) translateY(10%); }
  85% { transform: scale(0.85, 1.15) rotate(-5deg) translateY(-15%); }
}

.is-completed .cell-star svg {
  transform-origin: center bottom;
  animation: star-dance 1.5s ease-in-out 1;
}

.is-completed .cell-star:nth-child(even) svg {
  animation-delay: 0.2s;
}

.is-completed .cell-star:nth-child(3n) svg {
  animation-delay: 0.4s;
}

.is-completed .cell-star:nth-child(4n) svg {
  animation-delay: 0.6s;
}
