/* AI-dle: a daily brief on the desk. One sheet of bond paper, typed clues, redaction that lifts as you play. */
.desk {
  --paper: #e9ece6;
  --paper-edge: #d9ded6;
  --ink: #1d2530;
  --ink-soft: #4d5864;
  --ink-faint: #7d8791;
  --rule: #b9c6d2;
  --redact: #0d0f12;
  --stamp: #b3302a;
  --mark: #f0dc6a;
  --form: "Public Sans", ui-sans-serif, system-ui, sans-serif;
  --type: "Courier Prime", "Courier New", ui-monospace, monospace;
  background: #16101a radial-gradient(70% 55% at 50% 0%, #2a2130 0%, #16101a 70%) no-repeat;
}

.stage { padding: clamp(12px, 3.5vh, 40px) 12px 64px; }

.sheet {
  position: relative; max-width: 700px; margin: 0 auto; padding: clamp(22px, 4vw, 40px) clamp(20px, 6vw, 60px) 26px;
  background: var(--paper); color: var(--ink); font-family: var(--form);
  border-radius: 3px;
  box-shadow: 0 1px 0 #fff inset, 0 0 0 1px var(--paper-edge), 0 2px 3px rgba(0, 0, 0, .25), 0 28px 60px -18px rgba(0, 0, 0, .65);
}
.sheet ::selection { background: var(--mark); color: var(--ink); }
.sheet :focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

/* Header: wordmark on the left, case number on the right */
.head { position: relative; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; padding-bottom: 18px; border-bottom: 3px solid var(--ink); }
.wordmark { margin: 0; font: 900 clamp(34px, 7vw, 48px)/.9 var(--form); letter-spacing: -.035em; }
.wordmark span { display: inline-block; margin-left: .04em; padding: 0 .12em .02em; background: var(--redact); color: var(--paper); }
.caseno { display: flex; gap: 22px; margin: 0; text-align: right; }
.caseno dt { font-size: 12px; font-weight: 600; color: var(--ink-faint); }
.caseno dd { margin: 2px 0 0; font: 700 17px/1.2 var(--type); }

.stamp {
  position: absolute; right: -2px; top: 4px; padding: 6px 14px 4px; border: 4px solid var(--stamp); border-radius: 6px;
  font: 900 30px/1 var(--form); letter-spacing: .06em; color: var(--stamp); text-transform: uppercase;
  transform: rotate(-9deg); opacity: 0; pointer-events: none; mix-blend-mode: multiply;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='70'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.2 1.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='70'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.2 1.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.stamp.on { opacity: .9; }
.stamp.hit { animation: stamp .42s cubic-bezier(.2, .9, .3, 1.2) both; }
.stamp.lost { color: var(--ink); border-color: var(--ink); }
@keyframes stamp { 0% { opacity: 0; transform: rotate(-4deg) scale(1.9); } 60% { opacity: .95; transform: rotate(-10deg) scale(.96); } 100% { opacity: .9; transform: rotate(-9deg) scale(1); } }

/* Form fields */
.fields { display: grid; grid-template-columns: 1fr auto; gap: 0 28px; margin: 0; padding: 14px 0 12px; border-bottom: 1px solid var(--rule); }
.fields dt { font-size: 12px; font-weight: 600; color: var(--ink-faint); }
.fields dd { margin: 3px 0 0; font-size: 17px; font-weight: 600; }
.fields div:last-child { text-align: right; }
.fields #progress { font: 700 17px var(--type); }

/* Clues: one typed line per row. Classified ones are covered by bars that follow the real word shapes. */
.clues { list-style: none; margin: 0; padding: 0; }
.clue { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 14px 0 13px; border-bottom: 1px solid var(--rule); }
.clue .n { font: 600 14px/1.9 var(--form); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.clue .t { font: 400 17.5px/1.62 var(--type); color: var(--ink); }
.clue.open .t { color: var(--ink-soft); }
.clue.latest .n, .clue.latest .t, .clue.lifting .t { color: var(--ink); }
/* Classified clues fold to their first line so the whole brief fits on one screen. */
.clue.redacted { padding: 12px 0 11px; }
.clue.redacted .t { display: block; max-height: 1.62em; overflow: hidden; }
.clue.redacted .t { user-select: none; }
.w { background: linear-gradient(var(--redact), var(--redact)) no-repeat 100% 58% / 100% 1.15em; }
.clue.redacted .w { color: transparent; }
.clue.lifting .w { animation: lift .36s cubic-bezier(.6, 0, .3, 1) both; animation-delay: calc(var(--i) * 28ms + 80ms); }
.clue.open .w { background: none; }
@keyframes lift { to { background-size: 0% 1.15em; } }

/* Identify */
.identify { margin-top: 26px; }
.identify label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field { position: relative; display: flex; gap: 12px; align-items: flex-end; margin-top: 6px; }
#guess-input {
  flex: 1; min-width: 0; height: 48px; padding: 0 2px; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; background: transparent;
  font: 400 22px var(--type); color: var(--ink); outline: none; caret-color: var(--stamp);
}
#guess-input::placeholder { color: #9aa3ab; font-size: 19px; }
#guess-input:focus { border-bottom-color: var(--stamp); }
.field.nope #guess-input { animation: nope .32s ease-in-out; }
@keyframes nope { 25%, 75% { transform: translateX(-5px); } 50% { transform: translateX(5px); } }
.submit {
  flex: none; height: 46px; padding: 0 22px; border: 0; border-radius: 3px; cursor: pointer;
  background: var(--ink); color: var(--paper); font: 700 15px var(--form); letter-spacing: .01em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 2px 0 #0a0e13;
  transition: transform .08s ease, box-shadow .08s ease, background-color .15s;
}
.submit:hover { background: #2a3544; }
.submit:active { transform: translateY(2px); box-shadow: 0 0 0 #0a0e13; }
.skip-line {
  margin-top: 14px; padding: 4px 0; border: 0; background: none; cursor: pointer;
  font: 500 14.5px var(--form); color: var(--ink-soft); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 4px; text-decoration-thickness: 2px;
}
.skip-line:hover { color: var(--ink); text-decoration-color: var(--ink); }

.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; margin: 0; padding: 4px 0; list-style: none; max-height: min(320px, 44vh); overflow: auto;
  background: #f6f7f3; border: 1px solid var(--rule); border-radius: 3px; box-shadow: 0 18px 40px -16px rgba(20, 28, 38, .45);
}
.suggest li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 14px; cursor: pointer; font-size: 16px; font-weight: 500; }
.suggest li small { color: var(--ink-faint); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.suggest li[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.suggest li[aria-selected="true"] small { color: #aeb8c2; }
.suggest li.used { text-decoration: line-through; opacity: .5; }
.suggest li b { font-weight: 800; }
.suggest li.none { color: var(--ink-faint); cursor: default; }

/* Attempts: struck through, with a margin note */
.attempts { list-style: none; margin: 22px 0 0; padding: 0; }
.attempts:empty { display: none; }
.attempts li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 7px 0; font-size: 16px; }
.attempts .who { position: relative; font: 400 18px var(--type); }
.attempts .who::after { content: ""; position: absolute; left: -3px; right: -3px; top: 55%; height: 2px; background: var(--stamp); transform-origin: 0 50%; transform: rotate(-2deg); }
.attempts li.fresh .who::after { animation: strike .35s cubic-bezier(.6, 0, .3, 1) .1s both; }
@keyframes strike { from { transform: rotate(-2deg) scaleX(0); } }
.attempts .skipped { font: italic 400 16px var(--form); color: var(--ink-faint); }
.attempts .note { font-size: 14px; color: var(--ink-soft); }
.attempts mark, .memo mark { background: linear-gradient(transparent 12%, var(--mark) 12%, var(--mark) 88%, transparent 88%); color: var(--ink); padding: 0 3px; }

/* Verdict */
.verdict { position: relative; margin-top: 26px; padding-top: 22px; border-top: 3px solid var(--ink); }
.verdict .verdict-line { max-width: calc(100% - 250px); }
.verdict-line { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.4; }
.verdict-line .ans { font: 700 24px var(--type); }
.blurb { margin: 12px 0 0; font-size: 16.5px; line-height: 1.6; color: var(--ink-soft); max-width: 58ch; }
.reading { margin-top: 16px; display: grid; gap: 2px; }
.reading p { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--ink-faint); }
.reading a { font-size: 16px; font-weight: 600; color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 4px; text-decoration-thickness: 2px; padding: 3px 0; }
.reading a:hover { text-decoration-color: var(--ink); }
.verdict-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 22px; }
.next { font-size: 14.5px; color: var(--ink-soft); }
.next b { font: 700 16px var(--type); color: var(--ink); }
.next a { color: var(--ink); font-weight: 600; }

.sheet-foot { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--rule); }
.sheet-foot button { padding: 4px 0; border: 0; background: none; cursor: pointer; font: 600 14px var(--form); color: var(--ink-soft); }
.sheet-foot button:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

.provenance { max-width: 560px; margin: 22px auto 0; text-align: center; font: 400 13.5px/1.55 var(--text); color: #8f8494; }
.provenance a { color: #c9bfcc; }

/* Dialogs are memos on the same paper */
dialog.memo {
  width: min(480px, calc(100vw - 24px)); padding: 0; border: 0; border-radius: 3px; background: var(--paper); color: var(--ink); font-family: var(--form);
  box-shadow: 0 0 0 1px var(--paper-edge), 0 30px 80px -20px rgba(0, 0, 0, .8);
}
dialog.memo[open] { animation: memo .22s ease-out; }
@keyframes memo { from { opacity: 0; transform: translateY(8px); } }
dialog.memo::backdrop { background: rgba(12, 8, 14, .6); }
.memo-in { padding: 28px 30px 26px; }
.memo h2 { margin: 0 0 12px; padding-bottom: 12px; border-bottom: 3px solid var(--ink); font: 800 24px/1.1 var(--form); letter-spacing: -.02em; }
.memo h3 { margin: 22px 0 8px; font-size: 14px; font-weight: 700; }
.memo p { margin: 12px 0; font-size: 16px; line-height: 1.55; color: var(--ink-soft); }
.memo .small { font-size: 13.5px; }
.rules { margin: 14px 0; padding-left: 22px; display: grid; gap: 10px; font-size: 16px; line-height: 1.5; }
.rules li::marker { font-weight: 700; }
.memo .submit { margin-top: 8px; }
.record { display: grid; grid-template-columns: repeat(4, 1fr); margin: 8px 0 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.record div { padding: 12px 0; }
.record dt { font-size: 12.5px; font-weight: 600; color: var(--ink-faint); }
.record dd { margin: 2px 0 0; font: 700 28px var(--type); }
.dist { display: grid; gap: 5px; }
.dist div { display: grid; grid-template-columns: 16px 1fr; gap: 10px; align-items: center; font: 700 14px var(--type); }
.dist span { display: block; width: var(--w); min-width: 22px; padding: 2px 6px; text-align: right; background: var(--rule); color: var(--ink); }
.dist div.hit span { background: var(--ink); color: var(--paper); }
.cases { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.cases a { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--ink); font-size: 15.5px; }
.cases a:hover { background: #dfe4dc; }
.cases .no { font: 700 16px var(--type); }
.cases .st { color: var(--ink-faint); font-size: 14px; }
.cases .st.won { color: #2f6b45; font-weight: 600; }
.cases .st.lost { color: var(--stamp); font-weight: 600; }
.cases .empty { padding: 14px 0; color: var(--ink-faint); }

.desk .toast { background: var(--ink); color: var(--paper); font-family: var(--form); border-radius: 3px; }

@media (max-width: 520px) {
  .head { flex-wrap: wrap; align-items: flex-start; }
  .stamp { top: -54px; right: 0; font-size: 22px; }
  .verdict .verdict-line, .verdict .blurb { max-width: none; }
  .caseno { gap: 16px; }
  .fields { grid-template-columns: 1fr; gap: 10px; }
  .fields div:last-child { text-align: left; }
  .clue { grid-template-columns: 22px 1fr; }
  .clue .t { font-size: 16px; }
  .submit { padding: 0 16px; }
  .record dd { font-size: 22px; }
}
.ans-inline { font: 700 18px var(--type); }
