:root {
  color-scheme: light;
  --ink: #152332;
  --muted: #657384;
  --navy: #102438;
  --navy-soft: #1b3b55;
  --line: #d8e0e7;
  --surface: #ffffff;
  --page: #edf2f6;
  --fish: #dceff7;
  --fish-ink: #176183;
  --veg: #e3f2e5;
  --veg-ink: #2f7042;
  --danger: #a93830;
  --danger-soft: #fff0ed;
  --route-soft: #fbf0e7;
  font-family: "BIZ UDPGothic", "Yu Gothic UI", "Meiryo", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(180deg, var(--navy) 0 180px, transparent 180px),
    var(--page);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-header,
main {
  width: min(1380px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  min-height: 142px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: white;
}

.material-header > div {
  display: grid;
  gap: 3px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #b9d6e6;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.45rem);
  letter-spacing: 0.04em;
}

main {
  padding-bottom: 56px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-card {
  min-height: 96px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 9px 28px rgb(18 39 57 / 0.08);
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.summary-card strong {
  display: block;
  margin-top: 5px;
  font-size: 1.75rem;
  line-height: 1;
}

.summary-card.accent {
  border-color: #efc5bf;
  background: var(--danger-soft);
}

.summary-card.accent strong {
  color: var(--danger);
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.search-box {
  flex: 1;
}

.search-box input {
  width: min(520px, 100%);
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid #bdc9d4;
  border-radius: 9px;
  color: var(--ink);
  background: #f8fafb;
}

.search-box input:focus,
.material-input:focus {
  outline: 3px solid rgb(35 123 166 / 0.22);
  border-color: #237ba6;
}

.filter-group {
  display: flex;
  gap: 7px;
}

.filter-button,
.quiet-button,
.danger-button {
  min-height: 40px;
  padding: 0 15px;
  border-radius: 9px;
  font-weight: 700;
}

.filter-button,
.quiet-button {
  border: 1px solid #bdc9d4;
  color: var(--ink);
  background: white;
}

.site-header .quiet-button {
  border-color: rgb(255 255 255 / 0.35);
  color: white;
  background: rgb(255 255 255 / 0.08);
}

.filter-button.is-active {
  border-color: var(--navy-soft);
  color: white;
  background: var(--navy-soft);
}

.save-status {
  margin: 11px 4px 8px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: right;
}

.materials-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 12px 34px rgb(18 39 57 / 0.07);
}

.table-header,
.material-row {
  display: grid;
  grid-template-columns:
    66px minmax(128px, 0.75fr) 68px
    72px 92px 76px 72px
    66px 66px minmax(240px, 1.55fr) 160px;
  align-items: center;
}

.table-header {
  min-height: 50px;
  color: white;
  background: var(--navy-soft);
  font-size: 0.83rem;
  font-weight: 700;
}

.table-header span,
.material-row > * {
  padding: 10px 8px;
}

.material-row {
  min-height: 62px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.material-row:last-child {
  border-bottom: 0;
}

.material-row:nth-child(even) {
  background: #f8fafb;
}

.material-row.route-limited {
  background: var(--route-soft);
}

.material-row.section-gap {
  margin-top: 18px;
  border-top: 8px solid var(--page);
}

.category {
  align-self: stretch;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.category.fish {
  color: var(--fish-ink);
  background: var(--fish);
}

.category.vegetable {
  color: var(--veg-ink);
  background: var(--veg);
}

.material-name {
  font-weight: 800;
}

.number-cell,
.owned-total,
.shortage {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.owned-total {
  font-weight: 800;
}

.route-inputs {
  display: contents;
}

.route-input-group {
  min-width: 0;
  display: grid;
  justify-items: center;
  padding: 10px 4px;
}

.route-name {
  display: none;
}

.material-input {
  width: 62px;
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid #aebdca;
  border-radius: 8px;
  color: var(--ink);
  background: white;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.shortage {
  color: var(--danger);
  font-weight: 800;
}

.shortage.is-complete {
  color: #35714a;
}

.locations {
  color: #47576a;
  line-height: 1.55;
}

.locations ul {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.locations li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-remainder {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #556779;
  background: #e8eef3;
  font-size: 0.72rem;
  font-weight: 700;
}

.screenshot-cell {
  min-height: 72px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #e7edf2;
}

.screenshot-cell img {
  width: 100%;
  height: 78px;
  display: block;
  object-fit: cover;
}

.screenshot-cell.is-empty {
  min-height: 0;
  background: transparent;
}

.empty-state {
  margin: 0;
  padding: 48px 24px;
  color: var(--muted);
  text-align: center;
}

dialog {
  width: min(420px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgb(0 0 0 / 0.3);
}

dialog::backdrop {
  background: rgb(10 24 36 / 0.62);
}

dialog form {
  padding: 24px;
}

dialog h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

dialog p {
  margin: 0 0 24px;
  color: var(--muted);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.danger-button {
  border: 1px solid #8e2d28;
  color: white;
  background: var(--danger);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Home */
.home-page {
  min-height: 100vh;
  background: var(--page);
}

.home-hero {
  min-height: 410px;
  color: white;
  background:
    radial-gradient(circle at 78% 18%, rgb(71 139 173 / 0.38), transparent 34%),
    linear-gradient(135deg, #0b1d2e 0%, var(--navy) 48%, #183d57 100%);
}

.home-nav,
.hero-copy,
.home-main,
.site-footer {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.home-nav {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgb(255 255 255 / 0.14);
}

.home-brand {
  color: white;
  font-weight: 800;
  text-decoration: none;
}

.home-brand {
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.hero-copy {
  padding-block: 68px 76px;
}

.hero-copy h1 {
  max-width: 1040px;
  margin: 0;
  font-size: clamp(2.15rem, 6vw, 4rem);
  line-height: 1.18;
}

.hero-description {
  max-width: 680px;
  margin: 20px 0 28px;
  color: #d8e7ef;
  font-size: clamp(0.96rem, 2vw, 1.08rem);
  line-height: 1.85;
}

.home-main {
  padding-block: 58px 72px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin: 3px 0 0;
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.section-heading > p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.section-kicker {
  margin: 0;
  color: #2876a0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}

.feature-card {
  position: relative;
  min-height: 242px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(18 39 57 / 0.06);
  text-decoration: none;
}

.feature-card h3 {
  margin: 18px 0 8px;
  font-size: 1.12rem;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.featured-card {
  border-color: #83afc6;
  box-shadow: 0 12px 32px rgb(24 78 108 / 0.12);
}

.featured-card:hover,
.featured-card:focus-visible {
  transform: translateY(-2px);
  border-color: #397e9f;
  box-shadow: 0 16px 36px rgb(24 78 108 / 0.16);
}

.card-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: var(--navy-soft);
  font-weight: 900;
}

.is-coming .card-icon {
  color: #53677a;
  background: #e7edf1;
}

.status-badge {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 5px 8px;
  border-radius: 999px;
  color: #637487;
  background: #eef2f5;
  font-size: 0.7rem;
  font-weight: 800;
}

.status-badge.is-live {
  color: #25603a;
  background: #e2f3e7;
}

.card-link {
  margin-top: auto;
  padding-top: 20px;
  color: #1d6c94;
  font-size: 0.86rem;
  font-weight: 800;
}

.site-footer {
  padding-block: 24px 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

.site-footer p {
  margin: 0;
}

/* Growth comparison */
.growth-page {
  min-height: 100vh;
}

.growth-header > div {
  display: grid;
  gap: 3px;
}

.growth-header > p {
  margin: 0;
  color: #d7e6ee;
  font-size: 0.86rem;
  font-weight: 700;
}

.growth-main {
  display: grid;
  gap: 22px;
}

.comparison-panel,
.growth-library {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 12px 34px rgb(18 39 57 / 0.07);
}

.growth-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.growth-section-heading h2 {
  margin: 3px 0 0;
  font-size: clamp(1.3rem, 3vw, 1.75rem);
}

.growth-guide {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 0.86rem;
}

.swap-button,
.pull-button,
.remove-growth-item {
  border-radius: 8px;
  font-weight: 800;
}

.swap-button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid #aebdca;
  color: var(--ink);
  background: #f7fafc;
}

.swap-button:hover,
.swap-button:focus-visible {
  border-color: #397e9f;
  background: #edf6fa;
}

.comparison-stack {
  display: grid;
  gap: 6px;
}

.comparison-card {
  overflow: hidden;
  border: 1px solid #cad5de;
  border-radius: 13px;
  background: #fbfcfd;
}

.growth-selection-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding: 6px 8px;
}

.growth-drop-zone {
  min-height: 60px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 8px 10px;
  border: 1px dashed #aebdca;
  border-radius: 10px;
  color: #6b7a88;
  background: #f2f6f8;
}

.growth-drop-zone > span {
  font-size: 0.7rem;
  font-weight: 800;
}

.growth-drop-zone > strong {
  font-size: 0.86rem;
}

.growth-drop-zone.has-item {
  border-style: solid;
  border-color: #9bb8c8;
  color: var(--ink);
  background: #edf6fa;
}

.growth-drop-zone.is-over {
  outline: 3px solid rgb(35 123 166 / 0.26);
  border-color: #237ba6;
  background: #e4f3fa;
}

.growth-drop-zone.is-disabled {
  border-color: #d4dce2;
  color: #8895a1;
  background: #f1f3f5;
}

.selected-growth-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: grab;
}

.selected-growth-item > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.selected-growth-item span,
.growth-list-row span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-growth-item strong,
.growth-list-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-growth-item.is-dragging,
.growth-list-row.is-dragging {
  opacity: 0.45;
}

.remove-growth-item {
  flex: none;
  padding: 6px 8px;
  border: 1px solid #d8aaa5;
  color: #8e2d28;
  background: white;
  font-size: 0.7rem;
}

.growth-stats-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(68px, 1fr));
  border-top: 1px solid var(--line);
  background: white;
}

.growth-stat {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 7px 5px 8px;
  border-right: 1px solid var(--line);
}

.growth-stat:last-child {
  border-right: 0;
}

.growth-stat span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.growth-stat strong {
  font-size: 1.04rem;
  font-variant-numeric: tabular-nums;
}

.growth-stat small {
  margin-left: 1px;
  font-size: 0.65rem;
}

.growth-status {
  min-height: 1.3em;
  margin: 10px 2px -4px;
  color: #2b6f91;
  font-size: 0.79rem;
  font-weight: 700;
}

.growth-library .growth-section-heading {
  margin-bottom: 15px;
}

.growth-lists {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.growth-list-column {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafb;
}

.growth-list-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px 8px;
}

.growth-list-title h3 {
  margin: 0;
  font-size: 1.02rem;
}

.growth-list-title-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.growth-list-title-actions > span {
  min-width: 28px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #526577;
  background: #e4ebf0;
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
}

.class-order-button {
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid #aebdca;
  border-radius: 7px;
  color: #36566d;
  background: white;
  font-size: 0.68rem;
  font-weight: 800;
}

.class-order-button:hover,
.class-order-button:focus-visible {
  border-color: #397e9f;
  color: white;
  background: #237ba6;
}

.growth-list-title-actions > .class-order-state {
  min-width: 54px;
}

.growth-list-title-actions > .class-order-state.is-active {
  color: #1c6489;
  background: #dceff7;
}

.growth-search {
  display: block;
  padding: 0 10px 10px;
}

.growth-search input {
  width: 100%;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid #bdc9d4;
  border-radius: 8px;
  color: var(--ink);
  background: white;
}

.growth-search input:focus {
  outline: 3px solid rgb(35 123 166 / 0.2);
  border-color: #237ba6;
}

.growth-list-scroll {
  max-height: 560px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  background: white;
}

.growth-list-row {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 9px 8px 12px;
  border-bottom: 1px solid #e1e7ec;
  cursor: grab;
}

.growth-list-row:last-child {
  border-bottom: 0;
}

.growth-list-row:hover {
  background: #f2f7fa;
}

.growth-list-row > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.growth-list-row strong {
  font-size: 0.86rem;
}

.pull-button {
  flex: none;
  min-width: 48px;
  min-height: 30px;
  padding: 0 7px;
  border: 1px solid #83afc6;
  color: #1c6489;
  background: #f3fafd;
  font-size: 0.67rem;
  letter-spacing: 0.04em;
}

.pull-button:hover,
.pull-button:focus-visible {
  color: white;
  background: #237ba6;
}

.growth-list-empty {
  margin: 0;
  padding: 28px 12px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

@media (max-width: 900px) {
  .site-header,
  main {
    width: min(100% - 20px, 720px);
  }

  .site-header {
    min-height: 132px;
  }

  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box input {
    width: 100%;
  }

  .table-header {
    display: none;
  }

  .material-row {
    grid-template-columns: 58px minmax(0, 1fr) 86px;
    grid-template-areas:
      "category name shortage"
      "category required total"
      "routes routes routes"
      "locations locations screenshot";
    align-items: center;
    padding: 0;
  }

  .category {
    grid-area: category;
  }

  .material-name {
    grid-area: name;
  }

  .number-cell.required {
    grid-area: required;
    padding-top: 0;
    color: var(--muted);
    text-align: left;
  }

  .number-cell.required::before {
    content: "必要 ";
  }

  .shortage {
    grid-area: shortage;
    padding-top: 0;
    text-align: right;
  }

  .owned-total {
    grid-area: total;
    padding-top: 0;
    text-align: right;
  }

  .owned-total::before {
    content: "合計 ";
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
  }

  .route-inputs {
    grid-area: routes;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 10px 8px 12px;
    border-top: 1px dashed #d4dde5;
  }

  .route-input-group {
    gap: 4px;
    padding: 0;
  }

  .route-name {
    display: block;
    min-height: 2.4em;
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.15;
    text-align: center;
  }

  .route-input-group .material-input {
    width: min(72px, 100%);
  }

  .shortage::before {
    content: "不足 ";
    font-size: 0.75rem;
  }

  .locations {
    grid-area: locations;
    align-self: stretch;
    border-top: 1px dashed #d4dde5;
    font-size: 0.84rem;
  }

  .screenshot-cell {
    grid-area: screenshot;
    align-self: stretch;
    padding: 9px 8px;
    border-top: 1px dashed #d4dde5;
  }

  .screenshot-cell {
    min-height: 64px;
  }

  .screenshot-cell img {
    height: 64px;
  }

  .screenshot-cell.is-empty {
    min-height: 0;
  }

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

  .growth-stats-grid {
    grid-template-columns: repeat(5, minmax(62px, 1fr));
  }

  .growth-stat:nth-child(5) {
    border-right: 0;
  }

  .growth-stat:nth-child(n + 6) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 560px) {
  body {
    background:
      linear-gradient(180deg, var(--navy) 0 156px, transparent 156px),
      var(--page);
  }

  .site-header {
    min-height: 126px;
  }

  .site-header .quiet-button {
    min-width: 90px;
    padding-inline: 10px;
    font-size: 0.8rem;
  }

  .eyebrow {
    display: none;
  }

  .summary {
    gap: 7px;
  }

  .summary-card {
    min-height: 82px;
    padding: 14px 12px;
  }

  .summary-card strong {
    font-size: 1.4rem;
  }

  .filter-button {
    flex: 1;
  }

  .save-status {
    text-align: left;
  }

  .home-hero {
    min-height: 390px;
  }

  .home-nav,
  .hero-copy,
  .home-main,
  .site-footer {
    width: min(100% - 24px, 520px);
  }

  .home-nav {
    min-height: 68px;
  }

  .home-brand {
    font-size: 0.9rem;
  }

  .hero-copy {
    padding-block: 54px 62px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

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

  .feature-card {
    min-height: 216px;
  }

  .growth-header {
    align-items: start;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
  }

  .comparison-panel,
  .growth-library {
    padding: 14px;
  }

  .growth-section-heading {
    align-items: start;
  }

  .growth-guide {
    line-height: 1.6;
  }

  .growth-selection-grid {
    grid-template-columns: 1fr;
  }

  .growth-stats-grid {
    grid-template-columns: repeat(3, minmax(62px, 1fr));
  }

  .growth-stat:nth-child(5) {
    border-right: 1px solid var(--line);
  }

  .growth-stat:nth-child(3n) {
    border-right: 0;
  }

  .growth-stat:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }

  .growth-lists {
    grid-template-columns: 1fr;
  }

  .growth-list-scroll {
    max-height: 430px;
  }

}
