/* Judge the AI, the daily game at /play. Built on the tokens and buttons in site.css. Phone first: the code pane
   runs edge to edge on a narrow screen so a line of code fits without scrolling sideways. */

:root {
  --console-bg: #1e2a36;
  --console-ink: #efede0;
  --console-dim: #a9b3bc;
  --console-bad: #ff9aa0;
  --right: #2f7340;
  --right-bg: #dcebd8;
  --partly: #7e6412;
  --partly-bg: #f3e6c4;
  --wrong: #be2a44;
  --wrong-bg: #f5dedb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --console-bg: #0c1117;
    --console-ink: #eceadf;
    --console-dim: #98a3ae;
    --console-bad: #f2767e;
    --right: #8fc98c;
    --right-bg: #1e3325;
    --partly: #ddbe6e;
    --partly-bg: #3a331e;
    --wrong: #f2767e;
    --wrong-bg: #3b2328;
  }
}

.play-head {
  padding-block: clamp(24px, 5vw, 56px) 16px;
}
.play-head h1 {
  font-size: clamp(36px, 7vw, 56px);
}
.play-section {
  padding-top: 8px;
}
.play {
  max-width: 640px;
  margin-inline: auto;
}
.play-screen > * + * {
  margin-top: 16px;
}
.play-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.play-row {
  margin-top: 20px;
}
.play h2:focus {
  outline: none;
}

/* Start */
.play-start {
  text-align: center;
}
.play-start .play-row {
  justify-content: center;
}
.play-seg {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.play-seg-btn {
  min-height: 44px;
  min-width: 128px;
  padding: 8px 18px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.play-seg-btn.on {
  background: var(--ink);
  color: var(--paper);
}
.play-streak {
  font-weight: 650;
  color: var(--gold-ink);
}

/* A round */
.play-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}
.play-count {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 13px;
}
.play-level {
  font-size: 13px;
  color: var(--ink);
}
.play-squares {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.play-sq {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 4px;
  background: var(--line);
}
.play-sq.g {
  background: var(--right);
}
.play-sq.y {
  background: var(--gold);
}
.play-sq.r {
  background: var(--wrong);
}
.play-title {
  font-size: clamp(26px, 5.4vw, 34px);
  font-weight: 700;
}
.play-task {
  color: var(--ink-2);
}
.play-prompt {
  font-weight: 650;
  font-size: 18px;
  margin-top: 20px;
}
.play-prompt + .play-row {
  margin-top: 12px;
}
.play-answer {
  flex: 1 1 140px;
  min-height: 56px;
  font-size: 18px;
  font-weight: 700;
  border-width: 2px;
  border-color: var(--ink);
}

/* The suggested change */
.play-pane {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ed-bg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.play-pane-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: var(--ed-title);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.play-pane-lang {
  color: var(--muted);
}
.play-lines {
  padding-block: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
}
.play-line {
  display: flex;
  align-items: baseline;
  width: 100%;
  margin: 0;
  padding: 1px 10px 1px 0;
  border: 0;
  border-left: 4px solid transparent;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
}
.play-line.del {
  background: var(--ed-del);
}
.play-line.del .play-code {
  color: var(--muted);
}
.play-line.add {
  background: var(--ed-add);
}
.play-num,
.play-mark {
  flex: none;
  color: var(--ed-line-num);
  user-select: none;
}
.play-num {
  width: 2em;
  padding-right: 0.4em;
  text-align: right;
}
.play-mark {
  width: 1.1em;
  font-weight: 700;
}
.play-line.del .play-mark {
  color: var(--wrong);
}
.play-line.add .play-mark {
  color: var(--right);
}
/* A line too long for the screen wraps, and play.js indents the part that wraps past the line's own indent. */
.play-code {
  flex: 1 1 auto;
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.picking .play-line {
  padding-block: 9px;
}
button.play-line {
  cursor: pointer;
}
button.play-line:hover,
button.play-line:focus-visible {
  border-left-color: var(--crimson);
  box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--crimson) 12%, transparent);
  outline: none;
}
.picking .play-line.del {
  opacity: 0.55;
}
.play-line.flaw {
  border-left-color: var(--wrong);
  background: var(--wrong-bg);
}
.play-line.picked:not(.flaw) {
  border-left-color: var(--gold-ink);
}
.play-tag {
  flex: none;
  margin-left: 14px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--gold-ink);
  color: var(--gold-ink);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}
.play-tag.flaw {
  border-color: var(--wrong);
  background: var(--wrong);
  color: var(--on-crimson);
}

/* The answer */
.play-verdict {
  display: flex;
  align-items: center;
  gap: 12px;
}
.play-quirki {
  flex: none;
}
.play-verdict .play-quirki {
  width: 72px;
  height: 72px;
}
.outcome-right .play-title {
  color: var(--right);
}
.outcome-partly .play-title {
  color: var(--partly);
}
.outcome-wrong .play-title {
  color: var(--wrong);
}
.play-why {
  font-size: 17px;
}
.play-runs {
  display: grid;
  gap: 10px;
}
@media (min-width: 620px) {
  .play-runs:has(.play-console + .play-console) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.play-console {
  border-radius: var(--radius);
  background: var(--console-bg);
  color: var(--console-ink);
  padding: 12px 14px 14px;
  min-width: 0;
}
.play-console-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--console-dim);
}
.play-console-out {
  margin: 6px 0 0;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
}
.play-console-out span {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.play-console-out .call {
  color: var(--console-dim);
}
.play-console-out .out {
  font-weight: 700;
}
.play-console-out .bad {
  color: var(--console-bad);
}

/* The score */
.play-summary-top {
  text-align: center;
}
.play-summary-top > * + * {
  margin-top: 10px;
}
.play-summary-top .play-quirki {
  width: 96px;
  height: 96px;
  margin-inline: auto;
}
.play-summary-top .play-row {
  justify-content: center;
}
.play-score {
  font-size: clamp(56px, 14vw, 88px);
  line-height: 1;
}
.play-summary-top .play-squares {
  justify-content: center;
  margin-left: 0;
}
.play-summary-top .play-sq {
  width: 34px;
  height: 34px;
  border-radius: 7px;
}
.play-score-line {
  font-size: 18px;
  color: var(--ink-2);
}
.play-status:empty {
  display: none;
}
.play-manual {
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 8px auto 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  resize: none;
}
.play-reviews {
  margin-top: 36px;
}
.play-reviews > * + * {
  margin-top: 10px;
}
.play-review {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.play-review summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 650;
  list-style: none;
}
.play-review summary::-webkit-details-marker {
  display: none;
}
.play-review summary::after {
  content: "+";
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--muted);
}
.play-review[open] summary::after {
  content: "-";
}
.play-review-level {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.play-review-body {
  padding: 0 14px 14px;
}
.play-review-body > * + * {
  margin-top: 12px;
}
.play-review-head {
  font-weight: 650;
}
.play-pitch {
  margin-top: 36px;
  border: 2px solid var(--crimson);
}
.play-send > * + * {
  margin-top: 10px;
}
@media (pointer: coarse) and (max-width: 820px) {
  .play-desk {
    display: none;
  }
}

/* About the game */
.play-about .grid {
  margin-top: 24px;
}
.play-about .note {
  margin-top: 24px;
  font-size: 15px;
}
@media (min-width: 960px) {
  .play-about .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* On a narrow screen the code runs to the screen's edges, in slightly smaller type. */
@media (max-width: 519px) {
  .play-pane {
    margin-inline: calc(-1 * var(--gutter));
    border-inline: 0;
    border-radius: 0;
  }
  .play-lines {
    font-size: 13px;
  }
  .play-num {
    width: 1.7em;
    padding-right: 0.3em;
  }
  .play-line {
    padding-right: 6px;
  }
  .play-console-out {
    font-size: 13px;
  }
  /* One thumb-wide button to move on. */
  .play-result .play-row .btn,
  .play-start .play-row .btn {
    flex: 1 1 100%;
  }
  .play-review .play-pane {
    margin-inline: -14px;
  }
}

/* A small phone: 44 characters of code fit across before a line wraps. */
@media (max-width: 419px) {
  .play-lines {
    font-size: 12px;
  }
}
