:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-muted: #fafafc;
  --ink: #151720;
  --muted: #666b7a;
  --line: #e4e7ef;
  --primary: #5746e3;
  --primary-dark: #4335b8;
  --primary-soft: #f3f1ff;
  --accent: #1d7a8c;
  --warning: #dc2626;
  --success: #059669;
  --focus: rgba(87, 70, 227, 0.18);
  --radius: 8px;
  --shadow: 0 24px 60px -34px rgba(21, 23, 32, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans JP", "Inter", system-ui, sans-serif;
  line-height: 1.65;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 32px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.top-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: end;
  padding: 36px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1.35;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

.lead {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 86px);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.summary-strip div {
  display: grid;
  place-items: center;
  min-height: 78px;
  background: var(--surface-muted);
}

.summary-strip strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.summary-strip span {
  color: var(--muted);
  font-size: 12px;
}

.screen {
  display: none;
  padding: 36px;
}

.screen.active {
  display: block;
}

.section-header {
  margin-bottom: 24px;
}

.section-header p {
  color: var(--muted);
  margin-bottom: 0;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus,
textarea:focus,
.shortcut-practice:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus);
}

.guidance,
.consent {
  grid-column: 1 / -1;
}

.guidance {
  padding: 18px 20px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.guidance ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.consent input {
  width: 18px;
  height: 18px;
  margin-top: 5px;
  accent-color: var(--primary);
}

.primary-action,
.secondary-action {
  min-height: 48px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 700;
}

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

.primary-action:hover {
  background: var(--primary-dark);
}

.secondary-action {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.secondary-action:hover {
  background: var(--primary-soft);
  border-color: #c9c3ff;
}

.profile-form > .primary-action {
  justify-self: end;
  min-width: 180px;
}

.test-status {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
}

#progress-label {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
}

.progress-track {
  height: 8px;
  background: #eceef5;
  border-radius: 999px;
  overflow: hidden;
}

#progress-bar {
  width: 0%;
  height: 100%;
  background: var(--primary);
  transition: width 0.25s ease;
}

.timer {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 14px;
  background: var(--primary-soft);
  border: 1px solid #e3e0ff;
  color: #2c2e3a;
  border-radius: var(--radius);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.timer.danger {
  background: #fff1f0;
  border-color: #ffd7d4;
  color: var(--warning);
}

.question-card {
  min-height: 390px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: #2c2e3a;
  font-size: 13px;
  font-weight: 700;
}

.question-title {
  margin-bottom: 18px;
  font-size: 22px;
}

.options,
.shortcut-list,
.typing-layout,
.task-box,
.limited-quiz-list {
  display: grid;
  gap: 16px;
}

.option {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.option:hover,
.option.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.option-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--primary);
  font-weight: 700;
}

.task-source {
  padding: 16px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  white-space: pre-wrap;
}

.task-box textarea,
.typing-input {
  min-height: 150px;
  resize: vertical;
}

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

.live-metrics div {
  padding: 14px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.live-metrics strong {
  display: block;
  font-size: 24px;
  line-height: 1.2;
}

.live-metrics span,
.subtle {
  color: var(--muted);
}

.shortcut-question,
.limited-quiz-question {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.shortcut-question header {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.shortcut-question h3,
.limited-quiz-question h3 {
  margin-bottom: 10px;
}

.compact-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.compact-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  font-weight: 700;
  cursor: pointer;
}

.compact-option:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.compact-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.shortcut-practice {
  display: grid;
  gap: 16px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  outline: none;
}

.shortcut-command {
  display: grid;
  place-items: center;
  min-height: 110px;
  border: 1px dashed #b9bee8;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
}

.shortcut-feedback {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.shortcut-feedback.success {
  background: #ecfdf5;
  border-color: #bfe8d4;
  color: var(--success);
}

.shortcut-feedback.error,
.browser-note {
  color: var(--warning);
}

.shortcut-feedback.error {
  background: #fff1f0;
  border-color: #ffd7d4;
}

.browser-note {
  margin-bottom: 0;
  font-size: 14px;
}

.shortcut-detail {
  grid-column: 1 / -1;
}

.shortcut-result-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}

.shortcut-result-list div {
  display: grid;
  grid-template-columns: 72px 140px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
}

.shortcut-result-list span {
  font-weight: 700;
}

.shortcut-result-list .passed span {
  color: var(--success);
}

.shortcut-result-list .failed span {
  color: var(--warning);
}

.shortcut-result-list em {
  color: var(--muted);
  font-style: normal;
}

.navigation {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 22px;
}

.result-hero {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 10px;
  padding: 16px 0 28px;
}

.score-ring {
  display: grid;
  place-items: center;
  width: 164px;
  height: 164px;
  border: 10px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
}

.score-ring strong {
  font-size: 48px;
  line-height: 1;
}

.score-ring span {
  color: var(--muted);
  font-weight: 700;
}

.level-text {
  max-width: 700px;
  color: var(--muted);
}

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

.category-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.category-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.category-card h3 {
  margin-bottom: 0;
}

.mini-track {
  height: 8px;
  margin-bottom: 10px;
  background: #eceef5;
  border-radius: 999px;
  overflow: hidden;
}

.mini-track span {
  display: block;
  height: 100%;
  background: var(--success);
}

.category-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.save-status.pending strong {
  color: var(--primary);
}

.save-status.success strong {
  color: var(--success);
}

.save-status.error strong {
  color: var(--warning);
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 26px;
}

@media (max-width: 760px) {
  .app-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .top-panel,
  .screen {
    padding: 24px;
  }

  .top-panel,
  .test-status,
  .category-grid,
  .compact-options,
  .live-metrics,
  .shortcut-result-list {
    grid-template-columns: 1fr;
  }

  .summary-strip {
    grid-template-columns: repeat(3, 1fr);
  }

  .profile-form > .primary-action {
    justify-self: stretch;
  }

  .question-card {
    min-height: auto;
    padding: 20px;
  }

  .navigation,
  .result-actions {
    flex-direction: column;
  }

  .shortcut-result-list div {
    grid-template-columns: 72px 1fr;
  }

  .shortcut-result-list em {
    grid-column: 2;
  }
}
