
:root {
  color-scheme: light;
  --ink: #1d252c;
  --muted: #607080;
  --line: #d7dde3;
  --panel: #ffffff;
  --surface: #f4f7f9;
  --soft: #edf2f6;
  --ok: #176b45;
  --bad: #9b2c2c;
  --link: #185adb;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button,
a {
  touch-action: manipulation;
}

header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}

h3 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0;
}

header p,
.project-head p,
.viewer-toolbar p,
dd {
  color: var(--muted);
}

a {
  color: var(--link);
  text-decoration: none;
  font-weight: 650;
}

a:hover {
  text-decoration: underline;
}

.repo {
  white-space: nowrap;
}

main {
  display: grid;
  gap: 22px;
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 20px;
}

.directory {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
}

.directory a,
.project-actions button,
.access-form button,
.viewer-actions button,
.viewer-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.directory a:hover,
.project-actions button:hover,
.access-form button:hover,
.viewer-actions button:hover,
.viewer-actions a:hover {
  background: var(--soft);
  text-decoration: none;
}

.stage-section {
  display: grid;
  gap: 12px;
}

.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

.stage-head span {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 700;
}

.project-list {
  display: grid;
  gap: 12px;
}

.project {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.project-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status.ok {
  color: var(--ok);
  background: #e8f5ed;
}

.status.bad {
  color: var(--bad);
  background: #fae9e9;
}

dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 1.4fr);
  gap: 12px;
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

dd {
  overflow-wrap: anywhere;
  margin: 2px 0 0;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 12px 16px;
}

.project-actions .project-note,
.empty-stage,
.access-message {
  color: var(--muted);
}

.access-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.access-form input {
  width: min(280px, 62vw);
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: white;
  color: var(--ink);
}

.access-message {
  min-width: 140px;
}

.access-message.is-error {
  color: var(--bad);
}

.empty-stage {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.viewer {
  overflow: hidden;
  min-height: calc(100vh - 112px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.viewer-toolbar {
  position: sticky;
  top: 73px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.viewer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.viewer iframe {
  display: block;
  width: 100%;
  height: calc(100vh - 176px);
  min-height: 720px;
  border: 0;
  background: white;
}

@media (max-width: 820px) {
  header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
  }

  main {
    padding: 12px;
  }

  dl {
    grid-template-columns: 1fr;
  }

  .project-head,
  .project-actions,
  dl,
  .viewer-toolbar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .viewer-toolbar {
    align-items: flex-start;
    flex-direction: column;
    top: 101px;
  }

  .viewer iframe {
    height: calc(100vh - 222px);
    min-height: 520px;
  }
}
