:root {
  --ink: #173039;
  --muted: #5c7478;
  --paper: #fffdf7;
  --line: #d7ebe7;
  --teal: #11a7a0;
  --teal-deep: #08756f;
  --coral: #ff6b57;
  --yellow: #ffd166;
  --green: #6fcf72;
  --sky: #eafcff;
  --shadow: 0 18px 42px rgba(19, 80, 84, 0.14);
  --dialog-shadow: 0 28px 70px rgba(23, 48, 57, 0.26);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(180deg, #fff5bf 0%, var(--sky) 42%, #f7fff2 100%);
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
}

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.page-art {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  min-width: 920px;
  height: 46vh;
  opacity: 0.8;
  pointer-events: none;
}

.app {
  width: min(100%, 980px);
  min-height: 100svh;
  margin: 0 auto;
  padding: 14px 18px 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 14px;
}

.app-header {
  display: grid;
  grid-template-columns: 134px minmax(0, 1fr) 134px;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  gap: 12px;
  text-align: center;
}

.brand-mark {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 10px 24px rgba(8, 117, 111, 0.14);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 2rem;
  line-height: 1.05;
  font-weight: 850;
  letter-spacing: 0;
}

.status {
  margin-top: 4px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 750;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-actions:last-child {
  justify-content: flex-end;
}

.icon-button,
.mini-button,
.print-button,
.danger-button {
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-button {
  width: 42px;
  height: 42px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 24px rgba(8, 117, 111, 0.12);
}

.icon-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button:hover,
.mini-button:hover {
  background: #ffffff;
}

.icon-button:active,
.mini-button:active,
.danger-button:active {
  transform: translateY(1px);
}

.icon-button.ghost {
  background: transparent;
  box-shadow: none;
}

.icon-button.ghost span {
  color: var(--muted);
  font-size: 1.8rem;
  line-height: 1;
}

.game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  align-items: start;
  gap: 18px;
}

.copyright {
  padding: 2px 4px 0;
  color: rgba(92, 116, 120, 0.9);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.board-panel,
.word-panel {
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.board-panel {
  padding: 14px;
}

.day-strip {
  min-height: 34px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.day-label {
  color: var(--teal-deep);
  font-size: 0.98rem;
  font-weight: 900;
}

.day-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.timer {
  min-width: 58px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(215, 235, 231, 0.8);
  font-size: 0.86rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.mini-button {
  min-width: 70px;
  height: 32px;
  padding: 0 12px;
  color: var(--teal-deep);
  background: #e7fbf7;
  font-size: 0.86rem;
  font-weight: 900;
}

.progress {
  height: 10px;
  margin-bottom: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4f1ee;
}

.progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--yellow), var(--coral));
  transition: width 260ms ease;
}

.board-wrap {
  width: min(100%, 590px);
  margin: 0 auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.grid-stage {
  position: relative;
  aspect-ratio: 1;
  contain: layout paint size;
  overflow: hidden;
}

.streak-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  overflow: hidden;
  pointer-events: none;
}

.streak-line {
  opacity: 0.84;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 7px rgba(23, 48, 57, 0.12));
}

.letter-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-template-rows: repeat(10, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  align-items: stretch;
  justify-items: stretch;
  gap: 5px;
  touch-action: none;
  user-select: none;
}

.cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: #f7fbfa;
  box-shadow: inset 0 0 0 1px #dcefeb;
  font-size: 1.2rem;
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0;
  cursor: pointer;
  transition:
    background-color 120ms ease,
    color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.cell:hover {
  background: #eef9f6;
}

.cell-letter {
  position: relative;
  z-index: 3;
  pointer-events: none;
}

.cell.selecting,
.cell.anchor {
  color: #1d2528;
  background: var(--select-color, var(--yellow));
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.72),
    0 6px 14px rgba(31, 124, 130, 0.18);
  transform: scale(1.02);
}

.cell.found {
  color: #101820;
  background: transparent;
  box-shadow: none;
}

.cell.found.selecting {
  background: var(--select-color, #ffe08a);
}

.muted-colors .streak-line {
  stroke: #74d8cc;
}

.muted-colors .word::before {
  background: var(--teal);
}

.cell.miss {
  animation: miss 260ms ease;
}

.cell:focus-visible,
.icon-button:focus-visible,
.mini-button:focus-visible,
.print-button:focus-visible,
.danger-button:focus-visible {
  outline: 3px solid rgba(17, 167, 160, 0.42);
  outline-offset: 3px;
}

.word-panel {
  padding: 18px;
}

.word-panel h2 {
  margin-bottom: 12px;
  font-size: 1.05rem;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: 0;
}

.word-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.word {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.word::before {
  content: "";
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--word-color, var(--teal));
  box-shadow: 0 0 0 3px rgba(17, 167, 160, 0.12);
}

.word.found {
  color: var(--teal-deep);
  border-color: var(--word-color, rgba(17, 167, 160, 0.34));
  background: #f6fffb;
}

.word.found::after {
  content: "FOUND";
  margin-left: auto;
  color: var(--teal-deep);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
}

.word.pop {
  animation: pop 360ms ease;
}

.complete .brand-mark {
  animation: pop 460ms ease;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(23, 48, 57, 0.26);
  backdrop-filter: blur(8px);
}

.modal[hidden] {
  display: none;
}

.dialog {
  width: min(100%, 440px);
  max-height: min(720px, calc(100svh - 36px));
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 253, 247, 0.98);
  box-shadow: var(--dialog-shadow);
}

.help-dialog {
  width: min(100%, 500px);
  padding: 16px 18px 20px;
  background:
    linear-gradient(180deg, rgba(255, 250, 218, 0.98), rgba(247, 255, 252, 0.98));
}

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

.stats-dialog {
  width: min(100%, 470px);
}

.complete-dialog {
  width: min(100%, 430px);
  overflow: hidden;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 248, 197, 0.98), rgba(241, 255, 250, 0.98));
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.dialog-header p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.help-steps {
  display: grid;
  gap: 10px;
  color: var(--ink);
  font-weight: 760;
  line-height: 1.45;
}

.help-steps strong {
  font-weight: 950;
}

.summer-help-art {
  margin: -2px auto 12px;
  display: grid;
  place-items: center;
}

.summer-help-art svg {
  width: min(100%, 280px);
  height: auto;
  filter: drop-shadow(0 14px 22px rgba(8, 117, 111, 0.18));
}

.complete-art {
  margin: -10px auto 6px;
  display: grid;
  place-items: center;
}

.complete-art svg {
  width: min(100%, 260px);
  height: auto;
  filter: drop-shadow(0 16px 22px rgba(8, 117, 111, 0.2));
}

.complete-dialog h2 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.05;
  font-weight: 950;
}

.complete-message {
  margin-top: 9px;
  color: var(--teal-deep);
  font-size: 1.02rem;
  font-weight: 900;
}

.complete-joke {
  margin: 8px auto 0;
  max-width: 280px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.35;
}

.share-text {
  width: 100%;
  min-height: 112px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  resize: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  font: 800 0.9rem/1.35 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.complete-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.complete-actions .mini-button,
.complete-actions .danger-button {
  width: 100%;
  height: 42px;
  margin: 0;
}

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

.archive-day {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  gap: 1px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  cursor: pointer;
}

.archive-day:disabled {
  cursor: not-allowed;
}

.archive-day span {
  font-size: 0.88rem;
  font-weight: 950;
}

.archive-day small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
}

.archive-day.current {
  border-color: var(--coral);
  background: #fff1ed;
  box-shadow: inset 0 0 0 2px rgba(255, 107, 87, 0.14);
}

.archive-day:not(:disabled):hover {
  background: #effbf8;
}

.archive-day.locked {
  color: #9caeb1;
  background: rgba(247, 251, 250, 0.76);
  box-shadow: inset 0 0 0 1px rgba(215, 235, 231, 0.7);
}

.archive-day.locked span {
  opacity: 0.72;
}

.archive-day.today {
  border-color: rgba(17, 167, 160, 0.2);
  background: #effbf8;
}

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

.stat-card {
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 10px 6px;
  background: rgba(255, 255, 255, 0.78);
  text-align: center;
}

.stat-card strong {
  color: var(--ink);
  font-size: 1.9rem;
  line-height: 1;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.15;
  font-weight: 900;
}

.streak-goal {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 250, 218, 0.8), rgba(239, 251, 248, 0.86));
}

.streak-goal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--teal-deep);
  font-size: 0.96rem;
  font-weight: 950;
}

.streak-goal-header span {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.streak-goal-bar {
  height: 12px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfeeed;
}

.streak-goal-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--yellow), var(--coral));
  transition: width 240ms ease;
}

.streak-goal p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.35;
}

.setting-row {
  min-height: 64px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--ink);
}

.setting-row strong,
.setting-row small {
  display: block;
}

.setting-row strong {
  font-size: 0.98rem;
}

.setting-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

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

.danger-button {
  width: 100%;
  height: 42px;
  margin-top: 12px;
  color: #ffffff;
  background: var(--coral);
  font-size: 0.94rem;
  font-weight: 900;
}

.print-button {
  width: 100%;
  height: 42px;
  margin-top: 12px;
  color: var(--teal-deep);
  background: #e7fbf7;
  font-size: 0.94rem;
  font-weight: 900;
}

.print-button:hover {
  background: #d7f8f2;
}

.danger-button:hover {
  background: #f05d4c;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes miss {
  25% {
    transform: translateX(-2px);
  }

  55% {
    transform: translateX(2px);
  }

  100% {
    transform: translateX(0);
  }
}

@keyframes pop {
  45% {
    transform: scale(1.06);
  }

  100% {
    transform: scale(1);
  }
}

@media (max-width: 760px) {
  .app {
    justify-content: flex-start;
    padding: 10px 12px 12px;
    gap: 10px;
  }

  .app-header {
    grid-template-columns: 42px minmax(0, 1fr) 136px;
    align-items: center;
    gap: 8px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  h1 {
    font-size: 1.25rem;
    max-width: 180px;
  }

  .status {
    font-size: 0.94rem;
  }

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

  .game {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .board-panel {
    padding: 10px;
  }

  .day-strip {
    align-items: flex-start;
  }

  .day-tools {
    flex-wrap: wrap;
    max-width: 160px;
  }

  .timer,
  .mini-button {
    min-width: 62px;
  }

  .board-wrap {
    padding: 6px;
  }

  .letter-grid {
    gap: 4px;
  }

  .cell {
    border-radius: 6px;
    font-size: 1rem;
  }

  .word-panel {
    padding: 12px;
  }

  .word-panel h2 {
    margin-bottom: 8px;
  }

  .word-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .word {
    min-height: 36px;
    padding: 7px 8px;
    font-size: 0.9rem;
  }

  .word.found::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--teal);
  }

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

  .archive-day {
    min-height: 46px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .complete-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .brand-mark {
    display: none;
  }

  .cell {
    font-size: 0.92rem;
  }

  .word-list {
    grid-template-columns: 1fr 1fr;
  }

  .archive-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media print {
  @page {
    margin: 0.45in;
  }

  html,
  body {
    min-height: auto;
    color: #111111;
    background: #ffffff;
  }

  .page-art,
  .header-actions,
  .day-tools,
  .progress,
  .streak-layer,
  .modal {
    display: none !important;
  }

  .app {
    width: 100%;
    min-height: auto;
    padding: 0;
    gap: 0.18in;
  }

  .app-header {
    grid-template-columns: 1fr;
    margin-bottom: 0.05in;
  }

  .brand {
    justify-content: flex-start;
    text-align: left;
  }

  .brand-mark {
    width: 0.48in;
    height: 0.48in;
    box-shadow: none;
  }

  h1 {
    font-size: 22pt;
  }

  .status {
    display: none;
  }

  .game {
    grid-template-columns: minmax(0, 1fr) 2.1in;
    gap: 0.22in;
    align-items: start;
  }

  .board-panel,
  .word-panel {
    border: 1px solid #222222;
    background: #ffffff;
    box-shadow: none;
    backdrop-filter: none;
  }

  .board-panel {
    padding: 0.14in;
  }

  .day-strip {
    min-height: auto;
    margin-bottom: 0.12in;
  }

  .day-label {
    color: #111111;
    font-size: 12pt;
  }

  .board-wrap {
    width: min(100%, 5.6in);
    padding: 0.08in;
    border-color: #222222;
    background: #ffffff;
  }

  .letter-grid {
    gap: 0.035in;
  }

  .cell,
  .cell.found {
    color: #111111;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px #222222;
    font-size: 13pt;
    transform: none;
  }

  .word-panel {
    padding: 0.14in;
  }

  .word-panel h2 {
    font-size: 13pt;
  }

  .word-list {
    gap: 0.055in;
  }

  .word,
  .word.found {
    min-height: auto;
    border: 1px solid #444444;
    color: #111111;
    background: #ffffff;
    font-size: 10pt;
    box-shadow: none;
  }

  .word::before,
  .word.found::after {
    display: none;
  }

  .copyright {
    margin-top: 0.16in;
    color: #555555;
    font-size: 8pt;
    text-align: left;
  }
}
