/* Exam Summit: a poster. Ice white, slate shapes, one orange. Hard edges, no shadows, no gradients. */

:root {
  --es-line: 2px;
  --es-heavy: 3px;
  --es-gut-l: 30px;
  --es-gut-r: 36px;
  --es-rail: 6px;
  --es-h-next: 78px;
  --es-h-rung: 48px;
  --es-pale: color-mix(in srgb, var(--ak-outline) 55%, var(--ak-bg));
  --es-ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

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

html,
body {
  margin: 0;
  height: 100%;
}

body {
  overflow: hidden;
  background-color: var(--ak-bg);
  background-image: var(--ak-backdrop-layer, none);
  background-size: cover;
  background-position: center top;
  color: var(--ak-ink);
  font-family: var(--ak-font-body);
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 3px solid var(--ak-focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

/* ---------- the frame ---------- */

.app {
  position: fixed;
  inset: 0;
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 30fr) minmax(0, 70fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto auto auto;
  grid-template-areas:
    "top top"
    "poster climb"
    "guide guide"
    "msg msg"
    "tools tools"
    "saved saved";
  gap: 8px 10px;
  padding: calc(var(--ac-status-h, 64px) + 8px) max(12px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  touch-action: manipulation;
}

.app.is-loading > * {
  visibility: hidden;
}

/* ---------- top edge: logo, tabs, summits ---------- */

.top {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.logo {
  flex: none;
  width: auto;
  height: 34px;
}

.tabs {
  flex: 1 1 auto;
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: none;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  max-width: 11em;
  min-height: 48px;
  padding: 0 12px;
  border: var(--es-line) solid var(--ak-ink);
  border-radius: 0;
  background: var(--ak-choice-bg);
  color: var(--ak-choice-ink);
  line-height: 44px;
}

.tab[aria-selected="true"] {
  border-color: var(--ak-choice-selected-border);
  background: var(--ak-choice-selected-bg);
  color: var(--ak-choice-selected-ink);
  box-shadow: inset 0 -5px 0 var(--ak-accent);
}

.tab-name {
  overflow: hidden;
  font-family: var(--ak-font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.tab-count {
  font-family: var(--ak-font-display);
  font-size: 13px;
  font-weight: 500;
}

.shelf-open {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 48px;
  min-height: 48px;
  padding: 0 10px;
  border: var(--es-line) solid var(--ak-ink);
  border-radius: 0;
  background: var(--ak-surface);
  font-family: var(--ak-font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.shelf-open svg {
  width: 22px;
  height: 22px;
}

/* ---------- the poster number ---------- */

.poster {
  grid-area: poster;
  container-type: size;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
  padding-top: 4px;
  overflow: hidden;
}

.big {
  margin: 0;
  flex: none;
  font-family: var(--ak-font-display);
  font-weight: 700;
  font-size: min(30dvh, calc(100cqw / (var(--digits, 1) * 0.6)), 48cqh);
  font-variant-numeric: tabular-nums;
  line-height: 0.82;
  letter-spacing: -0.04em;
  color: var(--ak-ink);
}

.big.is-late {
  color: var(--ak-link);
}

.big-label {
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: var(--es-heavy) solid var(--ak-ink);
  font-family: var(--ak-font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* The on-time count: a stat block, the mark this climb is making against the best summit. */
.record {
  margin: 10px 0 0;
  padding: 6px 0 0;
  border-top: var(--es-line) solid var(--ak-ink);
}

.record-now {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 6px;
  margin: 0;
}

.record-num {
  font-family: var(--ak-font-display);
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.record-label {
  font-family: var(--ak-font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.record-streak {
  margin: 4px 0 0;
  font-family: var(--ak-font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.record-streak.is-live {
  box-shadow: inset 4px 0 0 var(--ak-accent);
  padding-left: 8px;
}

.record-best {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.3;
  color: var(--ak-ink-muted);
}

.record-best.is-ahead {
  color: var(--ak-ink);
  font-weight: 600;
}

/* The guide's own row under the ladder: it points up at the orange step and covers nothing. */
.play-guide {
  grid-area: guide;
  position: relative;
  margin: 0;
  padding: 10px 12px 10px 40px;
  background: var(--ak-ink);
  color: var(--ak-surface);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.play-guide::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 18px;
  background: var(--ak-accent);
  clip-path: polygon(50% 0, 100% 55%, 68% 55%, 68% 100%, 32% 100%, 32% 55%, 0 55%);
  transform: translateY(-50%);
}

.play-guide:empty {
  height: 0;
  margin-top: -8px;
  padding: 0;
  overflow: hidden;
}

/* A step ahead is locked until the ones under it are climbed. */
.rung-lock {
  flex: none;
  width: 14px;
  height: 16px;
  color: var(--ak-ink-muted);
}

.rung-lock svg {
  display: block;
  width: 100%;
  height: 100%;
  stroke-width: 2.5;
}

.is-blocked .rung-when {
  padding: 2px 6px;
  background: var(--ak-ink);
  color: var(--ak-surface);
}

.is-blocked .rung-lock {
  color: var(--ak-ink);
}

.rung-item.is-pointed::after {
  content: "";
  position: absolute;
  inset: -6px -2px;
  border: 4px solid var(--ak-ink);
  pointer-events: none;
}

/* The toast's own row: the ladder gives it room rather than sitting under it. */
.msg-slot {
  grid-area: msg;
  height: var(--es-msg-h, 0px);
  margin-top: -8px;
}

html.es-msg .msg-slot {
  margin-top: 0;
}

html.es-msg #activity-chrome-toast {
  top: var(--es-msg-top);
  left: var(--es-msg-left);
  width: var(--es-msg-w);
  max-width: none;
  translate: none;
  font-size: 16px;
  line-height: 1.25;
}

/* Short of room, the ladder folds its peak picture away before its rungs shrink. */
.climb.is-tight .peak-img {
  display: none;
}

.climb.is-tight .peak {
  padding-left: var(--es-gut-l);
}

.climb.is-squeezed .peak {
  display: none;
}

.climb.is-tight .ladder {
  overflow: hidden;
}

.climb.is-tight .exam-name {
  font-size: 18px;
  -webkit-line-clamp: 1;
}

.exam-line,
.crowd-line {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ak-ink-muted);
}

.crowd-line {
  padding: 6px 8px;
  border-left: 5px solid var(--ak-accent);
  background: var(--ak-surface);
  color: var(--ak-ink);
}

/* ---------- the ladder ---------- */

.climb {
  grid-area: climb;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* One big flat mountain plane behind the ladder: part of the picture, not a piece. */
.climb::before {
  content: "";
  position: absolute;
  inset: 4% -4% 0 -4%;
  z-index: -1;
  background: var(--es-pale);
  clip-path: polygon(50% 0, 64% 22%, 72% 18%, 100% 100%, 0 100%, 26% 30%, 34% 34%);
}

.peak {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding-left: calc(var(--es-gut-l) - 8px);
}

.peak-img {
  flex: none;
  width: auto;
  height: clamp(44px, 9dvh, 80px);
}

.peak-text {
  min-width: 0;
  padding-bottom: 4px;
}

.exam-name {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-family: var(--ak-font-display);
  font-size: clamp(20px, 3.2dvh, 28px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.exam-date {
  margin: 2px 0 0;
  font-family: var(--ak-font-display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ak-ink-muted);
  text-transform: uppercase;
}

.ladder {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 2px;
}

.rail {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--es-rail);
  background: var(--ak-ink);
}

.rail-left {
  left: var(--es-gut-l);
}

.rail-right {
  right: var(--es-gut-r);
}

.rope {
  position: absolute;
  left: calc(var(--es-gut-l) - 6px);
  bottom: 0;
  width: 5px;
  height: var(--rope, 0px);
  background: var(--ak-accent);
}

.rope-ahead {
  position: absolute;
  top: 0;
  bottom: var(--rope, 0px);
  left: calc(var(--es-gut-l) - 5px);
  border-left: 2px dashed var(--ak-accent);
}

.rope-count {
  position: absolute;
  left: 0;
  bottom: calc(var(--rope, 0px) + 4px);
  width: calc(var(--es-gut-l) - 8px);
  font-family: var(--ak-font-display);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  text-align: right;
}

.rungs {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rung-item {
  position: absolute;
  left: calc(var(--es-gut-l) + var(--es-rail) - 2px);
  right: calc(var(--es-gut-r) + var(--es-rail) - 2px);
  height: var(--es-h-rung);
}

.rung-item.is-next {
  left: calc(var(--es-gut-l) - 12px);
  right: calc(var(--es-gut-r) - 10px);
  height: var(--es-h-next);
  z-index: 2;
}

.rung {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--ak-ink);
  text-align: left;
}

/* The next rung: the painted orange bar with chevron ends, the biggest target on screen. */
.is-next .rung {
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 4px 28px;
  background: url("./art/rung-next.png") center top / 100% 107% no-repeat;
  text-align: center;
}

.is-next .rung-words {
  display: -webkit-box;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.15;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.is-next .rung-when {
  font-family: var(--ak-font-display);
  font-size: 13px;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* A rung ahead: the painted hollow bar. */
.is-ahead .rung {
  justify-content: space-between;
  gap: 8px;
  padding: 0 14px;
  background: url("./art/rung-ahead.png") center / 100% 100% no-repeat;
}

.is-ahead .rung-words {
  display: -webkit-box;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.12;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.is-ahead .rung-when {
  flex: none;
  font-family: var(--ak-font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ak-ink-muted);
  text-transform: uppercase;
}

.is-blank .rung-words {
  font-style: italic;
  color: var(--ak-ink-muted);
}

.is-next.is-blank .rung-words {
  color: var(--ak-ink);
}

/* A climbed rung: a slate crossbar, the painted notched tick, and its date stamp pressed in. */
.is-done .rung {
  gap: 8px;
  padding: 0;
}

.is-done .rung::before {
  content: "";
  position: absolute;
  left: -4px;
  right: -4px;
  top: 50%;
  height: 8px;
  background: var(--ak-ink);
  transform: translateY(-50%);
}

.rung-badge {
  position: relative;
  flex: none;
  width: calc(var(--es-h-rung) * 2.12);
  height: 100%;
  background: url("./art/rung-done.png") left center / contain no-repeat;
}

.rung-stamp {
  position: relative;
  padding: 2px 8px;
  border: var(--es-line) solid var(--ak-ink);
  background: var(--ak-bg);
  font-family: var(--ak-font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}

.is-done.can-undo .rung-stamp {
  border-color: var(--ak-accent);
}

.gap {
  position: absolute;
  right: 0;
  width: calc(var(--es-gut-r) - 6px);
  font-family: var(--ak-font-display);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  color: var(--ak-ink);
  text-align: right;
  transform: translateY(50%);
  white-space: nowrap;
}

.gap.is-tight {
  color: var(--ak-link);
}

/* ---------- a new exam ---------- */

.new-exam {
  grid-row: 2;
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 14px;
  overflow-y: auto;
  border: var(--es-heavy) solid var(--ak-ink);
  background: var(--ak-surface);
}

.app.is-new .poster,
.app.is-new .climb {
  display: none;
}

.new-title {
  margin: 0;
  font-family: var(--ak-font-display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.new-when,
.new-pick {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.new-guide {
  margin: 0;
  padding: 10px 12px;
  background: var(--ak-ink);
  color: var(--ak-surface);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
}

.quick-dates {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.quick {
  min-height: 48px;
  padding: 0 4px;
  border: var(--es-line) solid var(--ak-ink);
  border-radius: 0;
  background: var(--ak-choice-bg);
  color: var(--ak-choice-ink);
  font-family: var(--ak-font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.quick[aria-pressed="true"] {
  border-color: var(--ak-choice-selected-border);
  background: var(--ak-choice-selected-bg);
  color: var(--ak-choice-selected-ink);
  box-shadow: inset 0 -5px 0 var(--ak-accent);
}

.new-chosen {
  margin: 0;
  font-family: var(--ak-font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--ak-ink-muted);
  text-transform: uppercase;
}

.new-chosen.is-set {
  color: var(--ak-ink);
}

.new-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field-label {
  font-family: var(--ak-font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ak-ink);
  text-transform: uppercase;
}

.field-need {
  margin-left: 4px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--ak-ink-muted);
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: var(--es-line) solid var(--ak-ink);
  border-radius: 0;
  background: var(--ak-surface);
  font-size: 17px;
}

.field input[aria-invalid="true"] {
  border-color: var(--ak-accent);
  box-shadow: inset 0 0 0 2px var(--ak-accent);
}

.new-error,
.edit-error {
  margin: 0;
  padding: 8px 10px;
  border-left: 5px solid var(--ak-accent);
  background: var(--ak-bg);
  font-size: 16px;
  font-weight: 600;
}

.new-sub {
  margin: 4px 0 0;
  font-family: var(--ak-font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.plans {
  display: grid;
  gap: 8px;
}

/* The plans read as a list of routes up, each marked by its own flat shape, not a stack of boxes. */
.plans {
  gap: 0;
  border-top: var(--es-heavy) solid var(--ak-ink);
}

.plan {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 2px 14px;
  min-height: 64px;
  padding: 10px 4px;
  border: 0;
  border-bottom: var(--es-line) solid var(--ak-ink);
  border-radius: 0;
  background: transparent;
  color: var(--ak-choice-ink);
  text-align: left;
}

.plan-mark {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--ak-ink);
  color: var(--ak-surface);
}

.plan-mark svg {
  width: 24px;
  height: 24px;
}

.plan-driving .plan-mark {
  background: var(--ak-accent);
  color: var(--ak-ink);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.plan-driving .plan-mark svg {
  margin-top: 12px;
  width: 18px;
  height: 18px;
}

.plan-language .plan-mark {
  border-radius: 50%;
}

.plan-own .plan-mark {
  border: var(--es-line) dashed var(--ak-ink);
  background: transparent;
  color: var(--ak-ink);
}

/* Where the steps land: the ladder on its side, marks spaced by date. */
.new-strip {
  padding: 6px 0 0;
}

.strip-line {
  position: relative;
  height: 26px;
  margin: 0 13px;
}

.strip-line::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  background: var(--ak-ink);
  transform: translateY(-50%);
}

.strip-mark {
  position: absolute;
  top: 0;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: var(--es-line) solid var(--ak-ink);
  background: var(--ak-surface);
  font-family: var(--ak-font-display);
  font-size: 14px;
  font-weight: 700;
  transform: translateX(-50%);
}

.strip-mark.is-exam {
  border-color: var(--ak-accent);
  background: var(--ak-accent);
  color: var(--ak-ink);
}

.strip-dates {
  margin: 6px 0 0;
  font-family: var(--ak-font-display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ak-ink-muted);
  text-transform: uppercase;
}

.plan-name {
  font-family: var(--ak-font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.plan-steps {
  font-size: 14px;
  line-height: 1.3;
  color: var(--ak-ink-muted);
}

.plan-own {
  border-bottom-style: dashed;
}

.new-cancel {
  align-self: flex-start;
  min-height: 48px;
  padding: 0 14px;
  border: var(--es-line) solid var(--ak-ink);
  border-radius: 0;
  background: var(--ak-surface);
  font-weight: 600;
}

/* ---------- bottom edge: the tools ---------- */

.tools {
  grid-area: tools;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 6px;
}

.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 8px;
  border: var(--es-line) solid var(--ak-choice-selected-border);
  border-radius: 0;
  background: var(--ak-choice-selected-bg);
  color: var(--ak-choice-selected-ink);
  font-family: var(--ak-font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tool svg {
  flex: none;
  width: 22px;
  height: 22px;
}

.tool-done,
.tool-hint {
  border-color: var(--ak-ink);
  background: var(--ak-choice-bg);
  color: var(--ak-choice-ink);
}

/* Done answers at once: the button reads Saved while the ending comes up. */
.tool-done.is-saved {
  border-color: var(--ak-choice-selected-border);
  background: var(--ak-choice-selected-bg);
  color: var(--ak-choice-selected-ink);
}

.tool:disabled {
  opacity: 0.45;
}

.saved-line {
  grid-area: saved;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 20px;
  margin: 0;
  font-size: 13px;
  color: var(--ak-ink-muted);
}

.saved-line.is-error {
  color: var(--ak-ink);
  font-weight: 600;
}

.saved-mark {
  width: 14px;
  height: 14px;
  opacity: 0;
  background: var(--ak-ink-muted);
  clip-path: polygon(14% 50%, 0 64%, 38% 100%, 100% 22%, 86% 8%, 38% 72%);
}

.saved-mark.is-on {
  opacity: 1;
}

/* ---------- sheets ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: color-mix(in srgb, var(--ak-ink) 40%, transparent);
}

.confirm-sheet {
  z-index: 60;
  align-items: center;
  padding: 16px;
}

.sheet-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(100%, 600px);
  max-height: calc(100dvh - var(--ac-status-h, 0px) - 8px);
  padding: 14px max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  overflow-y: auto;
  border-top: 6px solid var(--ak-accent);
  background: var(--ak-surface);
  color: var(--ak-ink);
}

.confirm-panel {
  width: min(100%, 420px);
  border: var(--es-heavy) solid var(--ak-ink);
  border-top-width: 6px;
  border-top-color: var(--ak-accent);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sheet-title {
  margin: 0;
  font-family: var(--ak-font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sheet-x {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: var(--es-line) solid var(--ak-ink);
  border-radius: 0;
  background: var(--ak-surface);
}

.sheet-x svg {
  width: 22px;
  height: 22px;
}

.step-pick {
  display: grid;
  grid-template-columns: repeat(5, minmax(48px, 1fr));
  gap: 6px;
}

.pick {
  min-height: 48px;
  border: var(--es-line) solid var(--ak-ink);
  border-radius: 0;
  background: var(--ak-choice-bg);
  color: var(--ak-choice-ink);
  font-family: var(--ak-font-display);
  font-size: 20px;
  font-weight: 700;
}

.pick.is-climbed {
  border-style: solid;
  background: var(--ak-bg);
}

.pick[aria-selected="true"] {
  background: var(--ak-choice-selected-bg);
  color: var(--ak-choice-selected-ink);
  box-shadow: inset 0 -5px 0 var(--ak-accent);
}

.edit-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.edit-bounds {
  margin: -4px 0 0;
  font-size: 13px;
  color: var(--ak-ink-muted);
}

.ideas-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ideas-title {
  margin: 0;
  font-family: var(--ak-font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ideas-more {
  min-height: 44px;
  padding: 0 12px;
  border: var(--es-line) solid var(--ak-ink);
  border-radius: 0;
  background: var(--ak-surface);
  font-weight: 600;
}

.ideas-list {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.idea {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 48px;
  padding: 6px 10px;
  border: var(--es-line) solid var(--ak-choice-border);
  border-radius: 0;
  background: var(--ak-choice-bg);
  color: var(--ak-choice-ink);
  text-align: left;
}

.idea[aria-pressed="true"] {
  border-color: var(--ak-choice-selected-border);
  background: var(--ak-choice-selected-bg);
  color: var(--ak-choice-selected-ink);
}

.idea-words {
  font-size: 15px;
  font-weight: 600;
}

.idea-clue {
  font-size: 13px;
  opacity: 0.85;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.act {
  flex: 1 1 auto;
  min-height: 52px;
  padding: 0 16px;
  border: var(--es-line) solid var(--ak-ink);
  border-radius: 0;
  background: var(--ak-surface);
  font-family: var(--ak-font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.act-save,
.act-yes {
  border-color: var(--ak-btn-fill);
  background: var(--ak-btn-fill);
  color: var(--ak-btn-ink);
}

.confirm-text {
  margin: 0;
  font-size: 17px;
  line-height: 1.4;
}

/* ---------- the guide ---------- */

.coach {
  position: fixed;
  inset: 0;
  z-index: 33;
  pointer-events: none;
}

.coach-ring {
  position: absolute;
  border: 4px solid var(--ak-accent);
}

.coach-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border: 12px solid transparent;
}

.coach-arrow.is-up {
  border-top-width: 0;
  border-bottom: 14px solid var(--ak-ink);
}

.coach-arrow.is-down {
  border-bottom-width: 0;
  border-top: 14px solid var(--ak-ink);
}

.coach-text {
  position: absolute;
  max-width: min(340px, calc(100vw - 24px));
  margin: 0;
  padding: 12px 14px;
  background: var(--ak-ink);
  color: var(--ak-surface);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
}

/* The toast sits over the tabs: a tap goes through to what is under it, and still clears it. */
#activity-chrome-toast {
  pointer-events: none;
}

/* ---------- the summit, on the play screen ---------- */

.summit-poster {
  position: fixed;
  inset: 0;
  z-index: 31;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  background: var(--ak-bg);
  text-align: center;
}

.summit-peak {
  width: auto;
  height: min(40dvh, 60vw);
}

.summit-word {
  margin: 0;
  font-family: var(--ak-font-display);
  font-size: min(22dvh, 26vw);
  font-weight: 700;
  line-height: 0.85;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.summit-name {
  margin: 0;
  font-family: var(--ak-font-display);
  font-size: clamp(22px, 5vw, 40px);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* The summit ending reads as a poster: the peak, the name, five dates in heavy numerals. */
html.es-poster #activity-chrome-ending {
  background: var(--ak-bg);
}

html.es-poster #activity-chrome-ending .ac-card {
  width: min(100%, 760px);
  border: 0;
  background: transparent;
}

html.es-poster #activity-chrome-ending .ac-work {
  order: -1;
  max-width: min(130px, 17dvh);
  border: 0;
}

html.es-poster #activity-chrome-ending .ac-lines {
  grid-template-columns: 1fr;
  gap: 0;
}

html.es-poster #activity-chrome-ending .ac-line {
  border: 0;
  border-top: var(--es-line) solid var(--ak-ink);
  padding: 6px 0;
}

html.es-poster #activity-chrome-ending .ac-line:nth-child(2) {
  font-weight: 800;
  color: var(--ak-ink);
}

/* Lines 3 to 7 are the five climb dates, set as the poster's heavy numerals. */
html.es-poster #activity-chrome-ending .ac-line:nth-child(n + 3):nth-child(-n + 7) {
  font-family: var(--ak-font-display);
  font-size: clamp(20px, 4dvh, 36px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ---------- the Summits shelf on the start screen ---------- */

#activity-start .es-shelf {
  grid-column: 1 / -1;
  width: 100%;
  margin: 8px 0;
  padding: 12px;
  border: var(--es-line) solid var(--ak-ink);
  background: var(--ak-surface);
  color: var(--ak-ink);
  text-align: left;
}

#activity-start .es-shelf-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-family: var(--ak-font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#activity-start .es-shelf-title img {
  width: auto;
  height: 26px;
}

#activity-start .es-shelf-empty {
  margin: 0;
  font-size: 15px;
  color: var(--ak-ink-muted);
}

#activity-start .es-shelf-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#activity-start .es-summit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 0 6px 10px;
  border-left: 6px solid var(--ak-accent);
  background: var(--ak-bg);
}

#activity-start .es-summit-name {
  margin: 0;
  font-family: var(--ak-font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

#activity-start .es-summit-dates {
  margin: 2px 0 0;
  font-family: var(--ak-font-display);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

#activity-start .es-summit-undo {
  min-width: 64px;
  min-height: 48px;
  padding: 0 12px;
  border: var(--es-line) solid var(--ak-ink);
  border-radius: 0;
  background: var(--ak-surface);
  color: var(--ak-ink);
  font-family: var(--ak-font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#activity-start .es-shelf-note {
  margin: 0 0 6px;
  padding: 6px 8px;
  border-left: 5px solid var(--ak-accent);
  background: var(--ak-bg);
  font-size: 15px;
  font-weight: 600;
}

#activity-start .es-summit-del {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: var(--es-line) solid var(--ak-ink);
  border-radius: 0;
  background: var(--ak-surface);
  color: var(--ak-ink);
}

#activity-start .es-summit-del svg {
  width: 22px;
  height: 22px;
}

/* ---------- sideways: the ladder on one side, the poster and tools on the other ---------- */

@media (orientation: landscape) {
  :root {
    --es-h-next: 62px;
    --es-h-rung: 44px;
  }

  .app {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto auto auto;
    grid-template-areas:
      "climb top"
      "climb poster"
      "climb guide"
      "climb msg"
      "climb tools"
      "climb saved";
    column-gap: 18px;
  }

  /* While the guide shows, it sits over the ladder on the left, so the big number keeps its room. */
  .app.has-guide {
    grid-template-areas:
      "guide top"
      "climb poster"
      "climb msg"
      "climb tools"
      "climb saved";
  }

  .app.has-guide .play-guide::before {
    transform: translateY(-50%) rotate(180deg);
  }

  /* A new exam takes both sides: the date down the left, the plans on the right under the tabs. */
  .app.is-new {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    grid-template-areas:
      "when top"
      "when pick"
      "when guide"
      "when msg"
      "when tools"
      "saved saved";
  }

  .new-exam {
    display: contents;
  }

  .new-when,
  .new-pick {
    min-height: 0;
    padding: 10px 12px;
    overflow-y: auto;
    border: var(--es-heavy) solid var(--ak-ink);
    background: var(--ak-surface);
  }

  .new-when {
    grid-area: when;
  }

  .new-pick {
    grid-area: pick;
  }

  .plans {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 12px;
  }

  .plan {
    align-content: center;
  }

  .peak-img {
    height: clamp(36px, 10dvh, 80px);
  }

  /* Sideways the big number stands beside its stats, so both keep their height. */
  .poster {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-content: start;
    column-gap: 14px;
  }

  .big {
    grid-row: 1 / span 4;
    font-size: min(30dvh, calc(45cqw / (var(--digits, 1) * 0.6)), 82cqh);
  }

  .big-label,
  .record,
  .exam-line,
  .crowd-line {
    grid-column: 2;
  }

  .big-label {
    margin-top: 0;
    padding-top: 6px;
    font-size: 16px;
  }

  .record {
    margin-top: 6px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .logo {
    height: 28px;
  }

  .tool {
    min-height: 48px;
  }

  .tool span {
    font-size: 15px;
  }

  .exam-line {
    display: none;
  }

  .new-title {
    display: none;
  }

  .new-when,
  .new-pick {
    gap: 5px;
  }

  .new-cancel {
    min-height: 44px;
  }

  .new-guide {
    padding: 8px 10px;
  }

  .new-sub {
    display: none;
  }

  .new-when,
  .new-pick {
    padding: 6px 8px;
    border-width: var(--es-line);
  }

  .plan {
    min-height: 48px;
    gap: 1px 8px;
    padding: 5px 2px;
  }

  .plan-mark {
    width: 30px;
    height: 30px;
  }

  .plan-mark svg {
    width: 17px;
    height: 17px;
  }

  .plan-driving .plan-mark svg {
    margin-top: 9px;
    width: 12px;
    height: 12px;
  }

  .strip-dates {
    display: none;
  }

  .field-label {
    font-size: 15px;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }

  .field-need {
    margin-left: 2px;
    font-size: 11px;
    letter-spacing: 0.02em;
  }

  .new-guide {
    line-height: 1.25;
  }

  .new-strip {
    padding-top: 2px;
  }

  .quick {
    font-size: 14px;
  }

  .plan-name {
    font-size: 15px;
    line-height: 1.15;
    letter-spacing: 0;
  }

  .plan-steps {
    font-size: 12px;
    line-height: 1.25;
  }

  .new-chosen {
    font-size: 15px;
  }

  .new-chosen:not(.is-set) {
    display: none;
  }
}

@media (orientation: portrait) and (max-height: 720px) {
  html.es-msg #activity-chrome-toast {
    padding: 6px 10px;
    font-size: 14px;
    letter-spacing: 0.02em;
  }

  .tool {
    min-height: 48px;
  }

  .ladder {
    overflow: hidden;
  }
}

@media (max-width: 420px) {
  /* The status bar's meter keeps its bar and drops its words on a narrow phone: one row less. */
  #activity-chrome-status .ac-meter-name {
    display: none;
  }
}

@media (max-width: 380px) {
  :root {
    --es-gut-l: 26px;
    --es-gut-r: 30px;
  }

  .is-next .rung {
    padding: 2px 22px;
  }

  .is-next .rung-words {
    font-size: 14px;
  }

  .is-next .rung-when {
    font-size: 12px;
  }

  .is-ahead .rung {
    padding: 0 10px;
  }

  .big-label {
    font-size: 15px;
  }

  .tool {
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
  }

  .shelf-open span {
    display: none;
  }
}

/* ---------- motion: slow and flat, never a bounce ---------- */

@media (prefers-reduced-motion: no-preference) {
  :root:not(.ac-still) .rope {
    transition: height 1100ms var(--es-ease);
  }

  :root:not(.ac-still) .rope-ahead {
    transition: bottom 1100ms var(--es-ease);
  }

  :root:not(.ac-still) .rope-count {
    transition: bottom 1100ms var(--es-ease);
  }

  :root:not(.ac-still) .rung-item {
    transition: bottom 600ms var(--es-ease);
  }

  :root:not(.ac-still) .rung-item.just-done .rung-badge {
    animation: es-slide-down 700ms var(--es-ease) both;
  }

  :root:not(.ac-still) .rung-item.just-done .rung-stamp {
    animation: es-press 420ms 420ms ease-out both;
  }

  :root:not(.ac-still) .rung-item.just-next .rung {
    animation: es-fill 700ms 200ms var(--es-ease) both;
  }

  :root:not(.ac-still) .rung-item.is-fresh {
    animation: es-ease-in 500ms var(--es-ease) both;
  }

  :root:not(.ac-still) .coach-ring {
    animation: es-pulse 1800ms ease-in-out infinite;
  }

  :root:not(.ac-still) .saved-mark {
    transition: opacity 600ms ease-out;
  }

  :root:not(.ac-still) .sheet-panel {
    animation: es-rise 260ms var(--es-ease) both;
  }

  :root:not(.ac-still) .summit-poster:not([hidden]) .summit-peak {
    animation: es-rise 900ms var(--es-ease) both;
  }
}

@keyframes es-slide-down {
  from {
    transform: translateY(-16px);
    opacity: 0.2;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes es-press {
  from {
    transform: scale(1.3);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes es-fill {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes es-ease-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes es-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(1.04);
  }
}

@keyframes es-rise {
  from {
    transform: translateY(24px);
  }
  to {
    transform: none;
  }
}

/* ---------- the ending on a phone turned sideways: two columns, so the panel and its button fit ---------- */

@media (orientation: landscape) and (max-height: 500px) {
  html #activity-chrome-ending.site-perseper {
    justify-content: safe center;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  html #activity-chrome-ending.site-perseper .ac-card {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    align-items: start;
    gap: 6px 20px;
    width: min(100%, 820px);
    padding: 12px 16px;
  }

  html #activity-chrome-ending.site-perseper .ac-number {
    grid-column: 1;
    font-size: min(76px, 22dvh);
  }

  html #activity-chrome-ending.site-perseper .ac-verdict {
    grid-column: 1;
    font-size: 20px;
  }

  html #activity-chrome-ending.site-perseper .ac-work {
    grid-column: 1;
  }

  html #activity-chrome-ending.site-perseper .ac-lines {
    grid-column: 2;
    grid-row: 1 / span 4;
    grid-template-columns: 1fr;
    gap: 4px;
  }

  html #activity-chrome-ending.site-perseper .ac-line {
    padding: 5px 8px;
    font-size: 14px;
  }

  html #activity-chrome-ending.site-perseper .ac-fill {
    grid-column: 1;
    height: 10px;
  }

  html #activity-chrome-ending.site-perseper .ac-actions {
    grid-column: 1;
  }

  html.es-poster #activity-chrome-ending.site-perseper .ac-work {
    max-width: min(90px, 22dvh);
  }

  html.es-poster #activity-chrome-ending.site-perseper .ac-line {
    padding: 3px 0;
  }

  html.es-poster #activity-chrome-ending.site-perseper .ac-line:nth-child(n + 3):nth-child(-n + 7) {
    font-size: min(24px, 6.4dvh);
  }
}
