:root {
  color-scheme: light;
  --ink: #1c2430;
  --muted: #5c6b7a;
  --line: #d9e1e8;
  --paper: #f4f7f8;
  --card: #ffffff;
  --accent: #0f6e6b;
  --accent-ink: #ffffff;
  --danger: #9f2d2d;
  --danger-bg: #fff1f1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

.sheet {
  width: min(760px, calc(100% - 32px));
  margin: 32px auto 64px;
}

.sheet-header h1,
.thanks h1,
.prompt {
  line-height: 1.4;
}

.sheet-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.manage-link {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
}

.manage-link:hover { color: var(--accent); }

h1 {
  margin: 0;
  font-size: 1.7rem;
}

.lead {
  color: var(--muted);
}

.question-fields {
  border: 0;
  margin: 0;
  padding: 0;
  min-inline-size: 0;
}

.question {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 12px;
}

.question.has-error {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.prompt {
  margin: 0;
  font-weight: 700;
}

.req,
.opt {
  display: inline-block;
  margin-left: 8px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: 2px;
}

.req { background: #e7f4f3; color: var(--accent); }
.opt { background: #eef2f5; color: var(--muted); }

.help,
.error { margin: 8px 0 0; }
.help { color: var(--muted); font-size: 0.92rem; }
.error { color: var(--danger); font-weight: 700; }

.options,
.facility { display: grid; gap: 8px; margin-top: 14px; }

.option,
.facility label,
.number,
.date {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.option {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

input[type="checkbox"],
input[type="radio"] {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

.number input,
.date input,
.other input,
.facility select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

.number input { width: 8rem; flex: none; }
.date input { width: 12rem; flex: none; }

.other { margin: -4px 0 8px 12px; }
.other span { flex: none; padding-top: 10px; }

.facility label,
.entry-survey { flex-direction: column; gap: 4px; font-weight: 700; }
.facility select,
.entry-survey select { font-weight: 400; }
.entry-survey { display: flex; margin-bottom: 14px; }
.entry-survey select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

textarea { resize: vertical; }

.submit-row { margin-top: 20px; }

button,
input[type="submit"] {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 700;
  padding: 12px 28px;
  cursor: pointer;
}

button { width: 100%; }

.submitted-panel { display: none; }
html.already-submitted #survey-form { display: none; }
html.already-submitted .submitted-panel { display: block; }
.submitted-panel h2 { margin: 28px 0 8px; font-size: 1.4rem; }

.thanks { padding-top: 48px; }

:focus-visible {
  outline: 3px solid #8fd0cc;
  outline-offset: 2px;
}

.rank-board { display: grid; gap: 18px; margin-top: 14px; }
.rank-caption { margin: 0 0 8px; color: var(--accent); font-weight: 700; }
.rank-selected,
.rank-pool {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.rank-selected:empty { display: none; }
.rank-empty { margin: 0; color: var(--muted); font-size: 0.92rem; }
.rank-item {
  display: flex;
  align-items: stretch;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.rank-selected .rank-item { border-color: var(--accent); }
.rank-item.dragging { opacity: 0.45; }
.rank-item label {
  display: flex;
  flex: 1;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
}
.rank-index {
  min-width: 1.5rem;
  color: var(--accent);
  font-weight: 700;
}
.rank-index:empty { display: none; }
.rank-item .drag-handle {
  width: auto;
  align-self: stretch;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 12px 0 0 12px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-size: 1.2rem;
  font-weight: 400;
  cursor: grab;
  touch-action: none;
}
.rank-item .drag-handle:active { cursor: grabbing; }
.rank-item .drag-handle[hidden] { display: none; }
