:root {
  --paper: #f5f2e7;
  --paper-hot: #fffcf4;
  --ink: #1a1a1a;
  --ink-soft: #4a4741;
  --mint: #e0f0e5;
  --mint-hot: #c5ddd0;
  --brick: #c2412c;
  --line: #1a1a1a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}

body {
  line-height: 1.45;
}

.ntc {
  width: min(72rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.page .ntc {
  width: 100%;
  padding: 1rem 0 2.5rem;
}

.ntc-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
}

.ntc-brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.ntc-mark {
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.ntc-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.ntc-meta h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.ntc-byline {
  margin: 0.2rem 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.ntc-cluebar {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  border: 1px solid var(--ink);
  background: var(--paper-hot);
  padding: 0.7rem 0.9rem;
  margin-bottom: 1rem;
}

.ntc-cluebar-label {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ntc-cluebar-text {
  font-family: var(--serif);
  font-size: 1.08rem;
}

.ntc-play {
  display: grid;
  gap: 1.25rem;
  container-type: inline-size;
}

.ntc-board {
  min-width: 0;
  container-type: inline-size;
}

.ntc-grid {
  --cols: 4;
  --rows: 4;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-template-rows: repeat(var(--rows), 1fr);
  width: 100%;
  max-width: 100%;
  aspect-ratio: var(--cols) / var(--rows);
  gap: 1px;
  padding: 2px;
  background: var(--ink);
  border: 2px solid var(--ink);
  user-select: none;
  touch-action: manipulation;
  min-height: 12rem;
}

.ntc-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--paper-hot);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(0.58rem, 4.8cqi, 1.45rem);
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ntc-cell:focus {
  outline: none;
}

.ntc-cell.is-block {
  background: var(--ink);
  cursor: default;
}

.ntc-cell.is-word {
  background: var(--mint);
}

.ntc-cell.is-active {
  background: var(--mint-hot);
  box-shadow: inset 0 0 0 2px var(--ink);
  z-index: 1;
}

.ntc-cell.is-wrong .ntc-letter {
  color: var(--brick);
}

.ntc-cell.is-right {
  background: var(--mint-hot);
}

.ntc-status {
  flex: 1 0 100%;
  min-height: 1.2em;
  margin: 0.1rem 0 0;
  font-size: 0.88rem;
  font-weight: 600;
}

.ntc-num {
  position: absolute;
  top: 0.08rem;
  left: 0.1rem;
  font-size: clamp(0.36rem, 2.1cqi, 0.62rem);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.ntc-letter {
  pointer-events: none;
  transform: translateY(0.08em);
}

.ntc-revealed {
  position: absolute;
  right: 0.18rem;
  bottom: 0.12rem;
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--brick);
  pointer-events: none;
}

.ntc-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
  width: 100%;
}

.ntc-tools button {
  margin: 0;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.42rem 0.85rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  touch-action: manipulation;
}

.ntc-tools button:hover,
.ntc-tools button:focus-visible {
  background: var(--ink);
  color: var(--paper);
  outline: none;
}

.ntc-hintcount {
  flex: 1 0 100%;
  margin: 0.15rem 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.ntc-done {
  display: none;
  width: min(100%, 22.5rem);
  margin-top: 0.9rem;
  border-top: 1px solid var(--ink);
  padding-top: 0.7rem;
}

.ntc-done.is-on {
  display: block;
}

.ntc-done h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
}

.ntc-done p {
  margin: 0.25rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.ntc-clues {
  display: grid;
  gap: 1.1rem;
  min-width: 0;
  overflow: hidden;
  min-height: 0;
}

.ntc-cluecol h2 {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 0.25rem;
}

.ntc-cluelist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ntc-cluelist li {
  margin: 0;
}

.ntc-clue {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
  margin: 0;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  color: inherit;
  text-align: left;
  font-family: var(--sans);
  font-size: 0.88rem;
  line-height: 1.35;
  padding: 0.32rem 0.45rem 0.32rem 0.35rem;
  cursor: pointer;
  overflow-wrap: break-word;
}

.ntc-clue:hover,
.ntc-clue:focus-visible {
  background: var(--paper-hot);
  outline: none;
}

.ntc-clue.is-current {
  background: var(--mint);
  border-left-color: var(--ink);
}

.ntc-clue-num {
  font-weight: 700;
}

.ntc-kb {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  opacity: 0.01;
  border: 0;
  padding: 0;
  margin: 0;
  font-size: 16px;
  color: transparent;
  caret-color: transparent;
  background: transparent;
}

.ntc.is-touch .ntc-kb {
  bottom: auto;
  left: 0;
  top: 0;
  width: 16px;
  height: 16px;
  opacity: 0.01;
  z-index: 5;
  font-size: 16px;
}

.ntc.is-touch .ntc-cluebar {
  position: sticky;
  top: 0;
  z-index: 4;
}

@media (min-width: 1024px) {
  .ntc {
    padding-top: 1.75rem;
  }

  .ntc-play {
    grid-template-columns: minmax(0, 34rem) minmax(18rem, 1fr);
    gap: 1.15rem;
    align-items: start;
  }

  .ntc-board {
    width: 100%;
    max-width: min(34rem, 100%);
  }

  .ntc-clues {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    border: 1px solid var(--ink);
    padding: 0.9rem 1rem 1rem;
    overflow: hidden;
    min-height: 0;
    height: var(--ntc-board-h, auto);
    max-height: var(--ntc-board-h, none);
  }

@container (max-width: 56rem) {
  .ntc-clues {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
}

  .ntc-cluecol {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }

  .ntc-cluelist {
    flex: 1;
    min-height: 0;
    overflow-y: scroll;
    overscroll-behavior: contain;
    touch-action: pan-y;
    scrollbar-width: thin;
    scrollbar-color: var(--ink) var(--paper);
    scrollbar-gutter: stable;
  }

  .ntc-cluelist::-webkit-scrollbar {
    -webkit-appearance: none;
    width: 10px;
  }

  .ntc-cluelist::-webkit-scrollbar-track {
    background: var(--paper);
  }

  .ntc-cluelist::-webkit-scrollbar-thumb {
    background: var(--ink);
    border-radius: 5px;
    border: 2px solid var(--paper);
  }
}

@media (max-width: 1023px) {
  .ntc-grid {
    width: 100%;
    max-width: 100%;
  }

  .ntc-board {
    width: 100%;
    max-width: 100%;
  }

  .ntc-tools,
  .ntc-done {
    width: min(100%, 24rem);
  }

  .ntc-clues {
    height: auto;
    max-height: none;
    overflow: visible;
  }
}

.ntc-timer-row {
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin-top: 0.25rem;
}

.ntc-timer {
  margin: 0;
  min-width: 3.2rem;
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
}

.ntc.is-solved .ntc-grid {
  opacity: 0.4;
  filter: saturate(0.75);
  transition: opacity 0.55s ease, filter 0.55s ease;
  pointer-events: none;
}

.ntc.is-paused .ntc-grid {
  opacity: 0.42;
}

.ntc.is-paused .ntc-board::after {
  content: "Paused";
  display: block;
  margin-top: 0.45rem;
  font-family: var(--serif);
  font-size: 1.05rem;
}

.ntc-done-time {
  font-family: var(--serif);
  font-size: 1.15rem !important;
  color: var(--ink) !important;
}

.ntc-done-best {
  margin-top: 0.45rem !important;
  color: var(--brick) !important;
  font-family: var(--serif);
  font-size: 1.12rem !important;
}

.ntc-confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
  overflow: hidden;
}

.ntc-confetti-bit {
  display: block;
  position: absolute;
  top: auto;
  bottom: -8px;
  border-radius: 1px;
  animation-name: none;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  will-change: transform, opacity;
}

.ntc-confetti-bit.is-bursting {
  animation-name: ntc-burst;
}

@keyframes ntc-burst {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1; }
  12% { transform: translate3d(var(--dx, 0), var(--apex, -90vh), 0) rotate(160deg); opacity: 1; }
  78% { transform: translate3d(var(--dx2, 0), 4vh, 0) rotate(620deg); opacity: 1; }
  100% { transform: translate3d(var(--dx2, 0), 18vh, 0) rotate(800deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ntc-confetti {
    display: none;
  }
}

.ntc.is-touch .ntc-cluebar {
  background: var(--paper-hot);
}

.ntc.is-touch .ntc-cell {
  scroll-margin-top: 4.75rem;
  scroll-margin-bottom: 1.25rem;
}

@media (max-width: 1023px) {
  .page .ntc {
    padding: 0.2rem 0 1.5rem;
  }
  .ntc-play {
    overflow: visible;
    grid-template-columns: 1fr;
  }
  .ntc-board {
    max-width: 100%;
  }
  .ntc-grid {
    max-width: 100%;
  }
  .ntc-clues {
    display: grid;
    grid-template-columns: 1fr;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    min-height: 0;
  }
  .ntc-cluecol {
    height: auto;
    overflow: visible;
  }
  .ntc-cluelist {
    flex: none;
    overflow: visible;
    max-height: none;
  }
}
