:root {
  --ink: #20242a;
  --muted: #68717d;
  --paper: #fffdf8;
  --panel: #f4f0e8;
  --line: #c9c1b3;
  --accent: #315c4c;
  --accent2: #d6a84f;
  --wrong: #b64d46;
  --right: #3d795c;
  --page: #e9e4da;
}


* {
  box-sizing: border-box;
}


html {
  min-height: 100%;
}


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

  background: var(--page);
  color: var(--ink);

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
}


button,
input {
  font: inherit;
}


a {
  color: var(--accent);
}


.app {
  width: min(
    calc(100% - 32px),
    1160px
  );

  margin: 0 auto;
  padding: 34px 0 24px;
}


.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 26px;

  margin-bottom: 22px;
}


.hero h1 {
  margin: 0 0 7px;

  font-family:
    Georgia,
    "Times New Roman",
    serif;

  font-size:
    clamp(
      2.3rem,
      5vw,
      4rem
    );

  line-height: 1;
  letter-spacing: -0.03em;
}


.hero p {
  margin: 0;

  color: var(--muted);

  font-size: 1.05rem;
  line-height: 1.5;
}


.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}


.daily-badge {
  display: inline-flex;
  align-items: center;
  min-height: 38px;

  padding: 8px 12px;

  border: 1px solid var(--line);
  border-radius: 999px;

  background: var(--paper);
  color: var(--ink);

  font-size: 0.88rem;
  font-weight: 650;

  text-decoration: none;
  white-space: nowrap;
}


a.daily-badge:hover {
  border-color: var(--accent);
  color: var(--accent);
}


.game {
  display: grid;
  grid-template-columns:
    minmax(0, 620px)
    minmax(320px, 1fr);

  gap: 28px;
  align-items: start;
}


.board-wrap {
  min-width: 0;

  padding: 14px;

  border: 1px solid var(--line);
  border-radius: 16px;

  background: var(--paper);

  box-shadow:
    0 8px 24px
    rgba(32, 36, 42, 0.08);
}


.status {
  min-height: 24px;
  margin-bottom: 13px;

  color: var(--muted);

  font-size: 0.96rem;
}


.status.success {
  color: var(--right);
  font-weight: 700;
}


.status.error {
  color: var(--wrong);
  font-weight: 700;
}


.grid {
  display: grid;

  width: 100%;
  max-width: none;
  aspect-ratio: 1;

  margin: 0 auto;

  border: 3px solid var(--ink);

  background: var(--ink);

  gap: 1px;
}


.cell {
  position: relative;

  display: flex;
  align-items: center;
  justify-content: center;

  min-width: 0;
  min-height: 0;

  background: #ffffff;
}


.cell.block {
  background: var(--ink);
}


.cell input {
  width: 100%;
  height: 100%;

  padding: 0;

  border: 0;
  outline: 0;

  background: transparent;
  color: var(--ink);

  text-align: center;
  text-transform: uppercase;

  font-size:
    clamp(
      0.95rem,
      2.2vw,
      1.55rem
    );

  font-weight: 700;
}


.cell input:focus {
  background:
    rgba(
      214,
      168,
      79,
      0.28
    );
}


.cell.correct {
  background: #ffffff;
}


.cell.incorrect {
  background: #f3cfcc;
  box-shadow:
    inset 0 0 0 3px var(--wrong);
}

.cell.incorrect input {
  background: transparent;
  color: #6f211c;
  font-weight: 800;
}

.cell.incorrect input:focus {
  background: #f3cfcc;
  color: #6f211c;
}

.cell.incorrect .number {
  color: #6f211c;
}


.number {
  position: absolute;
  top: 2px;
  left: 3px;

  z-index: 2;

  color: var(--ink);

  font-size:
    clamp(
      0.44rem,
      1vw,
      0.66rem
    );

  font-weight: 700;

  line-height: 1;
  pointer-events: none;
}


.puzzle-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;

  margin-top: 16px;
}


.check,
.share {
  appearance: none;

  min-height: 44px;

  padding: 10px 18px;

  border: 1px solid var(--accent);
  border-radius: 10px;

  background: var(--accent);
  color: white;

  font-weight: 700;

  cursor: pointer;
}


.share {
  border-color: var(--accent2);
  background: var(--accent2);
  color: var(--ink);
}


.check:hover:not(:disabled),
.share:hover {
  filter: brightness(0.96);
}


.check:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}


.clues {
  display: grid;
  gap: 18px;
}


.clues section {
  padding: 18px 20px 20px;

  border: 1px solid var(--line);
  border-radius: 16px;

  background: var(--paper);

  box-shadow:
    0 8px 24px
    rgba(32, 36, 42, 0.06);
}


.clues h2 {
  margin: 0 0 12px;

  font-family:
    Georgia,
    "Times New Roman",
    serif;

  font-size: 1.45rem;
}


.clue-list {
  display: grid;
  gap: 4px;
}


.clue-item {
  margin: 0;
  padding: 7px 8px;

  border-radius: 7px;

  line-height: 1.42;

  cursor: pointer;
}


.clue-item:hover {
  background: var(--panel);
}


.clue-item.active {
  background:
    rgba(
      214,
      168,
      79,
      0.23
    );

  font-weight: 650;
}


footer {
  margin-top: 26px;
  padding: 18px 4px 6px;

  border-top:
    1px solid var(--line);

  color: var(--muted);

  font-size: 0.88rem;
}


.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}


.footer-progress {
  display: flex;
  align-items: center;
  gap: 14px;

  text-align: center;
}


#tip {
  max-width: 430px;
}


#progress {
  white-space: nowrap;
  font-weight: 700;
}


.footer-links {
  display: flex;
  gap: 12px;

  white-space: nowrap;
}


.footer-links a {
  color: var(--muted);
  text-decoration: none;
}


.footer-links a:hover {
  color: var(--accent);
}


/* ---------------------------------
   Share completion dialog
   --------------------------------- */

.share-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 24px;

  background:
    rgba(
      32,
      36,
      42,
      0.72
    );
}


.share-modal[hidden] {
  display: none;
}


.share-dialog {
  position: relative;

  width:
    min(
      100%,
      1040px
    );

  max-height: 92vh;
  overflow-y: auto;

  padding: 34px;

  border:
    1px solid var(--line);

  border-radius: 20px;

  background: var(--paper);

  box-shadow:
    0 28px 80px
    rgba(
      0,
      0,
      0,
      0.3
    );
}


.share-close {
  position: absolute;
  top: 10px;
  right: 16px;

  width: 40px;
  height: 40px;

  border: 0;

  background: transparent;
  color: var(--muted);

  font-size: 34px;
  line-height: 1;

  cursor: pointer;
}


.share-close:hover {
  color: var(--ink);
}


.share-layout {
  display: grid;

  grid-template-columns:
    minmax(
      220px,
      0.72fr
    )
    minmax(
      390px,
      1.28fr
    );

  gap: 32px;

  align-items: center;
}


.share-kicker {
  margin: 0 0 8px;

  color: var(--accent);

  font-size: 0.82rem;
  font-weight: 800;

  letter-spacing: 0.08em;
  text-transform: uppercase;
}


.share-copy h2 {
  margin:
    0
    0
    20px;

  font-family:
    Georgia,
    "Times New Roman",
    serif;

  font-size:
    clamp(
      2rem,
      4vw,
      3rem
    );

  line-height: 1.03;
}


.share-message {
  margin: 0;

  color: var(--ink);

  font-size: 1.25rem;
  font-weight: 750;

  line-height: 1.45;
}


.share-invite {
  margin:
    12px
    0
    0;

  color: var(--muted);

  font-size: 1.05rem;
}


.share-card-wrap {
  overflow: hidden;

  border:
    1px solid var(--line);

  border-radius: 15px;

  background: white;

  box-shadow:
    0 12px 34px
    rgba(
      32,
      36,
      42,
      0.13
    );
}


#share-card {
  display: block;

  width: 100%;
  height: auto;
}


.share-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;

  gap: 9px;

  margin-top: 28px;
}


.share-buttons button {
  appearance: none;

  min-height: 42px;

  padding: 9px 14px;

  border:
    1px solid var(--line);

  border-radius: 9px;

  background: var(--panel);
  color: var(--ink);

  font: inherit;
  font-weight: 650;

  cursor: pointer;
}


.share-buttons button:hover {
  border-color: var(--accent);

  background: var(--accent);
  color: #ffffff;
}


.share-note {
  max-width: 720px;

  margin:
    17px
    auto
    0;

  color: var(--muted);

  font-size: 0.82rem;
  line-height: 1.4;

  text-align: center;
}


@media (
  max-width: 820px
) {
  .hero {
    flex-direction: column;
  }

  .controls {
    justify-content:
      flex-start;
  }

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

  .footer-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-progress {
    text-align: left;
  }

  .share-layout {
    grid-template-columns:
      1fr;
  }

  .share-copy {
    padding-right: 32px;
  }
}


@media (
  max-width: 560px
) {
  .app {
    width:
      min(
        calc(100% - 20px),
        1160px
      );

    padding-top: 20px;
  }

  .board-wrap,
  .clues section {
    padding: 12px;
  }

  .daily-badge {
    font-size: 0.8rem;
  }

  .footer-progress {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .share-modal {
    padding: 10px;
  }

  .share-dialog {
    padding:
      30px
      16px
      20px;
  }

  .share-layout {
    gap: 20px;
  }

  .share-buttons button {
    flex:
      1
      1
      calc(50% - 9px);
  }
}
