:root {
  color-scheme: light;
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #eef6f4;
  --ink: #16211f;
  --muted: #5c6d69;
  --line: #d7e1de;
  --brand: #1c756b;
  --brand-dark: #0f504b;
  --accent: #b8472e;
  --focus: #155eef;
  --implemented: #166534;
  --review: #9a3412;
  --draft: #475569;
  --planned: #6d28d9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding-bottom: 88px;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
}

button,
input {
  font: inherit;
}

.app-header {
  display: grid;
  gap: 16px;
  padding: 24px 18px 18px;
  background: linear-gradient(135deg, #fff 0%, #e9f4f2 100%);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
}

h1 {
  font-size: clamp(1.75rem, 8vw, 2.7rem);
}

h2 {
  font-size: 1.45rem;
}

h3 {
  font-size: 1.05rem;
}

.version {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.profile-panel {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.profile-panel span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.intro,
.tool-start,
.text-panel {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.intro p,
.text-panel p {
  margin: 10px 0 0;
}

.tool-start {
  display: grid;
  gap: 16px;
  margin-bottom: 14px;
  border-color: color-mix(in srgb, var(--brand), var(--line) 70%);
  box-shadow: 0 10px 28px rgb(18 74 68 / 8%);
}

.tool-start h2 {
  font-size: clamp(1.7rem, 8vw, 2.5rem);
}

.home-search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.home-search input {
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  border: 2px solid color-mix(in srgb, var(--brand), var(--line) 58%);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
}

.quick-grid {
  display: grid;
  gap: 10px;
}

.quick-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 64px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--brand), var(--line) 62%);
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.quick-button strong {
  font-size: 1rem;
}

.quick-button span {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgb(255 255 255 / 18%);
  font-size: 0.72rem;
  font-weight: 800;
}

.compact-intro {
  margin-bottom: 22px;
}

.compact-intro p:first-child {
  margin-top: 0;
}

.about-details {
  margin-top: 12px;
}

.category-section {
  margin-top: 22px;
}

.category-section h2 {
  margin-bottom: 12px;
}

.menu-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.menu-button,
.back-button {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.menu-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
  text-align: left;
}

.menu-button strong {
  display: block;
  font-size: 1.05rem;
}

.menu-button span {
  color: var(--muted);
  font-size: 0.88rem;
}

.menu-button .count {
  min-width: 2.2rem;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--brand-dark);
  text-align: center;
  font-weight: 800;
}

.menu-button:hover,
.back-button:hover {
  border-color: var(--brand);
}

.menu-button:focus-visible,
.quick-button:focus-visible,
.search-result-card button:focus-visible,
.related-links button:focus-visible,
.back-button:focus-visible,
.search-box input:focus-visible,
.home-search input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus), transparent 70%);
  outline-offset: 2px;
}

.toolbar {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.back-button {
  padding: 0 16px;
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  font-weight: 800;
}

.search-box {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.search-box input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.card-list {
  display: grid;
  gap: 12px;
}

.guide-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: clip;
}

.card-header {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
}

.card-title-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.status {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.4;
}

.status.implemented {
  background: var(--implemented);
}

.status.review {
  background: var(--review);
}

.status.draft {
  background: var(--draft);
}

.status.planned {
  background: var(--planned);
}

.summary {
  margin: 10px 0 0;
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--brand-dark);
  font-size: 0.76rem;
  font-weight: 700;
}

.details-wrap {
  display: grid;
  gap: 8px;
  padding: 12px 14px 14px;
}

.navigator-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.navigator-block {
  display: grid;
  gap: 8px;
}

.navigator-block h4,
.adjustment-head h4,
.adjustment-detail h4 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.35;
}

.navigator-block > ul,
.adjustment-box ul,
.adjustment-detail ul {
  margin: 0;
  padding-left: 1.2rem;
}

.navigator-block > p,
.adjustment-detail p {
  margin: 0;
  color: var(--muted);
}

.adjustment-list {
  display: grid;
  gap: 6px;
}

.adjustment-table-head {
  display: none;
}

.mobile-recommendation-title {
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.92rem;
  font-weight: 900;
}

.desktop-info-block {
  display: none;
}

.mobile-info-block {
  border-color: color-mix(in srgb, var(--brand), var(--line) 72%);
  background: #fbfdfc;
}

.mobile-info-block summary {
  min-height: 42px;
  color: var(--brand-dark);
}

.navigator-card .card-header .summary {
  display: none;
}

.adjustment-card {
  display: block;
  padding: 7px 8px;
  border: 1px solid color-mix(in srgb, var(--brand), var(--line) 66%);
  border-radius: 8px;
  background: #fbfdfc;
}

.adjust-option-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.adjustment-cell {
  display: grid;
  gap: 6px;
}

.adjust-option-title {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.28;
}

.option-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 0.94rem;
  font-weight: 900;
}

.operation-level {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.operation-level.easy {
  background: #e8f5ef;
  color: #25634f;
}

.operation-level.conditional {
  background: #fff4d9;
  color: #795a00;
}

.operation-level.confirm {
  background: #eef2ff;
  color: #344c8a;
}

.operation-level.careful {
  background: #fff0e9;
  color: #8c3d1d;
}

.adjustment-box {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.adjustment-box strong {
  font-size: 0.8rem;
}

.effect-box {
  display: none;
}

.effect-box {
  border-color: #b9d9ce;
  background: #f3fbf8;
}

.effect-box strong {
  color: var(--implemented);
}

.downside-box {
  display: none;
  grid-column: 1 / -1;
  padding: 8px 10px;
  border-color: #efc0ad;
  background: #fff7f3;
}

.downside-box strong {
  color: var(--accent);
}

.downside-box li:nth-child(n+3) {
  display: none;
}

.protocol-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.adjust-option-detail-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  min-height: 32px;
  padding: 5px 9px;
  border: 0;
  min-width: 44px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.adjust-option-detail-panel {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  box-sizing: border-box;
  border-top: 1px solid var(--line);
}

.adjust-option-detail-panel[hidden] {
  display: none;
}

.adjustment-detail {
  display: grid;
  width: 100%;
  gap: 10px;
}

.adjustment-detail section {
  display: grid;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.adjustment-detail .detail-conclusion,
.adjustment-detail .detail-term-note {
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--brand), var(--line) 70%);
  border-radius: 8px;
  background: #f8fcfa;
}

.adjustment-detail .detail-conclusion {
  border-color: #b9d9ce;
}

.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.related-links button,
.related-links span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--brand), var(--line) 55%);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--brand-dark);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
}

.related-links span {
  background: #f8faf9;
  color: var(--muted);
}

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

details.section-effect {
  border-color: #b9d9ce;
  background: #f3fbf8;
}

details.section-side-effect {
  border-color: #efc0ad;
  background: #fff7f3;
}

details.section-caution {
  border-color: #e3d3a1;
  background: #fffbea;
}

details.section-memo {
  border-color: #c7d3e8;
  background: #f7faff;
}

summary {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 800;
}

.section-label {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.68rem;
  line-height: 1.4;
}

.section-effect .section-label {
  background: var(--implemented);
}

.section-side-effect .section-label {
  background: var(--accent);
}

.section-caution .section-label {
  background: #8a6400;
}

.section-memo .section-label {
  background: #315a9d;
}

.section-check .section-label {
  background: var(--brand-dark);
}

.detail-body {
  padding: 0 12px 12px;
}

.detail-body p {
  margin: 0;
}

.detail-body ul,
.text-panel ul {
  margin: 6px 0 0;
  padding-left: 1.2rem;
}

.review-note,
.empty-message {
  color: var(--muted);
  font-size: 0.9rem;
}

.home-search-results {
  display: grid;
  gap: 8px;
}

.search-result-card button {
  position: relative;
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 12px 74px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.search-result-card .result-meta {
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 800;
}

.search-result-card .status {
  position: absolute;
  top: 12px;
  right: 12px;
}

.search-result-card button > span:not(.status):not(.result-meta) {
  color: var(--muted);
  font-size: 0.86rem;
}

.guide-card.is-highlighted {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand), transparent 82%);
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: center;
  padding: 22px 18px;
  color: var(--muted);
  font-size: 0.82rem;
}

.floating-back-button {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  display: none;
  min-width: 96px;
  min-height: 52px;
  padding: 12px 18px;
  border: 1px solid color-mix(in srgb, var(--brand-dark), transparent 35%);
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 12px 28px rgb(15 80 75 / 24%);
  cursor: pointer;
  font-weight: 800;
}

.floating-back-button.is-visible {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.floating-back-button:hover {
  background: var(--brand-dark);
}

.floating-back-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus), transparent 60%);
  outline-offset: 3px;
}

@media (min-width: 720px) {
  .app-header {
    grid-template-columns: 1fr minmax(280px, 390px);
    align-items: end;
    padding: 32px;
  }

  main {
    padding: 24px;
  }

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

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

  .card-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .navigator-card {
    grid-column: 1 / -1;
  }

  .desktop-info-block {
    display: block;
  }

  .mobile-info-block {
    display: none;
  }

  .navigator-card .card-header .summary {
    display: block;
  }

  .mobile-recommendation-title {
    display: none;
  }

  .adjustment-table-head,
  .adjustment-card {
    grid-template-columns: minmax(170px, 1.25fr) minmax(96px, 0.65fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(100px, 0.65fr);
    align-items: stretch;
  }

  .adjustment-table-head {
    display: grid;
    gap: 8px;
    padding: 0 12px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
  }

  .adjustment-card {
    display: grid;
    gap: 8px;
    padding: 12px;
  }

  .adjust-option-row {
    display: contents;
  }

  .option-order {
    display: none;
  }

  .effect-box {
    display: grid;
  }

  .downside-box {
    display: grid;
  }

  .downside-box {
    padding: 10px;
  }

  .downside-box li:nth-child(n+3) {
    display: list-item;
  }

  .adjustment-cell {
    min-width: 0;
  }

  .adjust-option-title,
  .adjust-option-priority {
    grid-row: 1;
    padding: 10px 0;
  }

  .adjust-option-title {
    grid-column: 1;
  }

  .adjust-option-detail-button {
    grid-column: 5;
    grid-row: 1;
    align-self: start;
    min-height: 42px;
    padding: 8px 10px;
    width: auto;
  }

  .effect-box {
    grid-column: 3;
    grid-row: 1;
  }

  .downside-box {
    grid-column: 4;
    grid-row: 1;
  }

  .adjust-option-priority {
    grid-column: 2;
  }

  .adjust-option-detail-panel {
    grid-column: 1 / -1;
    width: auto;
    margin-top: 4px;
  }

  .adjustment-detail {
    width: 100%;
  }
}
