:root {
  color-scheme: light;
  --bg: #eef4f1;
  --card: rgba(255, 255, 255, 0.92);
  --card-strong: #ffffff;
  --line: #d5e1da;
  --line-strong: #b7c8c0;
  --text: #173228;
  --muted: #5c756a;
  --brand: #0d7a54;
  --brand-strong: #075e40;
  --accent: #f0b429;
  --ok-bg: #e5f6ed;
  --ok-line: #3f9a63;
  --warn-bg: #fff6dd;
  --warn-line: #c99714;
  --error-bg: #fde8e8;
  --error-line: #d64545;
  --na-bg: #eef3f8;
  --na-line: #7a8da4;
  --shadow: 0 24px 50px rgba(24, 48, 39, 0.08);
  --radius: 22px;
  --font: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(28, 124, 92, 0.16), transparent 28%),
    linear-gradient(180deg, #f6fbf8 0%, var(--bg) 100%);
  color: var(--text);
  font-family: var(--font);
}

body {
  padding: 24px;
}

button,
input,
select {
  font: inherit;
}

.app-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 8%, rgba(13, 122, 84, 0.08), transparent 22%),
    radial-gradient(circle at 92% 22%, rgba(240, 180, 41, 0.12), transparent 20%);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  max-width: 1600px;
  margin: 0 auto;
}

.card,
.hero-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 320px;
  gap: 20px;
  padding: 24px;
  align-items: center;
}

.hero-mascot {
  display: grid;
  place-items: center;
  min-height: 120px;
  overflow: hidden;
  border-radius: 28px;
  background: linear-gradient(145deg, #ffffff 0%, #e5f5ed 100%);
  border: 1px solid rgba(13, 122, 84, 0.12);
}

.hero-mascot img {
  display: block;
  width: 132px;
  height: 132px;
  object-fit: contain;
}

.hero-kicker {
  margin: 0 0 8px;
  color: var(--brand-strong);
  font-size: 0.96rem;
  font-weight: 700;
}

.hero-copy h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.08;
}

.hero-note,
.hero-status-label,
.app-message,
.section-head p,
.drop-subtitle {
  color: var(--muted);
}

.hero-note {
  margin: 0;
  line-height: 1.7;
}

.hero-status {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(13, 122, 84, 0.05);
  border: 1px solid rgba(13, 122, 84, 0.12);
}

.hero-status-label {
  margin: 0;
  font-size: 0.92rem;
}

.runtime-status {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.runtime-status.is-loading {
  color: #8d6200;
}

.runtime-status.is-ready {
  color: var(--brand);
}

.runtime-status.is-error {
  color: var(--error-line);
}

.app-message {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.upload-card,
.result-card,
.detail-card,
.source-card {
  padding: 20px;
}

.upload-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 220px;
  font-size: 0.95rem;
  font-weight: 700;
}

.field select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
}

.action,
.mini-action,
.tab-button,
.overview-card,
.drop-zone {
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.action,
.mini-action {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.action:hover,
.mini-action:hover,
.tab-button:hover,
.overview-card:hover,
.drop-zone:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(18, 45, 36, 0.08);
}

.action.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand) 0%, #14a06d 100%);
  color: #fff;
  font-weight: 700;
}

.action.ghost {
  background: rgba(255, 255, 255, 0.45);
}

.drop-zone {
  display: grid;
  gap: 8px;
  justify-items: center;
  margin-top: 18px;
  padding: 32px 20px;
  border: 2px dashed rgba(13, 122, 84, 0.28);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(236, 247, 241, 0.92));
  text-align: center;
  cursor: pointer;
}

.drop-zone.is-over {
  border-color: var(--brand);
  background:
    linear-gradient(180deg, rgba(233, 248, 240, 0.98), rgba(223, 244, 234, 0.98));
}

.drop-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.drop-subtitle {
  margin: 0;
}

.file-list-block {
  margin-top: 16px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.section-head.compact h2,
.section-head.compact p {
  margin: 0;
}

.section-head h2 {
  font-size: 1.15rem;
}

.file-list {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.file-item,
.empty-list {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
}

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

.file-meta {
  display: grid;
  gap: 4px;
}

.file-name {
  font-weight: 700;
  word-break: break-all;
}

.file-size {
  font-size: 0.9rem;
  color: var(--muted);
}

.file-remove {
  padding: 8px 12px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.overview-card {
  display: grid;
  gap: 10px;
  min-height: 140px;
  padding: 18px;
  border: 1px solid transparent;
  border-radius: 24px;
  text-align: left;
  cursor: pointer;
}

.overview-card .card-title {
  font-size: 1rem;
  font-weight: 700;
}

.overview-card .card-value {
  font-size: clamp(1.15rem, 2vw, 1.7rem);
  font-weight: 800;
  line-height: 1.35;
}

.tone-ok {
  background: linear-gradient(180deg, var(--ok-bg), #f9fffb);
  border-color: rgba(63, 154, 99, 0.2);
}

.tone-warn {
  background: linear-gradient(180deg, var(--warn-bg), #fffdf5);
  border-color: rgba(201, 151, 20, 0.2);
}

.tone-error {
  background: linear-gradient(180deg, var(--error-bg), #fff9f9);
  border-color: rgba(214, 69, 69, 0.2);
}

.tone-na {
  background: linear-gradient(180deg, var(--na-bg), #fbfdff);
  border-color: rgba(122, 141, 164, 0.18);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(360px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.result-head {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tab-button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  cursor: pointer;
}

.tab-button.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand) 0%, #149a6a 100%);
  color: #fff;
  font-weight: 700;
}

.table-panel {
  min-height: 520px;
}

.empty-panel {
  display: grid;
  place-items: center;
  min-height: 420px;
  border: 1px dashed var(--line-strong);
  border-radius: 20px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.result-table th,
.result-table td {
  padding: 12px 12px;
  border-bottom: 1px solid rgba(213, 225, 218, 0.9);
  vertical-align: top;
  text-align: left;
  font-size: 0.94rem;
}

.result-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7fbf9;
  color: var(--brand-strong);
  font-size: 0.88rem;
  white-space: nowrap;
}

.result-table tr {
  cursor: pointer;
}

.result-table tr:hover {
  background: rgba(13, 122, 84, 0.05);
}

.row-tone-ok {
  background: rgba(229, 246, 237, 0.5);
}

.row-tone-warn {
  background: rgba(255, 246, 221, 0.55);
}

.row-tone-error {
  background: rgba(253, 232, 232, 0.6);
}

.row-tone-na {
  background: rgba(238, 243, 248, 0.55);
}

.row-selected {
  outline: 2px solid rgba(13, 122, 84, 0.36);
  outline-offset: -2px;
}

.inspector-grid {
  display: grid;
  gap: 18px;
}

.detail-panel,
.source-panel {
  min-height: 250px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
}

.detail-panel {
  padding: 16px;
  font-size: 1.05rem;
  line-height: 1.7;
}

.detail-section + .detail-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.detail-section h3 {
  margin: 0 0 10px;
  font-size: 1.12rem;
}

.headline-list,
.note-list {
  display: grid;
  gap: 10px;
}

.headline-item,
.note-item {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  line-height: 1.65;
}

.headline-item.error {
  border-color: rgba(214, 69, 69, 0.28);
  background: rgba(253, 232, 232, 0.72);
}

.headline-item.warn {
  border-color: rgba(201, 151, 20, 0.26);
  background: rgba(255, 246, 221, 0.8);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.badge.ok {
  background: var(--ok-bg);
  color: var(--ok-line);
}

.badge.warn {
  background: var(--warn-bg);
  color: var(--warn-line);
}

.badge.error {
  background: var(--error-bg);
  color: var(--error-line);
}

.badge.na {
  background: var(--na-bg);
  color: var(--na-line);
}

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

.detail-field {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(250, 252, 251, 0.95);
}

.detail-field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.84rem;
  color: var(--muted);
}

.detail-field-value {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.55;
  word-break: break-word;
}

.instruction-header {
  padding: 4px 2px;
}

.instruction-heading,
.coordinate-section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.instruction-heading h3,
.coordinate-section-head h3 {
  margin: 0;
  font-size: 1.35rem;
}

.instruction-kicker {
  margin: 0 0 5px;
  color: var(--brand-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

.instruction-summary {
  margin: 12px 0;
  font-weight: 700;
}

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

.instruction-metric {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdfc;
}

.instruction-metric span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.instruction-metric strong {
  color: var(--text);
  font-size: 1.18rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.instruction-metric.important {
  border-color: rgba(13, 122, 84, 0.24);
  background: linear-gradient(145deg, #effaf4 0%, #ffffff 100%);
}

.instruction-metric.important strong {
  color: var(--brand-strong);
  font-size: 1.32rem;
}

.instruction-metric.range strong {
  font-family: "Consolas", "Yu Gothic UI", "Meiryo", monospace;
}

.instruction-subnote,
.coordinate-help {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.symmetry-result {
  margin-bottom: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(13, 122, 84, 0.22);
  border-radius: 14px;
  background: var(--ok-bg);
  color: var(--brand-strong);
  font-size: 1.18rem;
  font-weight: 800;
}

.coordinate-section-head span {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--na-bg);
  color: var(--na-line);
  font-size: 0.9rem;
  font-weight: 700;
}

.coordinate-list {
  display: grid;
  gap: 8px;
  max-height: 500px;
  margin-top: 12px;
  overflow: auto;
}

.coordinate-row {
  display: grid;
  grid-template-columns: 88px minmax(150px, 1fr) minmax(120px, auto);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-family: "Consolas", "Yu Gothic UI", "Meiryo", monospace;
  text-align: left;
  cursor: pointer;
}

.coordinate-row:hover,
.coordinate-row.selected {
  border-color: var(--brand);
  background: #effaf4;
}

.coordinate-row span {
  color: var(--muted);
  font-size: 0.86rem;
}

.coordinate-row strong {
  font-size: 1.02rem;
}

.instruction-empty {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.safety-footer {
  padding: 14px 18px;
  border: 1px solid rgba(201, 151, 20, 0.3);
  border-radius: 16px;
  background: rgba(255, 246, 221, 0.88);
  color: #765a0a;
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.65;
}

.source-panel {
  padding: 0;
  overflow: auto;
}

.source-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--muted);
}

.source-view {
  display: grid;
  min-width: 100%;
}

.source-line {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 7px 14px;
  border-bottom: 1px solid rgba(213, 225, 218, 0.5);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.source-line-number {
  color: var(--muted);
  text-align: right;
  user-select: none;
}

.source-line.hit {
  background: rgba(255, 246, 221, 0.5);
}

.source-line.focus {
  background: rgba(253, 232, 232, 0.74);
}

.source-file-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 251, 249, 0.9);
  font-weight: 700;
}

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

@media (max-width: 1200px) {
  .hero-card,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  body {
    padding: 14px;
  }

  .hero-card {
    padding: 18px;
  }

  .hero-mascot {
    min-height: 84px;
  }

  .hero-mascot img {
    width: 112px;
    height: 112px;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid-list {
    grid-template-columns: 1fr;
  }

  .instruction-grid,
  .instruction-checks {
    grid-template-columns: 1fr;
  }

  .coordinate-row {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .coordinate-row > :last-child {
    grid-column: 2;
  }

  .source-line {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
  }
}
