.admin-page {
  min-height: 100vh;
  background: var(--desktop);
}

.admin-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 58px 0 96px;
}

.login-panel {
  width: min(480px, 100%);
  margin: 8vh auto 0;
}

.login-panel .window-body {
  padding: 28px;
}

.login-panel h1 {
  max-width: 420px;
  margin-bottom: 20px;
  font-size: clamp(32px, 4vw, 48px);
  word-break: keep-all;
}

.login-panel h1,
.admin-top h1 {
  margin: 0 0 18px;
  font-family: var(--display);
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.02;
}

.login-panel h1 {
  font-size: clamp(32px, 4vw, 48px);
}

.login-panel.window h1 {
  max-width: 420px;
  font-size: clamp(30px, 3vw, 44px);
  line-height: 1.08;
  word-break: keep-all;
}

.login-panel form,
.editor,
.site-editor {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 900;
}

input, textarea, select {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 4px;
  padding: 12px 13px;
  color: var(--ink);
  background: oklch(0.985 0.007 80);
  font: 16px/1.45 var(--ui);
}

textarea {
  resize: vertical;
  font-family: "Cascadia Mono", "Consolas", "Microsoft YaHei UI", monospace;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 14px;
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 4px;
  color: var(--ink);
  background: var(--panel-bright);
  font-family: var(--pixel);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.button.primary {
  background: var(--aqua);
}

.button.danger {
  background: oklch(0.94 0.04 24);
  color: oklch(0.45 0.16 24);
}

.button:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.admin-top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 28px;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 7px;
  background:
    linear-gradient(90deg, rgba(5,5,5,.06) 1px, transparent 1px) 0 0 / 12px 12px,
    var(--panel);
  box-shadow: 8px 9px 0 rgba(0,0,0,.1);
}

.admin-top nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  font-family: var(--ui);
  font-weight: 900;
}

.admin-top nav a {
  min-height: 34px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 4px;
  background: var(--panel);
  font-size: 12px;
}

.admin-top nav a.active {
  background: var(--aqua);
  transform: translateY(1px);
  border-bottom-width: 3px;
}

.alert {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 2px solid currentColor;
  border-radius: 4px;
  font-family: var(--ui);
  font-weight: 800;
}

.alert.error { color: oklch(0.45 0.16 24); background: oklch(0.94 0.04 24); }
.alert.success { color: oklch(0.34 0.1 145); background: oklch(0.91 0.07 145); }

.admin-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.dashboard-card,
.board-card {
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 148px;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--panel-bright);
  box-shadow: 6px 7px 0 rgba(0,0,0,.1);
}

.dashboard-card.primary-card {
  background:
    linear-gradient(90deg, rgba(5,5,5,.07) 1px, transparent 1px) 0 0 / 10px 10px,
    var(--yellow);
}

.card-label,
.board-card span,
.video-row-head span {
  color: var(--muted);
  font-family: var(--pixel);
  font-size: 11px;
  font-weight: 900;
}

.dashboard-card strong {
  font-family: var(--pixel);
  font-size: clamp(26px, 3vw, 42px);
  line-height: 1;
}

.dashboard-card p,
.logic-map p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.board-overview,
.logic-map {
  margin-top: 18px;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.board-card {
  min-height: 128px;
  color: var(--ink);
  background: var(--panel);
}

.board-card strong {
  font-family: var(--pixel);
  font-size: 36px;
  line-height: 1;
}

.board-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.site-editor {
  padding-bottom: 70px;
}

.editor-panel {
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.player-summary {
  background:
    linear-gradient(90deg, rgba(5,5,5,.06) 1px, transparent 1px) 0 0 / 12px 12px,
    var(--panel);
}

.editor-panel h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.field-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.video-admin-list {
  display: grid;
  gap: 14px;
}

.video-admin-row {
  display: grid;
  gap: 14px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 4px;
  background: var(--panel-bright);
  overflow: hidden;
}

.video-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 2px solid var(--line);
  background: var(--pink);
  font-family: var(--pixel);
  font-weight: 900;
}

.video-admin-row > .form-grid,
.video-admin-row > label {
  padding: 0 12px;
}

.video-admin-row > label:last-child {
  padding-bottom: 12px;
}

.dock-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.dock-editor-list {
  display: grid;
  gap: 10px;
}

.dock-editor-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 110px;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--panel-bright);
}

.dock-editor-row span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--pixel);
  font-weight: 900;
}

.dock-editor-row img {
  image-rendering: pixelated;
}

.import-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.event-editor {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
}

.sticky-actions {
  position: sticky;
  bottom: 14px;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--desktop) 88%, white);
}

.post-list,
.editor,
.delete-form {
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.post-list {
  display: grid;
  align-content: start;
  overflow: hidden;
  box-shadow: 6px 7px 0 rgba(0,0,0,.1);
}

.new-link,
.post-row {
  padding: 16px;
  border-bottom: 2px solid var(--line);
}

.new-link {
  color: var(--ink);
  background: var(--aqua);
  font-family: var(--ui);
  font-weight: 900;
}

.post-row strong,
.post-row span {
  display: block;
}

.post-row strong {
  line-height: 1.22;
}

.post-row span {
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 12px;
}

.editor {
  padding: 24px;
  box-shadow: 6px 7px 0 rgba(0,0,0,.1);
}

.image-preview {
  display: block;
  width: min(260px, 100%);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 2px solid var(--line);
  border-radius: 4px;
  background: var(--panel-bright);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.editor-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.delete-form {
  width: fit-content;
  margin: 18px 0 0 auto;
  padding: 0;
}

.delete-form button {
  border: 0;
  padding: 12px 16px;
  color: oklch(0.45 0.16 24);
  background: transparent;
  font-family: var(--ui);
  font-weight: 900;
  cursor: pointer;
}

.guestbook-admin {
  display: grid;
  gap: 14px;
}

.guestbook-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: start;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.guestbook-row strong,
.guestbook-row span {
  display: block;
}

.guestbook-row span {
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 900;
}

.guestbook-row p {
  margin: 10px 0 0;
  color: var(--ink);
}

@media (max-width: 900px) {
  .admin-top,
  .admin-layout {
    grid-template-columns: 1fr;
    display: grid;
  }
  .form-grid { grid-template-columns: 1fr; }
  .dashboard-grid,
  .board-grid {
    grid-template-columns: 1fr;
  }
  .dock-grid,
  .event-editor {
    grid-template-columns: 1fr;
  }
  .admin-top nav { justify-content: start; }
  .guestbook-row { grid-template-columns: 1fr; }
}
