:root {
  --bg: #0b0b0c;
  --bg-elev: #141416;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --red: #e82127;
  --red-dim: #8b1519;
  --ok: #22c55e;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(232, 33, 39, 0.18), transparent 50%),
    radial-gradient(800px 400px at 100% 0%, rgba(255, 255, 255, 0.05), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Noto Sans JP", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.share-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.share-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #71717a;
}

.share-status[data-state="online"] .share-dot {
  background: var(--ok);
}

.share-status[data-state="syncing"] .share-dot {
  background: #f59e0b;
}

.share-status[data-state="error"] .share-dot {
  background: var(--red);
}

.share-box {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

.share-steps {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.share-steps code {
  color: var(--text);
}

.share-url-row {
  display: grid;
  gap: 10px;
}

.share-actions {
  margin-top: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--red);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-kicker,
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.03em;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 28px;
  line-height: 1.25;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.tab,
.btn,
.text-btn {
  cursor: pointer;
  border: 0;
}

.tab {
  background: transparent;
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 999px;
}

.tab.is-active {
  background: #fff;
  color: #111;
}

.tab-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
}

.tab.is-active .tab-badge {
  background: var(--red);
}

.view {
  display: none;
}

.view.is-active {
  display: grid;
  gap: 18px;
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.lede,
.hint,
.empty {
  color: var(--muted);
}

.hint.warn {
  color: #fda4af;
}

.lede {
  max-width: 640px;
  line-height: 1.7;
}

.stack,
label {
  display: grid;
  gap: 8px;
}

.stack {
  gap: 16px;
  margin-top: 8px;
}

label {
  font-size: 13px;
  color: var(--muted);
}

input,
select {
  width: 100%;
  background: #0a0a0b;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(232, 33, 39, 0.7);
}

.grid-2,
.funnel-grid,
.stat-grid {
  display: grid;
  gap: 14px;
}

.grid-2 {
  grid-template-columns: 1fr 1fr;
}

.funnel-grid {
  grid-template-columns: repeat(4, 1fr);
}

.stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 18px;
}

.btn {
  border-radius: 999px;
  padding: 13px 20px;
  font-weight: 600;
}

.btn.primary {
  background: var(--red);
  color: #fff;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.danger {
  color: #fda4af;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.text-btn {
  margin-top: 16px;
  background: none;
  color: var(--muted);
  padding: 0;
}

.hidden {
  display: none !important;
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  margin: 14px 0 22px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 10%;
  background: var(--red);
}

.result-hero {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 20px;
  align-items: center;
  margin: 18px 0 8px;
}

.result-label {
  margin: 0;
  color: var(--muted);
}

.result-score {
  margin: 0;
  font-size: 84px;
  line-height: 0.9;
  letter-spacing: -0.06em;
}

.result-meaning {
  font-size: 22px;
  line-height: 1.45;
  margin: 0;
}

.kv {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 22px 0;
}

.kv-4 {
  grid-template-columns: repeat(4, 1fr);
}

.kv-5 {
  grid-template-columns: repeat(5, 1fr);
}

.kv-6 {
  grid-template-columns: repeat(3, 1fr);
}

.result-band {
  margin: 10px 0 0;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.choice-set {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 10px;
}

.choice-set legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
}

.result-choices {
  margin-bottom: 16px;
}

.order-check {
  margin-bottom: 4px;
}

.followup-box {
  margin-top: 16px;
  padding-top: 8px;
}

.so-note {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.so-note pre {
  margin: 10px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  line-height: 1.6;
}

.today-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.task-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.task-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #101012;
  display: grid;
  gap: 8px;
}

.task-card.is-overdue {
  border-color: rgba(232, 33, 39, 0.45);
}

.task-card h3 {
  margin: 0;
  font-size: 18px;
}

.task-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.overdue {
  color: #fda4af;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 30;
}

.modal-card {
  width: min(520px, 100%);
  background: #141416;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.kv div {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}

dt {
  color: var(--muted);
  font-size: 12px;
}

dd {
  margin: 6px 0 0;
  word-break: break-all;
}

a {
  color: #fff;
}

.toggle-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.check input {
  width: auto;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-btn {
  display: inline-flex;
  align-items: center;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(6, minmax(110px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.period-grid {
  grid-template-columns: repeat(5, 1fr);
  margin: 16px 0 0;
}

.inline-form {
  display: flex;
  gap: 10px;
  margin: 16px 0;
}

.inline-form input {
  flex: 1;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.chip button {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #fff;
  color: #111;
  padding: 12px 16px;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 20;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 500;
}

.compact th,
.compact td {
  text-align: center;
  padding: 10px 6px;
  font-size: 13px;
}

.compact th:first-child,
.compact td:first-child {
  text-align: left;
}

.hot-pill,
.band-pill,
.rate-cell {
  display: inline-flex;
  min-width: 34px;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(232, 33, 39, 0.16);
}

.band-A {
  background: rgba(232, 33, 39, 0.28);
}

.band-B {
  background: rgba(249, 115, 22, 0.22);
}

.band-C {
  background: rgba(234, 179, 8, 0.18);
}

.band-D {
  background: rgba(161, 161, 170, 0.18);
}

.lost-pill {
  background: rgba(161, 161, 170, 0.22);
  color: #d4d4d8;
}

td select {
  width: auto;
  min-width: 108px;
  padding: 7px 10px;
  border-radius: 10px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #101012;
}

.stat strong {
  display: block;
  font-size: 32px;
  letter-spacing: -0.04em;
  margin-top: 6px;
}

.empty {
  display: none;
  margin: 18px 0 0;
}

.empty.is-visible {
  display: block;
}

@media (max-width: 800px) {
  h2 {
    font-size: 24px;
  }

  .grid-2,
  .funnel-grid,
  .filter-grid,
  .period-grid,
  .today-grid,
  .result-hero,
  .kv,
  .kv-4,
  .kv-5,
  .kv-6,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .inline-form {
    display: grid;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .result-score {
    font-size: 64px;
  }
}
