/* Knot Really: one tangled question a day. Built on the site's base styles,
   with its own colour: mint, with a rope-tan knot and white-beige buttons. */

:root {
  --page: #d3eadb;    /* the page itself: mint */
  --card: #a9d6b9;    /* cards and the active stage */
  --middle: #e6f4eb;  /* the lighter band the game sits on, on a big screen */
  --rope: #e9b872;
  --button: #fbf7f2;  /* white-beige buttons */
  --mint-deep: #2f7a4d;
  --plum-soft: #4f4566; /* the site's soft purple is too faint on the mint */
  --you: #d9604c;     /* your guess on the chart */
  --green: #6cc28a;
  --yellow: #f5d36b;
  --orange: #f3a35c;
  --red: #e7735f;
}

body { background: var(--page); }
.btn, .btn.primary { background: var(--button); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 16px 16px 8px;
}
.home-link { font-weight: 800; text-decoration: none; }
.home-link:hover { text-decoration: underline; }
.topbar-actions { display: flex; gap: 8px; }

.stage {
  flex: 1;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 16px 24px;
}

.title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 0;
  font: 600 40px/1.1 var(--serif);
}
.logo { width: 38px; height: 38px; transform: rotate(-6deg); }
.date { margin: 2px 0 14px; text-align: center; color: var(--plum-soft); font-weight: 700; }
.previewing .date { display: table; margin: 4px auto 14px; padding: 3px 12px; border: 2px dashed var(--plum); border-radius: 999px; background: var(--butter); color: var(--plum); }

.practice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 14px;
  padding: 8px 14px;
  border: 2px dashed var(--plum);
  border-radius: 18px;
  background: #fffbea;
  font-weight: 800;
  font-size: 14px;
}

/* ---- The knot itself ---- */
.knot-card {
  padding: 18px 20px 22px;
  border: 2px solid var(--plum);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 6px 0 var(--plum);
}
.knot-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.chip { padding: 4px 12px; border-radius: 999px; background: var(--page); font-size: 14px; font-weight: 800; }
.timer { font-weight: 800; color: var(--plum-soft); font-variant-numeric: tabular-nums; }
.knot-text { margin: 0; font: 500 21px/1.45 var(--serif); }
@media (min-width: 600px) { .knot-text { font-size: 23px; } }

.panel {
  padding: 18px;
  border: 2px solid var(--plum);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.55);
}
.panel h2 { margin: 0; font: 600 22px/1.2 var(--serif); }
.panel .sub { margin: 2px 0 14px; color: var(--plum-soft); font-weight: 700; font-size: 15px; }

.feedback { min-height: 1.4em; margin: 12px 0 0; font-weight: 800; text-align: center; }
.feedback:empty { min-height: 0; margin: 0; }


/* ---- Estimate ---- */
.knot-card + .estimate { margin-top: 18px; }
.guess-form { display: flex; gap: 10px; margin-top: 12px; }
.guess-box {
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
  border: 2px solid var(--plum);
  border-radius: 999px;
  background: #fff;
}
.guess-box:focus-within { box-shadow: 0 0 0 3px var(--card); }
.guess-box input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 0 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--plum);
  font: 800 19px var(--sans);   /* 16px or more, or iPhone zooms in */
  -webkit-appearance: none;
  appearance: none;
}
.guess-box input:focus { outline: none; }
.unit { padding: 0 16px 0 6px; color: var(--plum-soft); font-weight: 800; white-space: nowrap; }
.guess-read { min-height: 1.4em; margin: 8px 4px 0; font-weight: 800; }
.guess-read:empty { min-height: 0; margin: 0; }
.guess-help { margin: 8px 4px 0; font-size: 14px; color: var(--plum-soft); font-weight: 700; }

.sq { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--plum); border-radius: 5px; vertical-align: -3px; }
.sq.green { background: var(--green); }
.sq.yellow { background: var(--yellow); }
.sq.orange { background: var(--orange); }
.sq.red { background: var(--red); }

/* ---- The notebook: lined paper for untangling ---- */
.notebook-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 14px;
  padding: 12px 16px;
  border: 2px solid var(--plum);
  border-radius: 18px;
  background: var(--butter);
  box-shadow: 0 4px 0 var(--plum);
  color: var(--plum);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
.notebook-btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--plum); }
.notebook-btn:focus-visible { outline: 3px solid var(--plum); outline-offset: 3px; }
.notebook-btn svg { flex: none; width: 30px; height: 30px; transform: rotate(-6deg); }
.notebook-btn strong { display: block; font: 600 19px/1.2 var(--serif); }
.notebook-btn small { font-size: 14px; font-weight: 700; color: var(--plum-soft); }
.notebook-btn[aria-expanded="true"] { border-radius: 18px 18px 0 0; box-shadow: none; transform: none; }

.notebook {
  padding: 4px 16px 16px;
  border: 2px solid var(--plum);
  border-top: 0;
  border-radius: 0 0 18px 18px;
  background: #fffdf6;
  box-shadow: 0 4px 0 var(--plum);
}
/* Ruled lines with a red margin, lined up with the text */
.notebook textarea {
  display: block;
  width: 100%;
  min-height: 168px;
  margin: 0;
  padding: 0 4px 0 30px;
  border: 0;
  background:
    linear-gradient(90deg, transparent 20px, rgba(217, 96, 76, 0.45) 20px, rgba(217, 96, 76, 0.45) 22px, transparent 22px),
    repeating-linear-gradient(transparent 0 27px, rgba(46, 36, 64, 0.14) 27px 28px);
  color: var(--plum);
  font: 700 17px/28px var(--sans);   /* 16px or more, or iPhone zooms in */
  resize: vertical;
}
.notebook textarea:focus { outline: none; }
.notebook textarea::placeholder { color: rgba(79, 69, 102, 0.6); }
.layers { margin-top: 12px; padding: 12px 16px; border: 2px dashed var(--plum); border-radius: 14px; background: #fff; }
.layers-title { margin: 0 0 6px; font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--plum-soft); }
.layers ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 15px; }
.notebook-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 12px; font-size: 14px; font-weight: 700; color: var(--plum-soft); }
.hint { background: #fff; }

/* ---- Results ---- */
.results { display: grid; gap: 16px; margin-top: 4px; }
.results-card {
  padding: 22px 18px;
  border: 2px solid var(--plum);
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 6px 0 var(--plum);
  text-align: center;
  animation: rise 0.45s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.kicker { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--plum-soft); }
.res-title { margin: 4px 0 4px; font: 600 32px/1.1 var(--serif); }
.res-guess { margin: 0 0 14px; font-weight: 800; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tiles > div { display: flex; flex-direction: column; justify-content: center; padding: 12px 6px; border: 2px solid var(--plum); border-radius: 16px; background: #fff; font-size: 13px; font-weight: 700; color: var(--plum-soft); line-height: 1.25; }
.tiles .big { font-size: 24px; }
.win-buttons { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.win-buttons .btn:not(.primary) { background: #fff; }
.share-note { min-height: 1.4em; margin: 10px 0 0; font-weight: 800; }
.share-note:empty { min-height: 0; margin: 0; }
@keyframes rise { from { transform: translateY(20px) scale(0.96); opacity: 0; } }

.chart-card, .answer-card, .walk { padding: 18px; border: 2px solid var(--plum); border-radius: 22px; background: #fff; }
.chart-title { margin: 0 0 8px; font: 600 20px/1.2 var(--serif); }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .bar { fill: #d9ddd9; }
.chart .bar.mine { fill: var(--you); }
.chart .axis { fill: var(--plum-soft); font: 700 11px var(--sans); }
.chart .baseline { stroke: var(--plum); stroke-width: 1.5; }
.chart .answer-line { stroke: var(--plum); stroke-width: 2.5; }
.chart .you-line { stroke: var(--you); stroke-width: 2.5; stroke-dasharray: 5 4; }
.chart .label { font: 800 12px var(--sans); fill: var(--plum); }
.chart .label.you { fill: var(--you); }
.chart .trap { font: 800 11px var(--sans); fill: var(--plum-soft); }
.chart-empty { margin: 0; padding: 18px 8px; border: 2px dashed rgba(46, 36, 64, 0.3); border-radius: 14px; text-align: center; font-weight: 700; color: var(--plum-soft); }

.answer-card { text-align: center; }
.answer-label { font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--plum-soft); }
.answer { display: block; margin: 4px 0; font: 600 34px/1.1 var(--serif); }
.answer-q { margin: 0; font-weight: 700; }
.source { margin: 8px 0 0; font-size: 14px; color: var(--plum-soft); }
.source a { font-weight: 800; color: var(--plum); }

.walk h3 { margin: 0 0 10px; font: 600 20px/1.2 var(--serif); }
.walk ol { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.walk-meta { margin: 12px 0 0; font-size: 14px; font-weight: 700; color: var(--plum-soft); }

.next-knot { margin: 0; text-align: center; font-weight: 700; color: var(--plum-soft); }
.next-knot strong { color: var(--plum); font-variant-numeric: tabular-nums; }

/* ---- Practice list ---- */
.practice-list h2 { margin: 0; font: 600 26px/1.2 var(--serif); }
.practice-list h3 { margin: 22px 0 10px; font: 600 20px/1.2 var(--serif); }
.practice-list .sub { margin: 4px 0 0; color: var(--plum-soft); font-weight: 700; }
.pick-list { display: grid; gap: 8px; margin: 0 0 8px; padding: 0; list-style: none; }
.pick-list a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 2px solid var(--plum);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 3px 0 var(--plum);
  text-decoration: none;
}
.pick-list .no { font: 600 18px/1 var(--serif); }
.pick-list .peek { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 14px; color: var(--plum-soft); font-weight: 700; }
.pick-list .done { font-size: 13px; font-weight: 800; white-space: nowrap; }
.pick-list .empty { padding: 14px; border: 2px dashed rgba(46, 36, 64, 0.3); border-radius: 14px; color: var(--plum-soft); font-weight: 700; }
.practice-list > .btn { margin-top: 20px; }
.practicing .practice-link, .practicing .side-practice { display: none; }
.practice-link { margin-top: 14px; background: #fff; }
.listing .knot-card, .listing .notebook-btn, .listing #community-link, .listing .about-game, .listing .community-link { display: none; }

/* Dialogs (same as the rest of the site) */
.sheet {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 28px 24px 24px;
  border: 2px solid var(--plum);
  border-radius: 24px;
  background: #f4fbf6;
  color: var(--plum);
}
.sheet::backdrop { background: rgba(46, 36, 64, 0.35); }
.sheet h2 { margin: 0 0 14px; font: 600 26px/1.2 var(--serif); }
.sheet .close { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; font-size: 14px; }
.rules { margin: 0 0 18px; padding-left: 22px; display: grid; gap: 8px; }
.wide { width: 100%; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-row > div { display: flex; flex-direction: column; padding: 14px 8px; border-radius: 18px; background: #fff; border: 2px solid var(--plum); text-align: center; font-size: 13px; font-weight: 700; color: var(--plum-soft); line-height: 1.25; }
.big { font: 800 26px/1.2 var(--sans); color: var(--plum); }
.stats-note { margin: 14px 0 0; font-size: 13px; color: var(--plum-soft); text-align: center; }

/* Confetti in knot colours on a close guess */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.bit {
  position: absolute;
  top: 40%;
  left: 50%;
  width: var(--size);
  height: calc(var(--size) / 3);
  background: var(--color);
  border: 1.5px solid var(--plum);
  border-radius: 99px;
  animation: tumble 1.3s cubic-bezier(0.15, 0.7, 0.4, 1) forwards;
}
@keyframes tumble { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }

@media (min-width: 900px) {
  .title { font-size: 46px; }
}

/* About the game: for new players, and so search engines have real text to read */
.about-game { margin: 32px 0 0; padding: 20px 22px; border: 2px solid var(--line); border-radius: 20px; background: #fff; }
.about-game h2 { margin: 0 0 8px; font: 600 22px/1.2 var(--serif); }
.about-game p { margin: 0 0 10px; font-size: 15px; line-height: 1.6; color: var(--plum-soft); }
.about-game p:last-child { margin: 0; }

.community-link {
  display: grid;
  gap: 2px;
  margin: 28px 0 0;
  padding: 16px 18px;
  border: 2px solid var(--plum);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 4px 0 var(--plum);
  text-decoration: none;
  font: 600 20px/1.2 var(--serif);
}
.community-link-sub { font: 700 14px/1.4 var(--sans); color: var(--plum-soft); }

/* ---- Community knots: who tied it, and a vote ---- */
.tray-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin: -4px 0 14px;
  padding: 10px 14px;
  border: 2px solid var(--plum);
  border-radius: 18px;
  background: #fff;
}
.tray-info { display: grid; gap: 2px; min-width: 0; }
.tray-info strong { font: 600 19px/1.2 var(--serif); }
.tray-info span { font-size: 14px; font-weight: 700; color: var(--plum-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vote {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 8px 14px;
  border: 2px solid var(--plum);
  border-radius: 999px;
  background: #fff;
  color: var(--plum);
  font: 800 14px/1 var(--sans);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--plum);
}
.vote[aria-pressed="true"] { background: var(--card); }
.vote:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.vote-count { padding: 2px 8px; border-radius: 999px; background: var(--card); font-variant-numeric: tabular-nums; }

/* ---- Side columns: only on a computer-sized screen, like Snug ---- */
.side { display: none; }

.side-label {
  display: block;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--plum-soft);
}
.side h2 { margin: 0 0 12px; font: 600 24px/1.2 var(--serif); }
.side .rules { padding-left: 20px; font-size: 16px; }
.side .example {
  padding: 16px 18px;
  border: 2px solid var(--plum);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 4px 0 var(--plum);
}
.side .example p { margin: 0; font-size: 15px; line-height: 1.5; }
.side .example-label { margin-bottom: 8px !important; font-size: 12px !important; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--plum-soft); }
.side .example-knot { margin-bottom: 10px !important; font: 500 17px/1.4 var(--serif) !important; }
.side .example-steps { margin: 0 0 12px; padding: 10px 12px 10px 30px; border-radius: 12px; background: #fff; font-size: 14px; display: grid; gap: 4px; }
.side .stat-row { margin-bottom: 14px; }

.today-levels { list-style: none; margin: 0 0 4px; padding: 0; display: grid; gap: 2px; }
.today-levels li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 2px; border-bottom: 1px solid rgba(46, 36, 64, 0.12); font-weight: 800; }
.today-levels span { color: var(--plum-soft); text-align: right; }

.next-trays {
  display: flex;
  flex-direction: column;
  margin-top: 18px;
  padding: 16px;
  border: 2px solid var(--plum);
  border-radius: 18px;
  background: var(--button);
  text-align: center;
}
.next-trays .side-label { margin: 0; }
.next-trays .big { font-size: 32px; font-variant-numeric: tabular-nums; }
.side-practice { margin-top: 18px; }

.side-community { margin-top: 26px; }
.side-community-head { display: flex; justify-content: space-between; align-items: baseline; }
.side-community-head a { font-size: 14px; font-weight: 800; }
.side-knots { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.side-knots a { display: grid; gap: 4px; padding: 10px 12px; border: 2px solid var(--plum); border-radius: 14px; background: var(--button); text-decoration: none; }
.side-knots a:hover { transform: translateY(-1px); }
.side-knots strong { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font: 500 15px/1.35 var(--serif); }
.side-knots small { color: var(--plum-soft); font-weight: 700; }
.side-empty { padding: 14px; border: 2px dashed rgba(46, 36, 64, 0.3); border-radius: 14px; color: var(--plum-soft); font-weight: 700; font-size: 14px; }

.desk { flex: 1; }

@media (min-width: 1200px) {
  /* Three bands: the deeper dotted mint either side, the game on a lighter
     band in the middle. */
  body:has(> .desk) {
    background-color: var(--page);
    background-image:
      linear-gradient(90deg, transparent calc(50% - 320px), var(--middle) calc(50% - 320px), var(--middle) calc(50% + 320px), transparent calc(50% + 320px)),
      radial-gradient(rgba(46, 36, 64, 0.13) 1.5px, transparent 1.5px);
    background-size: auto, 22px 22px;
  }
  body:has(> .desk) > .topbar { max-width: none; padding: 20px 32px 8px; }
  .desk {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 640px minmax(0, 1fr);
  }
  .desk > .stage { max-width: none; padding: 0 40px 40px; }
  .side {
    display: block;
    align-self: start;
    position: sticky;
    top: 24px;
    padding: 24px 32px;
  }
  .side-inner { max-width: 320px; }
  .side-left .side-inner { margin-left: auto; }
  /* The right column already links to practice and the community */
  .stage > .community-link { display: none; }
}
