/* ── Arrow Time ─────────────────────────────────────── */
.at-wrap {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 1.75rem 1rem 3.5rem;
}

.at-top {
  text-align: center;
  margin-bottom: 1.1rem;
}

.at-title {
  font-size: clamp(1.5rem, 6.5vw, 2.3rem);
  color: var(--red);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.15;
}

.at-sub {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.55;
  color: #6b6b6b;
}

/* ── Stats ──────────────────────────────────────────── */
.at-stats {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}

.at-stat {
  flex: 1 1 0;
  min-width: 0;
  background: var(--grey);
  border-radius: 10px;
  padding: 0.5rem 0.25rem 0.45rem;
  text-align: center;
}

.at-stat b {
  display: block;
  font-weight: normal;
  font-size: clamp(1rem, 4.5vw, 1.2rem);
  color: var(--dark);
  font-variant-numeric: tabular-nums;
}

.at-stat span {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.57rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #999;
}

/* ── Board ──────────────────────────────────────────── */
/* The board is not held to the reading column: it takes the width it needs,
   centred on the page, and the text around it stays narrow. The viewport
   scrolls once the board is zoomed past the room available. */
.at-view {
  margin-left: 50%;
  transform: translateX(-50%);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.at-stage {
  position: relative;
  margin: 0 auto;
}

#at-board {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

.at-tiles rect {
  fill: var(--grey);
}

.at-arrow {
  cursor: pointer;
  outline: none;
}

.at-line {
  fill: none;
  stroke: #1d1d1d;
  stroke-width: 11;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.at-head {
  fill: #1d1d1d;
}

@media (hover: hover) {
  .at-arrow:hover .at-line,
  .at-arrow:hover .at-head { fill: var(--red); stroke: var(--red); }
  .at-arrow:hover .at-line { fill: none; }
}

.at-arrow:focus-visible .at-line,
.at-arrow:focus-visible .at-head { stroke: var(--red2); fill: var(--red2); }
.at-arrow:focus-visible .at-line { fill: none; }

.at-arrow.is-gone { display: none; }

.at-arrow.is-blocked { animation: at-shake 0.42s ease; }
.at-arrow.is-blocked .at-line { stroke: var(--red2); }
.at-arrow.is-blocked .at-head { fill: var(--red2); }

.at-arrow.is-blocker .at-line { stroke: var(--red); opacity: 0.55; }
.at-arrow.is-blocker .at-head { fill: var(--red); opacity: 0.55; }

.at-arrow.is-hint .at-line { stroke: var(--red); animation: at-pulse 0.8s ease-in-out 2; }
.at-arrow.is-hint .at-head { fill: var(--red); animation: at-pulse 0.8s ease-in-out 2; }

@keyframes at-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-7px); }
  45%      { transform: translateX(7px); }
  70%      { transform: translateX(-4px); }
}

@keyframes at-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
  .at-arrow.is-blocked { animation: none; }
  .at-arrow.is-hint .at-line,
  .at-arrow.is-hint .at-head { animation: none; }
}

/* ── Level panel ────────────────────────────────────── */
.at-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.3rem;
  text-align: center;
  padding: 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s;
}

.at-panel.is-on { opacity: 1; visibility: visible; }

.at-panel h2 {
  font-size: clamp(1.3rem, 6vw, 1.9rem);
  font-weight: normal;
  color: var(--red);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.at-panel p { font-size: 0.88rem; color: #555; }
.at-panel .at-panel-best { font-size: 0.78rem; color: #888; }

.at-panel-btns {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.8rem;
}

/* ── Buttons ────────────────────────────────────────── */
.at-controls {
  display: flex;
  gap: 0.45rem;
  margin-top: 1rem;
}

.at-btn {
  flex: 1 1 0;
  min-width: 84px;
  padding: 0.7rem 0.6rem;
  border: 1px solid var(--red);
  background: var(--white);
  color: var(--red);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, color 0.2s;
}

.at-btn--solid { background: var(--red); color: var(--white); }

@media (hover: hover) {
  .at-btn:hover { background: var(--red); color: var(--white); }
  .at-btn--solid:hover { background: var(--red2); border-color: var(--red2); }
}

.at-panel-btns .at-btn { flex: 0 1 auto; }

/* ── Zoom ───────────────────────────────────────────── */
.at-zoom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.8rem;
}

.at-btn--icon {
  flex: 0 0 auto;
  min-width: 46px;
  font-size: 1rem;
  line-height: 1;
  padding: 0.55rem 0.6rem;
}

.at-zoom-level {
  min-width: 56px;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: #999;
  font-variant-numeric: tabular-nums;
}

.at-zoom .at-btn { flex: 0 0 auto; }

/* ── Jump to level ──────────────────────────────────── */
.at-jump {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #999;
}

.at-jump label { flex: 0 0 auto; }

.at-jump input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.55rem 0.6rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  text-align: center;
  color: var(--dark);
  background: var(--white);
}

.at-jump input:focus { outline: none; border-color: var(--red); }
.at-jump .at-btn { flex: 0 0 auto; min-width: 64px; }

/* ── Resume ─────────────────────────────────────────── */
.at-resume {
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid #eee;
  font-size: 0.82rem;
  color: #777;
  line-height: 1.6;
}

.at-code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 1rem;
  letter-spacing: 0.12em;
  color: var(--dark);
}

.at-resume-row {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.at-resume input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.6rem 0.7rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dark);
  background: var(--white);
}

.at-resume input:focus {
  outline: none;
  border-color: var(--red);
}

.at-resume-row .at-btn { flex: 0 0 auto; min-width: 72px; }

.at-note {
  display: block;
  min-height: 1.2em;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--red);
}

/* ── Help ───────────────────────────────────────────── */
.at-help {
  margin-top: 1.4rem;
  font-size: 0.8rem;
  line-height: 1.6;
  color: #777;
}

.at-help summary {
  cursor: pointer;
  color: var(--red);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.at-help ul { margin: 0.6rem 0 0 1.1rem; }
.at-help li { margin-bottom: 0.3rem; }

@media (max-width: 380px) {
  .at-wrap { padding-left: 0.75rem; padding-right: 0.75rem; }
  .at-btn { letter-spacing: 0.06em; font-size: 0.68rem; }
}
