/* Standalone Arch Madness page — no AcademicPages chrome */
html,
body {
  margin: 0;
  padding: 0;
}

body.arch-madness-standalone {
  min-height: 100vh;
}

.arch-madness-back {
  margin: 0;
  padding: 12px 16px 24px;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

.arch-madness-back a {
  color: #0369a1;
  font-weight: 600;
  text-decoration: none;
}

.arch-madness-back a:hover {
  text-decoration: underline;
}

/* Daily game + archive */
.am-game,
.am-archive,
.am-loading,
.am-empty {
  min-height: 100vh;
  padding: 16px;
  color: #0f172a;
  background: #f8fafc;
  box-sizing: border-box;
}

.am-game__header {
  max-width: 720px;
  margin: 0 auto 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}

.am-game__title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.am-game__subtitle {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 14px;
}

.am-game__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 9.5rem;
}

.am-btn {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 14px;
  background: #fff;
  color: #0f172a;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.am-btn:hover {
  background: #f1f5f9;
}

.am-btn--ghost {
  background: transparent;
}

.am-game__main {
  max-width: 960px;
  margin: 0 auto;
}

.am-game__play-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 28px;
}

.am-board {
  display: inline-grid;
  border: 2px solid #0f172a;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.am-cell {
  position: relative;
  border: 1px solid #cbd5e1;
  padding: 0;
  cursor: pointer;
  font-weight: 800;
  font-size: 14px;
}

.am-cell:disabled {
  cursor: default;
}

.am-cell__arc {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.am-cell__clue {
  position: relative;
  z-index: 1;
}

.am-legend {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #475569;
}

.am-legend__swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -2px;
  border: 1px solid #94a3b8;
}

.am-legend__swatch--arc-bad {
  background: #dc2626;
}

.am-legend__swatch--arc-ok {
  background: #0f172a;
}

.am-legend__swatch--region-ok {
  background: rgba(74, 222, 128, 0.55);
}

.am-legend__swatch--region-bad {
  background: rgba(248, 113, 113, 0.55);
}

.am-solved-banner {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
}

.am-solved {
  margin: 0;
  flex: 1 1 12rem;
  color: #065f46;
  font-weight: 700;
}

.am-btn--share {
  flex-shrink: 0;
  background: #065f46;
  border-color: #065f46;
  color: #ecfdf5;
}

.am-btn--share:hover {
  background: #047857;
  border-color: #047857;
}

.am-hint {
  margin-top: 12px;
  font-size: 13px;
  color: #64748b;
}

.am-region-stats {
  flex: 0 0 auto;
  min-width: 168px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
  padding: 24px 28px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.am-region-stats__stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.am-region-stats__label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}

.am-region-stats__value {
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.am-region-stats__note {
  font-size: 13px;
  color: #b45309;
  font-weight: 600;
}

.am-region-stats__detail {
  margin: 0;
  font-size: 14px;
  color: #475569;
  line-height: 1.4;
}

.am-region-stats__idle {
  margin: 0;
  font-size: 15px;
  color: #94a3b8;
  line-height: 1.5;
  text-align: center;
}

.am-nav {
  margin-top: 24px;
  font-size: 14px;
}

.am-nav a {
  color: #0369a1;
  font-weight: 600;
  text-decoration: none;
}

.am-nav a:hover {
  text-decoration: underline;
}

.am-empty {
  text-align: center;
  padding-top: 80px;
}

.am-empty__face {
  font-size: 64px;
  line-height: 1;
}

.am-empty__title {
  margin: 16px 0 8px;
  font-size: 26px;
}

.am-empty__text {
  color: #64748b;
  max-width: 420px;
  margin: 0 auto 20px;
}

.am-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #64748b;
}

.am-instructions-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.am-instructions {
  background: #fff;
  border-radius: 16px;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.am-instructions__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
}

.am-instructions__head h2 {
  margin: 0;
  font-size: 20px;
}

.am-instructions__body {
  padding: 16px 20px 20px;
  font-size: 15px;
  line-height: 1.55;
}

.am-instructions__body h3 {
  margin: 0 0 12px;
}

.am-instructions__body p {
  margin: 0 0 12px;
}

.am-instructions__attrib {
  font-size: 13px;
  color: #64748b;
}

.am-instructions__attrib a {
  color: #0369a1;
}

.am-archive {
  max-width: 560px;
  margin: 0 auto;
}

.am-archive__header h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.am-archive__header p {
  margin: 0 0 24px;
  color: #64748b;
}

.am-archive__list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}

.am-archive__list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #e2e8f0;
}

.am-archive__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.am-difficulty {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  line-height: 1.2;
  white-space: nowrap;
}

.am-difficulty--easy {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.am-difficulty--medium {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde047;
}

.am-difficulty--hard {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.am-select--full {
  width: 100%;
  box-sizing: border-box;
}

.am-archive__list a {
  font-weight: 700;
  color: #0369a1;
  text-decoration: none;
}

.am-archive__list a:hover {
  text-decoration: underline;
}

.am-archive__id {
  font-size: 13px;
  color: #94a3b8;
  font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
}

.am-game--archive .am-game__header,
.am-game--archive .am-archive__main {
  max-width: 560px;
}

.am-game--explorer .am-game__header,
.am-game--explorer .am-explorer__toolbar,
.am-game--explorer .am-explorer__layout {
  max-width: 1040px;
  margin-left: auto;
  margin-right: auto;
}

.am-explorer__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding: 0 0 0;
}

.am-explorer__layout {
  display: grid;
  grid-template-columns: minmax(280px, auto) minmax(280px, 1fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 860px) {
  .am-explorer__layout {
    grid-template-columns: 1fr;
  }
}

.am-panel {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  padding: 16px;
}

.am-panel__title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 800;
}

.am-explorer__size {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  color: #475569;
}

.am-input {
  width: 70px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px;
  font-size: 14px;
}

.am-select {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 12px;
  background: #fff;
  font-size: 14px;
  color: #0f172a;
}

.am-explorer__meta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: #475569;
}

.am-explorer__meta span {
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 3px 8px;
}

.am-explorer__meta--warn {
  border-color: #ef4444 !important;
  color: #b91c1c !important;
}

.am-cell__clue--given {
  position: absolute;
  top: 3px;
  left: 3px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 10px;
}

.am-io__hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: #64748b;
}

.am-io__meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.am-io__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #475569;
}

.am-io__field span {
  font-weight: 600;
}

.am-input--text {
  width: 100%;
  box-sizing: border-box;
}

.am-io__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.am-io__error {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 14px;
}

.am-io__preview {
  margin-bottom: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  background: #f8fafc;
}

.am-io__preview img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-top: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
}

.am-io__preview a {
  color: #0369a1;
  font-weight: 700;
  text-decoration: none;
}

.am-io__textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  resize: vertical;
}
