:root {
  --bg: #eef1f8;
  --bg-desk: radial-gradient(900px 420px at 0% 0%, #c7d2fe 0%, transparent 55%),
    radial-gradient(700px 380px at 100% 10%, #e0e7ff 0%, transparent 50%),
    #eef1f8;
  --ink: #111827;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent2: #818cf8;
  --card: #fff;
  --line: #e5e7eb;
  --focus: #312e81;
  --radius: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-x: clip;
  max-width: 100%;
}

body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    "Yu Gothic UI", sans-serif;
  background: var(--bg-desk);
  color: var(--ink);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: clip;
  max-width: 100%;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #fff;
  padding: 8px 12px;
  z-index: 100;
}
.skip:focus {
  left: 8px;
  top: 8px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  max-width: min(960px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  overflow-x: clip;
  width: 100%;
}

.desk-head {
  background: linear-gradient(135deg, #312e81, #4f46e5);
  color: #fff;
  padding: 24px 20px 20px;
  position: relative;
  overflow: hidden;
}
.desk-head::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 180px;
  height: 180px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  transform: rotate(18deg);
}
.desk-head h1 {
  font-size: clamp(1.2rem, 3vw, 1.45rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  position: relative;
  z-index: 1;
}
.desk-head p {
  margin-top: 6px;
  font-size: 0.88rem;
  opacity: 0.9;
  max-width: 520px;
  position: relative;
  z-index: 1;
}
.desk-meta {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  font-size: 0.75rem;
  opacity: 0.9;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.desk-meta span {
  background: rgba(255, 255, 255, 0.12);
  padding: 6px 10px;
  border-radius: 8px;
}

.main {
  padding: 16px;
  display: grid;
  gap: 14px;
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
}
@media (min-width: 720px) {
  .main {
    grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
    align-items: start;
  }
  #resultView {
    grid-column: 2;
    min-width: 0;
    max-width: 100%;
  }
  #inputView {
    display: contents;
  }
  #inputView .input-panel {
    grid-column: 1;
    position: sticky;
    top: 12px;
    min-width: 0;
  }
  #deskPlaceholder {
    grid-column: 2;
    min-width: 0;
  }
}

.view[hidden] {
  display: none !important;
}

.input-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 2px 12px rgba(79, 70, 229, 0.06);
}
.input-panel h2 {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 12px;
}
.q {
  margin-bottom: 14px;
}
.q label,
.q .field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #374151;
}
.q select {
  width: 100%;
  padding: 9px 10px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
  min-height: 44px;
  background: #fff;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  padding: 8px 12px;
  min-height: 40px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  background: #fafafa;
  transition: 0.12s border-color, 0.12s background, 0.12s color;
  font: inherit;
  color: inherit;
}
.chip:hover {
  border-color: var(--accent2);
}
.chip.on {
  border-color: var(--accent);
  background: #eef2ff;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.chip.on::before {
  content: "✓ ";
  font-weight: 800;
}

.err {
  color: #dc2626;
  font-size: 0.82rem;
  font-weight: 600;
  margin: 6px 0;
  min-height: 1.1em;
}
.btn-eval {
  width: 100%;
  padding: 12px;
  min-height: 48px;
  margin-top: 6px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
}
.btn-eval:hover {
  background: #4338ca;
}

#factsBanner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
}
#factsBanner[hidden] {
  display: none !important;
}

.placeholder {
  background: var(--card);
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.placeholder svg {
  width: 80px;
  height: 60px;
  margin-bottom: 12px;
  opacity: 0.55;
}

.back-link {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 10px;
  display: inline-block;
  min-height: 40px;
  padding: 6px 0;
}

.verdict {
  background: var(--card);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
}
.verdict .badge {
  display: inline-block;
  background: #eef2ff;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 99px;
  margin-bottom: 8px;
}
.verdict h2 {
  font-size: 1.1rem;
  font-weight: 900;
}
.verdict p {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.cols {
  display: grid;
  gap: 12px;
}
@media (min-width: 600px) {
  .cols-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}
.card.block {
  margin-top: 12px;
}
.card h3 {
  font-size: 0.88rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: #374151;
}
.card ul {
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: 1.1rem;
}
.card li {
  margin: 4px 0;
}

.tool {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-top: 8px;
}
.tool.win {
  border-color: var(--accent);
  background: #fafafe;
}
.tool h4 {
  font-weight: 900;
  font-size: 0.95rem;
}
.badge-sm {
  display: inline-block;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
  margin-bottom: 6px;
}
.badge-sm.secondary {
  background: #f3f4f6;
  color: #4b5563;
}
.candidate-reason {
  margin: 8px 0;
  font-size: 0.84rem;
  color: #3730a3;
  background: #eef2ff;
  border-left: 3px solid var(--accent);
  padding: 8px 10px;
}
.tool .row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.8rem;
}
.tool .tag {
  background: #f3f4f6;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
  word-break: break-word;
}
.tool .price {
  color: var(--accent);
  font-weight: 800;
  margin-top: 8px;
  font-size: 0.88rem;
  word-break: break-word;
}
.tool .meta {
  font-size: 0.84rem;
  color: var(--muted);
  margin-top: 6px;
  word-break: break-word;
}
.tool-note {
  margin-top: 8px;
  font-size: 0.78rem;
  color: #6b7280;
  background: #f9fafb;
  padding: 8px;
  border-radius: 8px;
}
.ext-cta {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--accent);
  display: inline-block;
  margin-top: 8px;
  min-height: 44px;
  padding: 8px 0;
}

.flow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
  font-size: 0.78rem;
}
.flow-box {
  flex: 1 1 140px;
  min-width: 0;
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  overflow-wrap: anywhere;
}
.flow-box.after {
  border-color: var(--accent);
  background: #eef2ff;
}
.flow-arrow {
  color: var(--accent);
  font-weight: 900;
  font-size: 1.2rem;
  flex: 0 0 auto;
}

.table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.compare-mini {
  width: max(100%, 22rem);
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 8px;
}
@media (max-width: 480px) {
  .compare-mini {
    font-size: 0.74rem;
  }
  .compare-mini th,
  .compare-mini td {
    padding: 6px;
  }
}
.compare-mini th,
.compare-mini td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}
.compare-mini th {
  background: #f9fafb;
  font-weight: 800;
}

.trade {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 12px;
  font-size: 0.85rem;
  color: #92400e;
  margin-top: 10px;
}
.checklist {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 12px;
  font-size: 0.85rem;
  margin-top: 10px;
}
.checklist ul {
  margin-top: 6px;
  margin-left: 1.1rem;
}
.disclaimer {
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 12px;
}

.site-footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.site-footer a {
  color: var(--accent);
  margin-right: 12px;
}

.legal-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 28px 16px 48px;
}
.legal-page h1 {
  font-size: 1.35rem;
  margin: 12px 0;
  color: #312e81;
}
.legal-page h2 {
  font-size: 1.05rem;
  margin: 20px 0 8px;
}
.legal-page ul {
  margin-left: 1.2rem;
}
