:root {
  color-scheme: light;
  --bg: #f7f4fb;
  --surface: #ffffff;
  --text: #202124;
  --muted: #5f6368;
  --line: #dadce0;
  --focus: #1a73e8;
  --accent: #673ab7;
  --accent-strong: #512da8;
  --success: #188038;
  --danger: #b3261e;
  --shadow: 0 1px 2px rgba(60, 64, 67, 0.15), 0 1px 3px rgba(60, 64, 67, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.55;
}

button,
input,
textarea {
  font: inherit;
}

.form-shell,
.admin-shell {
  width: min(760px, calc(100% - 32px));
  margin: 32px auto 56px;
}

.admin-shell {
  width: min(1080px, calc(100% - 32px));
}

.survey-form,
.samples,
.admin-panel {
  display: grid;
  gap: 14px;
}

.form-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.form-hero,
.admin-login {
  padding-top: 34px;
}

.accent-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 10px;
  background: var(--accent);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 0.83rem;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 18px;
  font-size: 1.25rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 1.05rem;
}

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

.field-label,
.question-title {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
}

input[type="text"],
input[type="password"],
textarea {
  border-width: 0 0 1px;
  border-radius: 0;
  padding-left: 0;
}

input:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(26, 115, 232, 0.24);
  outline-offset: 2px;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.form-card > .field-label:not(:first-child) {
  margin-top: 20px;
}

.media-frame {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
}

.media-frame audio,
.media-frame video {
  width: 100%;
  max-height: 360px;
  border-radius: 6px;
  background: #111;
}

.question-block {
  border-top: 1px solid #f1f3f4;
  padding-top: 20px;
}

.question-block + .question-block {
  margin-top: 20px;
}

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

.rating-option {
  min-height: 96px;
  cursor: pointer;
}

.rating-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rating-card {
  display: grid;
  align-content: start;
  gap: 5px;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 10px;
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.rating-number {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #f1f3f4;
  font-weight: 700;
}

.rating-text {
  color: var(--muted);
  font-size: 0.86rem;
}

.rating-option input:checked + .rating-card {
  border-color: var(--accent);
  background: #f4efff;
  box-shadow: 0 0 0 1px var(--accent);
}

.rating-option input:checked + .rating-card .rating-number {
  background: var(--accent);
  color: #fff;
}

.submit-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 4px;
  padding: 0 18px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary-button {
  background: #fff;
  color: var(--accent-strong);
  border-color: var(--line);
}

.message {
  min-height: 1.5em;
  margin: 0;
  color: var(--muted);
}

.message.success {
  color: var(--success);
}

.message.error {
  color: var(--danger);
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.compact-form {
  display: grid;
  gap: 14px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  padding: 8px 2px;
}

.admin-header h1 {
  margin-bottom: 0;
}

.admin-actions {
  display: flex;
  gap: 8px;
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.4fr) auto;
  align-items: end;
  gap: 14px;
}

.sample-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.sample-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #edf0f2;
  border-radius: 6px;
  padding: 12px;
}

.sample-row p {
  margin: 0;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.metric-values {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.metric-value strong {
  display: block;
  font-size: 1.6rem;
}

.metric-value span {
  color: var(--muted);
  font-size: 0.85rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

th,
td {
  border-bottom: 1px solid #edf0f2;
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

@media (max-width: 720px) {
  .form-shell,
  .admin-shell {
    width: min(100% - 20px, 760px);
    margin-top: 18px;
  }

  .form-card {
    padding: 20px 16px;
  }

  .rating-grid,
  .upload-grid {
    grid-template-columns: 1fr;
  }

  .rating-option {
    min-height: 72px;
  }

  .rating-card {
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  .submit-card,
  .admin-header,
  .sample-row {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .admin-actions {
    width: 100%;
  }

  .admin-actions > * {
    flex: 1;
  }
}
