/* Coding Navigator layout. Tokens and shared components live in /site.css. */

main {
  max-width: 1720px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}
.heading {
  margin-bottom: 24px;
}
.heading h1 {
  margin: 0;
  font-size: clamp(30px, 3.4vw, 40px);
  font-weight: 750;
  letter-spacing: -0.02em;
}
.subtitle {
  max-width: 70ch;
  margin: 6px 0 0;
  color: var(--ink-2);
  font-size: 16px;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 0.9fr) minmax(380px, 1.7fr) minmax(250px, 0.7fr);
  gap: 20px;
  align-items: start;
}
/* Signed out: one card that asks the Member to sign in. */
.sign-in-gate {
  max-width: 560px;
  padding: 28px;
}
.sign-in-gate h2 {
  margin: 0 0 8px;
  font-size: 22px;
}
.sign-in-gate p {
  margin: 0 0 20px;
  color: var(--ink-2);
}
.sign-in-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.account {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-2);
}
.account form {
  margin: 0;
}
.account-name {
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.access-label {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-3);
  font-size: 12px;
  white-space: nowrap;
}
.access-label:empty {
  display: none;
}
/* Inactive Members: what is blocked, and the invite-code form (billing adds its own call to action). */
.access-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin: 0 0 20px;
  padding: 16px 20px;
  border-color: var(--line-strong);
}
.access-notice-copy {
  flex: 1 1 320px;
}
.access-notice h2 {
  margin: 0 0 4px;
  font-size: 17px;
}
.access-notice p {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
}
.access-notice-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.trial-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.redeem-form {
  display: flex;
  gap: 8px;
}
.redeem-form input {
  width: 16ch;
  min-width: 0;
}
.access-notice p.redeem-error {
  flex-basis: 100%;
  color: var(--bad);
}
.redeem-error:empty {
  display: none;
}
.account-sign-out {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.account-sign-out:hover {
  border-color: var(--ink-3);
}
@media (max-width: 680px) {
  .account-name {
    display: none;
  }
}
.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}
input[type="search"],
select,
textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 400;
  font-size: 15px;
}
input[type="search"]:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  outline: 3px solid var(--brand-soft);
  outline-offset: 0;
}
.btn-sm {
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
}
.btn-sm .icon {
  width: 16px;
  height: 16px;
}

/* Problem panel */
.entry-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 8px 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.entry-tab {
  min-width: 96px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: transparent;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 15px;
}
.entry-tab:hover {
  color: var(--ink);
}
.entry-tab.active {
  position: relative;
  top: 1px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--brand-ink);
}
.problem-body {
  padding: 20px;
}
.problem-body h2 {
  margin: 0 0 16px;
  font-size: 21px;
  font-weight: 700;
}
.catalog-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.catalog-filters label {
  margin: 0;
}
.search-field {
  grid-column: 1 / -1;
}
.catalog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 10px;
  color: var(--ink-3);
  font-size: 14px;
}
.catalog-results {
  max-height: 420px;
  overflow: auto;
  margin: 0 -20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.catalog-group h3 {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: 10px 20px 8px;
  background: var(--surface-2);
  color: var(--ink-2);
  font: 700 13px var(--font-body);
  letter-spacing: 0;
}
.problem-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 8px 20px;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  text-align: left;
  transition: background 0.12s;
}
.problem-choice:hover {
  background: var(--brand-soft);
}
.problem-choice-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.problem-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}
.difficulty {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.empty-state {
  padding: 14px 20px;
  color: var(--ink-3);
  font-size: 14px;
}
#problem-input {
  min-height: 300px;
  height: 38vh;
  margin-bottom: 14px;
  resize: vertical;
  font: 14px/1.7 var(--font-body);
}
.primary {
  width: 100%;
}
.helper {
  margin: 12px 0;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.6;
}
.ready-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.source-badge {
  color: var(--brand-ink);
  background: var(--brand-soft);
}
#problem-text {
  max-height: min(68vh, 760px);
  margin: 0 -20px 16px;
  padding: 0 20px;
  overflow: auto;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
#problem-text p {
  margin: 0 0 14px;
}
#problem-text h3 {
  margin: 22px 0 10px;
  font: 700 16px/1.3 var(--font-display);
  letter-spacing: 0;
}
#problem-text code {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--code-bg);
  font: 500 0.86em var(--font-mono);
  white-space: break-spaces;
}
#problem-text pre {
  margin: 0 0 14px;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  font: 13.5px/1.7 var(--font-mono);
}
#problem-text pre code {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  /* Wrap long example lines at spaces instead of hiding them off to the side. */
  white-space: pre-wrap;
}
#problem-text .io-label {
  color: var(--brand-ink);
  font-weight: 600;
}
#problem-text ul,
#problem-text ol {
  margin: 0 0 14px;
  padding-left: 22px;
}
#problem-text li {
  margin: 6px 0;
}
#problem-text li::marker {
  color: var(--ink-3);
}
#problem-text strong {
  font-weight: 650;
}
.problem-status {
  margin: 14px 0 0;
  color: var(--brand-ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}
.problem-status[role="alert"] {
  color: var(--bad);
}
.problem-status:empty {
  display: none;
}

/* Editor panel (dark workspace) */
.editor-panel {
  position: relative;
  border-color: var(--ws-line);
  background: var(--ws);
  box-shadow: var(--shadow-2);
}
.editor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  border-bottom: 1px solid var(--ws-line);
  background: var(--ws-2);
}
.filename-tab {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 18px;
  border-right: 1px solid var(--ws-line);
  background: var(--ws);
  box-shadow: inset 0 2px 0 var(--ws-brand);
  color: var(--ws-ink);
  font: 13px var(--font-mono);
}
.language-label {
  margin: 0 12px 0 6px;
}
.language-label select {
  min-height: 36px;
  margin: 0;
  padding: 4px 30px 4px 10px;
  border-color: var(--ws-line);
  background-color: var(--ws);
  color: var(--ws-ink);
  font-size: 14px;
}
#editor {
  height: 540px;
  min-width: 0;
  overflow: hidden;
}
.editor-gate {
  position: absolute;
  top: 49px;
  left: 0;
  right: 0;
  height: 540px;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgb(18 19 31 / 94%);
  color: var(--ws-ink);
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
}
.editor-panel:has(.editor-gate:not([hidden])) .language-label select {
  opacity: 0.5;
  pointer-events: none;
}
.editor-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 10px 16px;
  border-top: 1px solid var(--ws-line);
  background: var(--ws-2);
  color: var(--ws-ink-2);
  font: 12px var(--font-mono);
}
#save-state {
  margin-left: auto;
}
.save-retry {
  color: var(--ws-ink);
  font-size: 12px;
}
.problem-solved {
  color: var(--good);
  font-weight: 700;
}
.attempt-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.attempt-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.attempt-heading h3 {
  margin: 0 auto 0 0;
  font-size: 16px;
}
.attempt-section p {
  font-size: 13px;
}
.challenge-offer {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.challenge-offer p {
  margin: 0 0 8px;
  font-weight: 600;
}
.challenge-offer .text-button {
  margin-right: 12px;
}
.past-attempt {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.past-attempt summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.past-attempt pre {
  margin: 12px 0 0;
  padding: 12px;
  overflow-x: auto;
  border-radius: 6px;
  background: var(--ws);
  color: var(--ws-ink);
  font-size: 12px;
}
#editor-help {
  margin: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--ws-line);
  background: var(--ws-2);
  color: var(--ws-ink-2);
  font-size: 13px;
  line-height: 1.6;
}
#editor-help kbd {
  border-color: var(--ws-line);
  background: var(--ws-3);
  color: var(--ws-ink);
}

/* Run: the toolbar button and the test results under the editor */
.editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 8px;
}
.editor-actions .language-label {
  margin: 0;
}
.run-button {
  min-height: 36px;
  padding: 0 14px;
  font-size: 14px;
}
.run-button .icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
  stroke: none;
}
.run-panel {
  --run-good: #4ade80;
  --run-bad: #f87171;
  border-top: 1px solid var(--ws-line);
  background: var(--ws);
  color: var(--ws-ink);
}
.run-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  padding: 12px 16px;
}
.run-header h3 {
  margin: 0;
  font-size: 14px;
}
.run-status {
  margin: 0;
  color: var(--ws-ink-2);
  font-size: 14px;
}
.run-status[data-status="passed"],
.run-status[data-status="solved"] {
  color: var(--run-good);
  font-weight: 600;
}
.run-status[data-status="solved"] {
  font-size: 16px;
}
.run-status[data-status="failed"],
.run-status[data-status="error"],
.run-status[data-status="timeout"],
.run-status[data-status="unavailable"] {
  color: var(--run-bad);
  font-weight: 600;
}
.run-detail,
.run-case pre {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--ws-2);
  color: var(--ws-ink);
  font: 13px/1.5 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.run-detail {
  margin: 0 16px 12px;
}
.run-detail[data-kind="error"] {
  color: var(--run-bad);
}
.run-results {
  max-height: 360px;
  overflow: auto;
}
.run-results:empty {
  display: none;
}
.run-case {
  border-top: 1px solid var(--ws-line);
}
.run-case summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
.run-mark {
  font-size: 13px;
}
.run-case[data-passed="true"] .run-mark {
  color: var(--run-good);
}
.run-case[data-passed="false"] .run-mark {
  color: var(--run-bad);
}
.run-case dl {
  display: grid;
  grid-template-columns: minmax(70px, max-content) minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
  padding: 0 16px 14px;
}
.run-case dt {
  padding-top: 10px;
  color: var(--ws-ink-2);
  font-size: 13px;
}
.run-case dd {
  min-width: 0;
  margin: 0;
}
.run-case dd.run-error pre {
  color: var(--run-bad);
}

/* Direction panel */
.signal-panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.signal-header {
  margin: 0;
  color: var(--ink-2);
  font: 600 14px var(--font-body);
}
.meter-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
}
.meter {
  position: relative;
  height: 10px;
  margin: 0 2px;
  border-radius: 10px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
#meter-fill {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--cold), var(--meter-mid) 50%, var(--hot));
  clip-path: inset(0 100% 0 0);
  will-change: clip-path;
}
#meter-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 26px;
  border-radius: 3px;
  background: var(--ink);
  box-shadow: 0 0 0 2px var(--surface);
  transform: translate(-50%, -50%);
  will-change: left;
}
.proximity-header {
  margin: 0 0 8px;
  color: var(--ink-2);
  font: 600 13px var(--font-body);
}
/* No Proximity yet, or the latest Reading had none: hide the bar's position. */
.unmeasured #meter-fill,
.unmeasured #meter-marker {
  opacity: 0;
}
.approach-hint {
  margin: 14px 0 0;
  color: var(--ink-3);
  font-size: 13px;
}
#approach-name {
  color: var(--ink-2);
  font-weight: 600;
}
.unmeasured .direction {
  color: var(--ink-3);
  font-size: 20px;
}
.direction {
  margin: 18px 0 24px;
  font: 800 clamp(32px, 3.2vw, 44px) / 1.1 var(--font-display);
  letter-spacing: -0.02em;
}
.direction.flash {
  animation: direction-flash 900ms ease-out;
}
@keyframes direction-flash {
  0% { opacity: 0.2; transform: scale(0.96); }
  35% { opacity: 1; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .direction.flash { animation: none; }
}
.measured {
  margin: 14px 0 18px;
  color: var(--ink-3);
  font-size: 13px;
}
.live-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
}
.live-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
}
.live-state[data-state="inactive"] .live-dot,
.live-state[data-state="delayed"] .live-dot,
.live-state[data-state="unavailable"] .live-dot {
  background: var(--line-strong);
}
.live-state[data-state="analyzing"] .live-dot,
.live-state[data-state="updating"] .live-dot {
  background: var(--brand);
  animation: breathe 1.4s ease-in-out infinite;
}
@keyframes breathe {
  50% {
    opacity: 0.35;
  }
}
.feedback-error {
  margin: 10px 0 0;
  color: var(--bad);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.feedback-error:empty {
  display: none;
}
.signal-explanation {
  margin: 20px 0 4px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
}
.inspector {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 13px;
}
.inspector summary {
  min-height: 36px;
  color: var(--ink-2);
  font-weight: 600;
  line-height: 36px;
}
.inspector dt {
  margin-top: 10px;
  color: var(--ink);
  font-weight: 600;
}
.inspector dd {
  margin: 2px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.inspector pre {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (min-width: 1500px) {
  #editor,
  .editor-gate {
    height: 620px;
  }
}
@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: minmax(280px, 0.8fr) minmax(340px, 1.3fr);
  }
  .problem-panel {
    grid-row: span 2;
  }
  .signal-panel {
    grid-column: 2;
  }
}
@media(max-width:680px) {
  main {
    padding: 20px 16px 40px;
  }
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .problem-panel {
    grid-row: auto;
  }
  .signal-panel {
    grid-column: auto;
  }
  .catalog-filters {
    grid-template-columns: 1fr;
  }
  .search-field {
    grid-column: auto;
  }
  .catalog-results {
    max-height: 340px;
  }
  .problem-choice {
    min-height: 52px;
  }
  .entry-tab {
    flex: 1;
  }
  .ready-heading {
    flex-direction: column;
    align-items: flex-start;
  }
  #editor,
  .editor-gate {
    height: 380px;
  }
  #problem-input {
    height: 240px;
    min-height: 180px;
    font-size: 16px;
  }
  #problem-text {
    max-height: 300px;
  }
  .cm-content {
    font-size: 16px;
  }
  .editor-bottom {
    gap: 10px;
  }
}

/* Feedback tab and dialog */
.feedback-tab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--brand-ink);
  box-shadow: var(--shadow-2);
  font-weight: 600;
  font-size: 14px;
}
.feedback-tab[hidden] {
  display: none;
}
.feedback-tab:hover {
  border-color: var(--brand);
}
#feedback-dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 20px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-2);
}
#feedback-dialog::backdrop {
  background: rgb(14 15 22 / 55%);
}
.feedback-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.feedback-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
}
.feedback-close {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-2);
  font-size: 26px;
  line-height: 1;
}
.feedback-kinds {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0 16px;
  padding: 0;
  border: 0;
}
.feedback-kinds legend {
  margin-bottom: 8px;
  padding: 0;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}
.feedback-kind {
  position: relative;
  margin: 0;
}
.feedback-kind input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.feedback-kind span {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}
.feedback-kind input:checked + span {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-ink);
}
.feedback-kind input:focus-visible + span {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}
#feedback-message {
  min-height: 120px;
  resize: vertical;
}
.feedback-status {
  min-height: 20px;
  margin: 8px 0 0;
  font-size: 14px;
}
.feedback-status[data-state="error"] {
  color: var(--bad);
}
.feedback-status[data-state="ok"] {
  color: var(--ink-2);
}
.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
@media (max-width: 680px) {
  .feedback-tab {
    right: 12px;
    bottom: 12px;
  }
  #feedback-message {
    font-size: 16px;
  }
}
