:root {
  --ar-ink: #2c2540;
  --ar-ink-soft: #4a3f62;
  --ar-ink-muted: #8a7faa;
  --ar-paper: #f5f2f8;
  --ar-card: #fff;
  --ar-board: #e8e1f2;
  --ar-grid: #c4bad8;
  --ar-accent: #7c6fa0;
  --ar-accent-strong: #5b44e7;
  --ar-accent-light: #a99cc4;
  --ar-accent-dim: #eae5f5;
  --ar-border: #d8cfe8;
  --ar-error: #9a7040;
  --ar-error-bg: rgba(190, 142, 96, .18);
  --ar-error-border: rgba(160, 110, 60, .46);
  --ar-shadow: 0 16px 56px rgba(44, 37, 64, .12), 0 2px 8px rgba(44, 37, 64, .06);
  --ar-serif: Georgia, "Times New Roman", serif;
  --ar-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --ar-tr: 180ms ease;
}

[data-theme="dark"] {
  --ar-ink: #ede9ff;
  --ar-ink-soft: #b8b0d6;
  --ar-ink-muted: #777094;
  --ar-paper: #0e0b1f;
  --ar-card: #16132b;
  --ar-board: #1b1732;
  --ar-grid: #332d4d;
  --ar-accent: #a293f3;
  --ar-accent-strong: #8b76f4;
  --ar-accent-light: #7d70b2;
  --ar-accent-dim: #241e46;
  --ar-border: #2a2442;
  --ar-error: #d49a55;
  --ar-error-bg: rgba(196, 142, 86, .16);
  --ar-error-border: rgba(212, 154, 85, .46);
  --ar-shadow: 0 16px 56px rgba(0, 0, 0, .58), 0 2px 8px rgba(0, 0, 0, .35);
}

.areas-page,
.areas-page * {
  box-sizing: border-box;
}

body.areas-page {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% 0, rgba(234, 229, 245, .9), rgba(245, 242, 248, 0) 360px),
    var(--ar-paper);
  color: var(--ar-ink);
  font-family: var(--ar-sans);
  -webkit-font-smoothing: antialiased;
}

[data-theme="dark"] body.areas-page {
  background:
    radial-gradient(circle at 50% 0, rgba(36, 30, 70, .82), rgba(14, 11, 31, 0) 380px),
    var(--ar-paper);
}

.ar-page {
  width: min(100% - 28px, 980px);
  margin: 0 auto;
  padding: 78px 0 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ar-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.ar-card {
  width: 100%;
  max-width: 820px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 36px 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ar-eyebrow {
  margin: 0 0 28px;
  color: var(--ar-ink-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-align: center;
}

.ar-title {
  margin: 0 0 9px;
  color: var(--ar-ink);
  font-family: var(--ar-serif);
  font-size: clamp(50px, 8vw, 78px);
  font-weight: 400;
  letter-spacing: -.02em;
  line-height: .98;
  text-align: center;
}

.ar-subtitle {
  max-width: 470px;
  margin: 0 auto 30px;
  color: var(--ar-ink-soft);
  font-size: 16px;
  font-weight: 350;
  line-height: 1.55;
  text-align: center;
}

.ar-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.ar-date {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--ar-ink-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .03em;
}

.ar-pip {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ar-accent-light);
}

.ar-level {
  padding: 0;
  color: var(--ar-ink-muted);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 12px;
  white-space: nowrap;
}

.ar-divider {
  display: none;
}

.ar-stats {
  display: flex;
  gap: 48px;
  align-items: flex-end;
  justify-content: center;
  margin-bottom: 30px;
}

.ar-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.ar-stat-label {
  color: var(--ar-ink-muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.ar-stat-value {
  color: var(--ar-ink);
  font-family: var(--ar-serif);
  font-size: 28px;
  line-height: 1;
}

.ar-stat-value.ar-idle {
  color: var(--ar-ink-muted);
}

.ar-stat-value.ar-done {
  color: var(--ar-accent-strong);
}

.ar-board-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 0 24px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.ar-board {
  position: relative;
  background: var(--ar-board);
  border-radius: 5px;
  box-shadow:
    0 0 0 1px var(--ar-grid),
    inset 0 1px 0 rgba(255, 255, 255, .28),
    0 8px 34px rgba(44, 37, 64, .10),
    0 1px 4px rgba(44, 37, 64, .06);
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.ar-grid {
  position: relative;
  display: grid;
  gap: 1px;
  pointer-events: none;
}

.ar-cell {
  position: relative;
  background: transparent;
  border-right: 1px solid rgba(196, 186, 216, .86);
  border-bottom: 1px solid rgba(196, 186, 216, .86);
}

.ar-cell.last-col {
  border-right: 0;
}

.ar-cell.last-row {
  border-bottom: 0;
}

.ar-rects {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.ar-piece {
  position: absolute;
  border-radius: 2px;
  transition: opacity var(--ar-tr), background var(--ar-tr), border-color var(--ar-tr), box-shadow var(--ar-tr);
}

.ar-piece.valid {
  border: 1.5px solid;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .22),
    inset 0 -1px 0 rgba(44, 37, 64, .035),
    0 1px 3px rgba(44, 37, 64, .055);
}

.ar-piece.invalid {
  background: var(--ar-error-bg) !important;
  border: 1.5px solid var(--ar-error-border) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}

.ar-piece.dragging {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .20), rgba(255, 255, 255, 0)),
    rgba(124, 111, 160, .14);
  border: 1.5px dashed var(--ar-accent-light);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .18),
    0 1px 5px rgba(124, 111, 160, .16);
}

.ar-clue-wrap {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.ar-clue {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ar-ink);
  background: var(--ar-card);
  border: 1.5px solid var(--ar-border);
  box-shadow:
    inset 0 1px 2px rgba(44, 37, 64, .08),
    0 2px 6px rgba(44, 37, 64, .13);
  font-family: var(--ar-serif);
  font-size: 15px;
  font-weight: 700;
  transition: transform var(--ar-tr), border-color var(--ar-tr), color var(--ar-tr), background var(--ar-tr);
}

.ar-clue.solved {
  color: var(--ar-accent);
  background: var(--ar-card);
  border-color: var(--ar-accent-light);
  box-shadow:
    inset 0 1px 2px rgba(124, 111, 160, .12),
    0 2px 7px rgba(124, 111, 160, .20);
}

.ar-feedback {
  min-height: 22px;
  margin: 0 0 16px;
  color: var(--ar-ink-muted);
  text-align: center;
  font-size: 12.5px;
  line-height: 1.55;
}

.ar-feedback.err {
  color: var(--ar-error);
}

.ar-feedback.ok {
  color: var(--ar-accent-strong);
  font-weight: 650;
}

.ar-actions {
  display: flex;
  width: min(100%, 440px);
  justify-content: center;
  gap: 14px;
  margin: 0 auto 4px;
}

.ar-btn {
  flex: 1;
  min-height: 42px;
  padding: 10px 16px;
  color: var(--ar-ink-soft);
  background: transparent;
  border: 1px solid var(--ar-border);
  border-radius: 2px;
  font-family: var(--ar-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color var(--ar-tr), color var(--ar-tr), background var(--ar-tr), transform var(--ar-tr);
}

.ar-btn:hover:not(:disabled) {
  color: var(--ar-accent-strong);
  background: var(--ar-accent-dim);
  border-color: var(--ar-accent-light);
}

.ar-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.ar-btn:disabled {
  opacity: .42;
  cursor: not-allowed;
}

.ar-btn:focus-visible,
.ar-help-btn:focus-visible,
.ar-board:focus-visible {
  outline: 2px solid var(--ar-accent-strong);
  outline-offset: 2px;
}

.ar-victory {
  max-width: 420px;
  margin: 20px auto 0;
  padding: 10px 26px;
  border-top: 1px solid var(--ar-border);
  border-bottom: 1px solid var(--ar-border);
  color: var(--ar-ink-soft);
  font-family: var(--ar-serif);
  font-size: 15px;
  text-align: center;
}

.ar-victory em {
  color: var(--ar-accent-strong);
  font-style: normal;
}

.ar-help {
  width: min(100%, 540px);
  margin: 28px auto 0;
  border-top: 1px solid var(--ar-border);
}

.ar-help-btn {
  width: 100%;
  padding: 14px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ar-ink-muted);
  background: none;
  border: none;
  font-family: var(--ar-sans);
  font-size: 12.5px;
  cursor: pointer;
}

.ar-help-btn:hover {
  color: var(--ar-accent-strong);
}

.ar-chevron {
  width: 8px;
  height: 8px;
  margin-right: 3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--ar-tr);
}

.ar-help-btn[aria-expanded="true"] .ar-chevron {
  transform: rotate(225deg);
}

.ar-help-body {
  padding: 12px 0 4px;
  color: var(--ar-ink-soft);
  font-size: 12.5px;
  line-height: 1.7;
}

.ar-help-body p {
  margin: 0 0 6px;
}

.ar-back {
  width: 100%;
  max-width: 820px;
  margin: 18px auto 0;
  text-align: center;
  font-size: 13px;
}

.ar-back a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  color: var(--ar-ink-soft);
  text-decoration: none;
  font-weight: 650;
}

.ar-back a:hover {
  color: var(--ar-accent-strong);
}

.site-footer-std {
  width: min(100% - 28px, 980px);
  margin: 0 auto;
  padding: 0 0 36px;
  color: var(--ar-ink-muted);
  font-size: 12px;
}

.site-footer-std p {
  margin: 0;
}

@media (max-width: 520px) {
  .ar-page {
    width: min(100% - 16px, 980px);
    padding-top: 54px;
  }

  .ar-card {
    padding: 26px 0 20px;
  }

  .ar-title {
    font-size: 48px;
  }

  .ar-subtitle {
    font-size: 14px;
    margin-bottom: 24px;
  }

  .ar-meta {
    margin-bottom: 18px;
  }

  .ar-stats {
    gap: 32px;
    margin-bottom: 20px;
  }

  .ar-stat-value {
    font-size: 23px;
  }

  .ar-board-wrap {
    width: 100%;
  }

  .ar-clue {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .areas-page *,
  .areas-page *::before,
  .areas-page *::after {
    transition: none !important;
    animation-duration: .01ms !important;
  }
}
