:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e6e8eb;
  --text: #1c1f23;
  --muted: #6b7280;
  --primary: #2f6df4;
  --primary-dark: #2256d6;
  --accent: #0f9d58;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Hiragino Sans", "Noto Sans CJK JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease,
    transform 0.05s ease;
}

.btn .icon {
  flex: 0 0 auto;
}

.btn-icon {
  gap: 0;
  padding: 9px;
}

.btn:hover {
  border-color: #d2d6db;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

h1 {
  font-size: 26px;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

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

.page-head .muted {
  margin: 0;
  font-size: 14px;
}

.search {
  display: flex;
  gap: 8px;
}

.search input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  min-width: 200px;
  background: var(--surface);
}

.search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 109, 244, 0.15);
}

.card-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.08s ease;
}

.card:hover {
  border-color: #cdd3da;
  transform: translateY(-1px);
}

.card-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
}

.card-order {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef2fb;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
}

.card-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-weight: 600;
  font-size: 15.5px;
  word-break: break-word;
}

.card-meta {
  color: var(--muted);
  font-size: 13px;
}

.card-arrow {
  color: #b6bcc4;
  font-size: 24px;
  line-height: 1;
}

.empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

.back-link {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.back-link:hover {
  text-decoration: underline;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.detail-head-main {
  min-width: 0;
  flex: 1 1 auto;
}

.detail-head .switch {
  flex: 0 0 auto;
  padding-top: 6px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #eef2fb;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 600;
}

.badge.muted {
  background: #f1f2f4;
  color: var(--muted);
}

.badge-pass {
  background: #e7f6ee;
  color: var(--accent);
}

.badge code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: relative;
  width: 40px;
  height: 23px;
  border-radius: 999px;
  background: #d2d6db;
  transition: background 0.18s ease;
  flex: 0 0 auto;
}

.switch-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease;
}

.switch input:checked + .switch-slider {
  background: var(--primary);
}

.switch input:checked + .switch-slider::after {
  transform: translateX(17px);
}

.switch input:focus-visible + .switch-slider {
  box-shadow: 0 0 0 3px rgba(47, 109, 244, 0.25);
}

.switch-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.qa-list {
  list-style: none;
  counter-reset: qa;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qa.collapsed .qa-question {
  display: none;
}

.qa {
  counter-increment: qa;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.qa-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.qa-header:hover {
  background: #fafbfc;
}

.qa-num {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #eef2fb;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}

.qa-num::before {
  content: counter(qa);
}

.qa-answer {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.qa-answer-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.qa-answer-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.qa-chevron {
  margin-left: auto;
  flex: 0 0 auto;
  color: #b6bcc4;
  transition: transform 0.18s ease;
}

.qa.collapsed .qa-chevron {
  transform: rotate(-90deg);
}

.qa-question {
  font-size: 15px;
  word-break: break-word;
  padding: 0 16px 16px 16px;
}

.qa-question ruby rt {
  font-size: 0.62em;
  color: var(--muted);
}

.opt-hit {
  color: var(--accent);
}

.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.flash {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
}

.flash-success {
  background: #e7f6ee;
  color: #0b7a43;
  border-color: #bfe7cf;
}

.flash-warning {
  background: #fff7e6;
  color: #92600a;
  border-color: #f5e0b3;
}

.flash-error {
  background: #fdecec;
  color: #b42318;
  border-color: #f5c2c0;
}

@media (max-width: 560px) {
  .page-head {
    flex-direction: column;
    align-items: stretch;
  }
  .search input {
    flex: 1;
    min-width: 0;
  }
}
