* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  font-family: Arial, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  color: #f7f4ec;
  background: #121415;
}

.home-root,
.home-root body {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

.home-page {
  overflow: auto;
  scroll-behavior: smooth;
  background:
    linear-gradient(rgba(12, 15, 17, 0.28), rgba(12, 15, 17, 0.92)),
    linear-gradient(135deg, #17251f 0%, #26313a 48%, #251b23 100%);
}

.home-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.home-hero {
  position: relative;
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: 56px clamp(20px, 5vw, 72px) 84px;
  overflow: hidden;
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(10, 12, 13, 0.9) 0%, rgba(10, 12, 13, 0.48) 48%, rgba(10, 12, 13, 0.16) 100%),
    radial-gradient(circle at 24% 42%, rgba(240, 195, 90, 0.22), transparent 28%),
    radial-gradient(circle at 76% 18%, rgba(120, 235, 255, 0.12), transparent 24%);
}

.city-preview {
  position: absolute;
  inset: 0;
  opacity: 0.92;
}

.map-grid {
  position: absolute;
  inset: -10vh -8vw;
  transform: rotate(-8deg) scale(1.08);
  background:
    linear-gradient(90deg, rgba(69, 102, 77, 0.86), rgba(64, 89, 98, 0.86)),
    repeating-linear-gradient(0deg, transparent 0 92px, rgba(255, 255, 255, 0.08) 92px 94px),
    repeating-linear-gradient(90deg, transparent 0 116px, rgba(255, 255, 255, 0.08) 116px 118px);
}

.road,
.building,
.task-dot,
.enemy-dot,
.player-dot {
  position: absolute;
  display: block;
}

.road {
  background: #20272b;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.06);
}

.road-v {
  top: 0;
  bottom: 0;
  width: 86px;
}

.road-h {
  left: 0;
  right: 0;
  height: 86px;
}

.road-v.one { left: 18%; }
.road-v.two { left: 48%; }
.road-v.three { left: 77%; }
.road-h.one { top: 20%; }
.road-h.two { top: 49%; }
.road-h.three { top: 76%; }

.building {
  width: 150px;
  height: 96px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(105, 92, 82, 0.82);
  box-shadow: 12px 16px 0 rgba(0, 0, 0, 0.18);
}

.building.b1 { left: 27%; top: 27%; }
.building.b2 { left: 62%; top: 29%; background: rgba(88, 112, 94, 0.82); }
.building.b3 { left: 33%; top: 62%; background: rgba(103, 114, 122, 0.82); }
.building.b4 { left: 68%; top: 61%; background: rgba(114, 87, 91, 0.82); }

.task-dot,
.enemy-dot,
.player-dot,
.item-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid #101214;
}

.task-dot {
  background: #ffd84f;
  box-shadow: 0 0 28px rgba(255, 216, 79, 0.8);
}

.enemy-dot {
  background: #ff4f58;
  box-shadow: 0 0 34px rgba(255, 79, 88, 0.78);
}

.player-dot {
  left: 49%;
  top: 51%;
  width: 26px;
  height: 26px;
  background: #ffffff;
  box-shadow: 0 0 34px rgba(255, 255, 255, 0.86);
}

.task-dot.t1 { left: 21%; top: 23%; }
.task-dot.t2 { left: 80%; top: 53%; }
.task-dot.t3 { left: 43%; top: 81%; }
.enemy-dot.e1 { left: 61%; top: 21%; }
.enemy-dot.e2 { left: 29%; top: 73%; }

.item-dot.speed-item {
  left: 55%;
  top: 68%;
  background: #51ee8d;
  box-shadow: 0 0 30px rgba(81, 238, 141, 0.82);
}

.item-dot.invisible-item {
  left: 72%;
  top: 39%;
  background: #78ebff;
  box-shadow: 0 0 30px rgba(120, 235, 255, 0.82);
}

.route-line {
  position: absolute;
  height: 7px;
  border-radius: 999px;
  background: rgba(240, 195, 90, 0.78);
  box-shadow: 0 0 24px rgba(240, 195, 90, 0.52);
  transform-origin: left center;
}

.route-line.r1 {
  left: 47%;
  top: 53%;
  width: 190px;
  transform: rotate(-26deg);
}

.route-line.r2 {
  left: 35%;
  top: 67%;
  width: 150px;
  transform: rotate(18deg);
}

.home-content {
  position: relative;
  z-index: 2;
  width: min(860px, 100%);
  padding: clamp(26px, 4vw, 48px);
  border-left: 4px solid #f0c35a;
  background:
    linear-gradient(90deg, rgba(12, 15, 17, 0.92), rgba(12, 15, 17, 0.58), rgba(12, 15, 17, 0.12)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

.home-logo {
  display: block;
  margin-top: 4px;
  color: #f0c35a;
  font-size: clamp(62px, 14vw, 154px);
  line-height: 0.86;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow:
    0 4px 0 rgba(18, 20, 21, 0.96),
    0 18px 42px rgba(0, 0, 0, 0.5),
    0 0 34px rgba(240, 195, 90, 0.26);
}

.home-title-strip {
  width: min(620px, 100%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
}

.home-title-strip span {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 14, 0.64);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.home-content h1 {
  max-width: 720px;
  margin: 18px 0;
  font-size: clamp(28px, 4.8vw, 56px);
  line-height: 1.04;
  letter-spacing: 0;
}

.home-content p {
  max-width: 620px;
  margin: 0;
  color: #eee5d8;
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.8;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 30px;
}

.difficulty-panel {
  margin-top: 28px;
}

.difficulty-title {
  display: block;
  margin-bottom: 10px;
  color: #f0c35a;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.difficulty-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(92px, 1fr));
  gap: 8px;
}

.difficulty-options a {
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.difficulty-options a:hover,
.difficulty-options a:focus-visible {
  border-color: rgba(240, 195, 90, 0.92);
  background: rgba(240, 195, 90, 0.22);
  transform: translateY(-2px);
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(240, 195, 90, 0.46), 0 14px 30px rgba(0, 0, 0, 0.24);
}

.difficulty-options strong {
  color: #ffffff;
  font-size: 14px;
}

.difficulty-options small {
  color: #cfc7ba;
  font-size: 12px;
  font-weight: 800;
}

.difficulty-note {
  margin: 14px 0 0;
  color: #d8d0c3;
  font-size: 14px;
  font-weight: 800;
}

.home-start-button {
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  padding: 0 28px;
  background: #f0c35a;
  color: #151311;
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.32);
}

.home-start-button:hover,
.home-start-button:focus-visible {
  background: #ffd976;
}

.home-actions span {
  color: #d8d0c3;
  font-size: 14px;
  font-weight: 800;
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 26px;
  z-index: 2;
  transform: translateX(-50%);
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0 18px;
  background: rgba(12, 15, 17, 0.68);
  color: #f7f4ec;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  backdrop-filter: blur(10px);
}

.scroll-cue::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: 10px;
  border-right: 2px solid #f0c35a;
  border-bottom: 2px solid #f0c35a;
  transform: rotate(45deg) translateY(-2px);
}

.home-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.home-info article {
  min-height: 150px;
  padding: 26px clamp(20px, 4vw, 38px);
  background: rgba(18, 20, 21, 0.88);
}

.home-info strong {
  display: block;
  margin-bottom: 10px;
  color: #f0c35a;
  font-size: 14px;
  text-transform: uppercase;
}

.home-info p {
  margin: 0;
  color: #ddd5c8;
  line-height: 1.7;
}

.rules-section {
  padding: clamp(42px, 7vw, 86px) clamp(20px, 5vw, 72px);
  background:
    linear-gradient(180deg, rgba(18, 20, 21, 0.94), rgba(24, 30, 30, 0.98)),
    repeating-linear-gradient(90deg, transparent 0 118px, rgba(255, 255, 255, 0.04) 118px 120px);
}

.rules-heading {
  max-width: 760px;
  margin-bottom: 28px;
}

.rules-heading h2 {
  margin: 6px 0 12px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

.rules-heading p {
  margin: 0;
  color: #ddd5c8;
  font-size: 17px;
  line-height: 1.7;
}

.rules-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.rules-list article {
  min-height: 250px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.065);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.22);
}

.rules-list span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 32px;
  border-radius: 6px;
  background: rgba(240, 195, 90, 0.18);
  color: #f0c35a;
  font-size: 13px;
  font-weight: 900;
}

.rules-list h3 {
  margin: 18px 0 10px;
  color: #ffffff;
  font-size: 19px;
  line-height: 1.35;
  letter-spacing: 0;
}

.rules-list p {
  margin: 0;
  color: #d8d0c3;
  font-size: 14px;
  line-height: 1.75;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #111;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
}

.hud {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.hud > div,
.panel,
.area-banner,
.start-card,
.win-screen > div,
#miniMap {
  background: rgba(12, 15, 17, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.start-screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(8, 11, 13, 0.38), rgba(8, 11, 13, 0.74)),
    radial-gradient(circle at 50% 18%, rgba(240, 195, 90, 0.18), transparent 42%);
}

.start-screen[hidden] {
  display: none;
}

.start-card {
  width: min(680px, 100%);
  border-radius: 8px;
  padding: 30px;
}

.start-card h1 {
  margin: 4px 0 10px;
  font-size: clamp(34px, 7vw, 64px);
  line-height: 1;
  letter-spacing: 0;
}

.start-lead {
  max-width: 560px;
  margin: 0 0 22px;
  color: #ece4d4;
  font-size: 17px;
  line-height: 1.7;
}

.start-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.start-grid > div {
  min-height: 112px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.07);
}

.start-grid strong {
  display: block;
  margin-bottom: 8px;
  color: #f0c35a;
  font-size: 14px;
}

.start-grid p {
  margin: 0;
  color: #ddd5c8;
  font-size: 14px;
  line-height: 1.6;
}

.start-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.start-controls span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.start-button {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  background: #f0c35a;
  color: #151311;
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

.start-button:hover,
.start-button:focus-visible {
  background: #ffd976;
}

.start-note {
  margin: 12px 0 0;
  color: #bbb2a5;
  font-size: 13px;
  text-align: center;
}

.area-banner {
  position: absolute;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 180px;
  border-radius: 8px;
  padding: 10px 18px;
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
  pointer-events: none;
}

.win-screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.34);
  pointer-events: auto;
}

.win-screen[hidden] {
  display: none;
}

.win-screen > div {
  width: min(440px, 100%);
  border-radius: 8px;
  padding: 32px;
  text-align: center;
}

.win-screen span {
  color: #f0c35a;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.win-screen h2 {
  margin: 8px 0;
  font-size: 56px;
  line-height: 1;
  letter-spacing: 0;
}

.win-screen p {
  margin: 0;
  color: #d8d0c3;
}

.continue-button {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  padding: 0 20px;
  background: #f0c35a;
  color: #151311;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.home-link-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font: inherit;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.end-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.continue-button:hover,
.home-link-button:hover {
  background: #ffd976;
  color: #151311;
}

.pause-screen h2 {
  color: #f0c35a;
}

.lose-screen h2 {
  color: #ff6b6b;
}

.hud > div {
  border-radius: 8px;
  padding: 12px 14px;
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: #f0c35a;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.hud strong {
  font-size: 18px;
}

.game-title {
  display: block;
  color: #f0c35a;
  font-size: 34px;
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.48);
}

.game-subtitle {
  display: block;
  margin-top: 4px;
  color: #f7f4ec;
  font-size: 13px;
  font-weight: 800;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.stats span,
.keys span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 800;
}

.stats span {
  min-width: 82px;
  padding: 0 10px;
}

.panel {
  position: absolute;
  left: 18px;
  bottom: 18px;
  width: min(380px, calc(100vw - 36px));
  border-radius: 8px;
  padding: 18px;
}

.panel h1 {
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: 0;
}

.panel p {
  margin: 0 0 16px;
  color: #d8d0c3;
  font-size: 14px;
  line-height: 1.7;
}

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

.keys span {
  min-width: 38px;
  padding: 0 10px;
}

#miniMap {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 220px;
  height: 220px;
  border-radius: 8px;
}

@media (max-width: 700px) {
  .home-hero {
    min-height: 100vh;
    padding: 32px 18px 76px;
  }

  .home-content {
    padding: 22px 18px;
  }

  .home-title-strip {
    grid-template-columns: 1fr;
  }

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

  .difficulty-options {
    grid-template-columns: 1fr;
  }

  .home-start-button {
    width: 100%;
  }

  .home-info {
    grid-template-columns: 1fr;
  }

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

  .rules-list article {
    min-height: auto;
  }

  .hud {
    align-items: flex-start;
  }

  .start-card {
    padding: 22px;
  }

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

  .hud strong,
  .panel h1 {
    font-size: 18px;
  }

  .stats span {
    min-width: 70px;
    font-size: 12px;
  }

  .panel {
    padding: 14px;
  }

  #miniMap {
    width: 150px;
    height: 150px;
  }
}
