:root {
  --bg-sky: #eaf8ff;
  --bg-card: #ffffff;
  --bg-cream: #fffaf0;
  --text-main: #18243d;
  --text-body: #34445f;
  --text-muted: #6d7890;
  --navy: #302c67;
  --purple: #5a3bb3;
  --blue: #188dcc;
  --blue-dark: #0870aa;
  --green: #16b86d;
  --green-dark: #07884c;
  --yellow: #ffc62f;
  --orange: #f58233;
  --pink: #f34d75;
  --line: #dbeaf4;
  --header-height: 64px;
  --bottom-bar-height: 76px;
  --max-width: 760px;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-full: 999px;
  --font-family: "Noto Sans JP", "BIZ UDGothic", "Yu Gothic UI", "Yu Gothic", "Meiryo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --shadow-card: 0 10px 28px rgba(31, 93, 133, 0.09), 0 2px 5px rgba(31, 62, 87, 0.05);
}

html {
  scroll-behavior: smooth;
  background: #dff3fc;
}

html,
body {
  color: var(--text-body);
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100%;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(circle at 8% 7%, rgba(255, 204, 64, 0.23) 0 3px, transparent 4px),
    radial-gradient(circle at 93% 16%, rgba(65, 185, 239, 0.22) 0 4px, transparent 5px),
    linear-gradient(180deg, #ccefff 0, #effaff 280px, #f7fbfd 100%);
  background-size: 72px 72px, 96px 96px, auto;
  background-attachment: fixed;
}

button,
input {
  font: inherit;
}

button,
a,
summary {
  -webkit-tap-highlight-color: transparent;
}

.game-header {
  height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(143, 194, 219, 0.45);
  box-shadow: 0 4px 18px rgba(29, 94, 132, 0.08);
}

.header-inner {
  max-width: var(--max-width);
  padding: 0 14px;
  gap: 12px;
}

.game-logo-badge {
  min-width: 0;
  gap: 9px;
}

.brand-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 13px;
  border: 2px solid #ffc934;
  box-shadow: 0 3px 0 #da8d18, 0 6px 13px rgba(95, 53, 123, 0.2);
  object-fit: cover;
}

.brand-copy {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo-text {
  color: var(--navy);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.logo-subtag {
  flex: 0 0 auto;
  padding: 2px 7px;
  color: #ffffff;
  background: var(--purple);
  border: none;
  font-size: 10px;
  line-height: 1.6;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.play-3d-btn {
  height: 40px;
  padding: 0 15px;
  gap: 5px;
  background: linear-gradient(180deg, #28d98a 0%, var(--green) 100%);
  font-size: 13px;
  box-shadow: 0 4px 0 var(--green-dark), 0 8px 15px rgba(16, 166, 97, 0.22);
}

.play-3d-btn svg {
  width: 16px;
  height: 16px;
}

.game-main {
  max-width: var(--max-width);
  padding: calc(var(--header-height) + env(safe-area-inset-top, 0px) + 14px) 14px calc(var(--bottom-bar-height) + env(safe-area-inset-bottom, 0px) + 28px);
}

.tab-view {
  animation: viewIn 180ms ease-out;
}

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

@keyframes viewIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-hero-card {
  min-height: 116px;
  margin-bottom: 14px;
  padding: 18px 18px;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  position: relative;
}

.view-hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.62), rgba(255,255,255,0.16)),
    radial-gradient(circle at 88% 22%, rgba(255, 208, 63, 0.42), transparent 27%),
    linear-gradient(135deg, #e9f8ff, #f9f4ff);
}

.view-hero-card::after {
  content: "";
  position: absolute;
  width: 94px;
  height: 94px;
  right: -30px;
  bottom: -42px;
  border-radius: 28px;
  transform: rotate(18deg);
  background: rgba(255, 255, 255, 0.38);
  z-index: -1;
}

.hero-featured {
  min-height: 184px;
  align-items: flex-end;
  padding: 22px;
  background: #17375b url("guide-hero-v3.webp") 58% center / cover no-repeat;
  border: 3px solid #ffffff;
}

.hero-featured::before {
  z-index: -1;
  background: linear-gradient(90deg, rgba(28, 20, 70, 0.82) 0%, rgba(32, 33, 83, 0.56) 42%, rgba(27, 67, 91, 0.04) 78%);
}

.hero-featured::after {
  display: none;
}

.hero-featured .hero-text-col {
  max-width: 52%;
}

.view-hero-card:not(.hero-featured) .hero-text-col {
  max-width: 68%;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  margin-bottom: 7px;
  border-radius: var(--radius-full);
  color: #6d3d00;
  background: #ffd45e;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow: inset 0 -2px 0 rgba(173, 101, 0, 0.18);
}

.hero-text-col {
  position: relative;
  z-index: 2;
}

.hero-text-col h1 {
  margin: 0 0 3px;
  color: var(--navy);
  font-size: clamp(21px, 6vw, 27px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0;
}

.hero-text-col p {
  max-width: 430px;
  color: #536783;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.hero-featured .hero-text-col h1,
.hero-featured .hero-text-col p {
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(18, 26, 52, 0.45);
}

.hero-featured .hero-text-col h1 {
  font-size: clamp(25px, 8vw, 34px);
}

.hero-art {
  position: absolute;
  right: 14px;
  bottom: 10px;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  width: 38%;
  height: 92%;
}

.hero-art img {
  position: absolute;
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 7px 8px rgba(44, 36, 79, 0.18));
}

.hero-art img:nth-child(1) { right: 50px; bottom: 10px; transform: rotate(-8deg); }
.hero-art img:nth-child(2) { right: 7px; bottom: 28px; transform: rotate(7deg); }
.hero-art img:nth-child(3) { right: 28px; bottom: -4px; width: 56px; height: 56px; }

.pop-card {
  padding: 18px;
  margin-bottom: 14px;
  border: 1px solid rgba(214, 231, 241, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.card-header-bar {
  gap: 11px;
  margin-bottom: 13px;
  padding-bottom: 12px;
  border-bottom: 1px solid #edf2f6;
}

.card-bubble-badge {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  font-size: 17px;
  overflow: hidden;
  box-shadow: inset 0 -3px 0 rgba(26, 64, 89, 0.08);
}

.card-bubble-badge img {
  width: 31px;
  height: 31px;
  object-fit: contain;
}

.badge-cubes {
  background: linear-gradient(145deg, #ffffff, #eef8ff);
  border: 1px solid #d8eaf4;
}

.basic-color-cluster {
  display: grid;
  grid-template-columns: repeat(2, 18px);
  grid-template-rows: repeat(2, 18px);
  place-content: center;
  width: 36px;
  height: 36px;
}

.card-bubble-badge .basic-color-cluster img {
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 1px 1px rgba(56, 51, 94, 0.18));
}

.card-title-text {
  color: var(--text-main);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0;
}

.card-text {
  color: var(--text-body);
  font-size: 15px;
  line-height: 1.78;
}

.content-intro {
  margin: 0 2px 14px;
  padding: 13px 15px;
  color: #365474;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(186, 219, 236, 0.82);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
}

.rule-highlight {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  margin-bottom: 14px;
  color: #383167;
  background: linear-gradient(135deg, #fff8d9, #fffdf3);
  border: 1px solid #f5df85;
  border-radius: var(--radius-md);
}

.cube-cluster {
  display: flex;
  flex: 0 0 auto;
}

.cube-cluster img {
  width: 40px;
  height: 40px;
  margin-left: -9px;
  object-fit: contain;
  filter: drop-shadow(0 3px 3px rgba(56, 51, 94, 0.18));
}

.cube-cluster img:first-child { margin-left: 0; }

.rule-highlight strong {
  display: block;
  color: #3d3078;
  font-size: 16px;
  line-height: 1.35;
}

.rule-highlight span {
  display: block;
  font-size: 12px;
  line-height: 1.5;
}

.guide-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: guide-step;
}

.guide-steps li {
  position: relative;
  padding: 12px 12px 12px 48px;
  color: var(--text-body);
  background: #f7fbfd;
  border: 1px solid #e5eff5;
  border-radius: 15px;
  font-size: 14px;
  line-height: 1.65;
  counter-increment: guide-step;
}

.guide-steps li::before {
  content: counter(guide-step);
  position: absolute;
  left: 12px;
  top: 12px;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  color: #ffffff;
  background: linear-gradient(180deg, #4cbaf0, var(--blue));
  border-radius: 9px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 2px 0 var(--blue-dark);
}

.captain-tip {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding: 12px 13px;
  color: #594210;
  background: #fff7d6;
  border: 1px dashed #eebd42;
  border-radius: 15px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.58;
}

.captain-tip img {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
}

.booster-showcase,
.resource-showcase {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 14px;
}

.resource-showcase {
  grid-template-columns: repeat(3, 1fr);
}

.booster-chip,
.resource-chip {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
  padding: 8px;
  color: #39315f;
  background: #faf8ff;
  border: 1px solid #ebe4fb;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 900;
}

.resource-chip {
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 7px 4px;
  line-height: 1.35;
  text-align: center;
}

.booster-chip img,
.resource-chip img {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  object-fit: contain;
}

.game-notice-pill {
  padding: 12px 14px;
  color: #2e5272;
  background: #fff8db;
  border: 1px solid #f1d875;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.58;
}

.notice-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  color: #ffffff;
  background: #eea92f;
  border-radius: 9px;
  font-size: 14px;
}

.accordion-list {
  gap: 9px;
}

.pop-accordion {
  border: 1px solid #dce8ef;
  border-radius: 15px;
  box-shadow: 0 2px 7px rgba(43, 89, 118, 0.04);
}

.pop-accordion[open] {
  border-color: #7bc9ee;
  box-shadow: 0 6px 18px rgba(24, 141, 204, 0.12);
}

.pop-accordion-header {
  min-height: 54px;
  padding: 13px 14px;
  gap: 12px;
  color: #26354e;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
}

.pop-accordion-header::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  background: var(--yellow);
  border-radius: 3px;
  box-shadow: 0 2px 0 #d48b16;
}

.pop-accordion-header > span {
  flex: 1;
}

.item-icon-accordion .pop-accordion-header::before {
  display: none;
}

.element-item .pop-accordion-header::before {
  display: none;
}

.element-list-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px rgba(71, 57, 99, 0.14));
}

.event-list-thumb {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  object-fit: contain;
  background: #f7fbfd;
  border: 1px solid rgba(184, 215, 230, 0.9);
  border-radius: 10px;
  box-shadow: 0 3px 7px rgba(49, 82, 114, 0.14);
}

.event-feature-image {
  display: block;
  width: min(100%, 360px);
  height: auto;
  margin: 0 0 13px;
  object-fit: contain;
  background: #f7fbfd;
  border: 1px solid #dce8ef;
  border-radius: 14px;
  box-shadow: 0 5px 14px rgba(43, 89, 118, 0.1);
}

.event-unlock-level {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 0 0 10px;
  padding: 4px 10px;
  border: 1px solid #f4bd3e;
  border-radius: 999px;
  color: #704200;
  background: #fff3bf;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.pop-accordion-header > span {
  min-width: 0;
}

.accordion-leading-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px rgba(71, 57, 99, 0.14));
}

.pop-chevron {
  width: 18px;
  height: 18px;
  padding: 2px;
  color: #71829a;
  background: #eef4f7;
  border-radius: 50%;
}

.pop-accordion[open] .pop-chevron {
  color: #ffffff;
  background: var(--blue);
}

.pop-accordion-content {
  padding: 14px 15px 16px 35px;
  color: #43516a;
  background: #f7fbfd;
  border-top: 1px solid #e6f0f5;
  font-size: 14.5px;
  line-height: 1.75;
}

.search-pop-wrapper {
  top: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  margin: 0 -5px 12px;
  padding: 8px 5px 10px;
  background: rgba(235, 248, 254, 0.93);
  border-radius: 0 0 18px 18px;
}

.search-input-box {
  margin-bottom: 7px;
}

.search-input-elem {
  height: 50px;
  padding: 0 44px 0 43px;
  color: var(--text-main);
  background: #ffffff;
  border: 1px solid #bcddeb;
  box-shadow: 0 6px 18px rgba(31, 119, 165, 0.1);
}

.search-input-elem:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(35, 153, 213, 0.15), 0 7px 18px rgba(31, 119, 165, 0.1);
}

.search-clear-cross {
  right: 9px;
  width: 32px;
  height: 32px;
  color: #ffffff;
  background: #71829a;
}

.search-status-bar {
  padding: 0 3px;
  color: #3d5975;
}

.batch-pop-btn {
  min-height: 32px;
  padding: 4px 10px;
  color: #315873;
  background: #ffffff;
  border: 1px solid #bedde9;
  box-shadow: none;
}

.no-results-pop {
  padding: 30px 16px;
  color: #68778e;
  background: rgba(255, 255, 255, 0.8);
  border: 1px dashed #9dcde2;
}

.game-bottom-bar {
  height: calc(var(--bottom-bar-height) + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid rgba(128, 178, 204, 0.52);
  box-shadow: 0 -8px 24px rgba(35, 84, 114, 0.1);
}

.tab-bar-inner {
  max-width: var(--max-width);
  padding: 6px 5px calc(env(safe-area-inset-bottom, 0px) + 5px);
  gap: 2px;
}

.game-tab-btn {
  position: relative;
  min-width: 0;
  min-height: 58px;
  gap: 2px;
  color: #68778e;
  border-radius: 15px;
}

.tab-icon-wrap {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 11px;
  transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.tab-icon-img {
  width: 27px;
  height: 27px;
  object-fit: contain;
  filter: saturate(0.78);
}

.tab-icon-svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 2px 2px rgba(73, 50, 92, 0.12));
}

.tab-icon-stack {
  position: relative;
}

.tab-icon-stack img {
  position: absolute;
  width: 19px;
  height: 19px;
  object-fit: contain;
  filter: drop-shadow(0 2px 2px rgba(55, 50, 86, 0.16));
}

.tab-icon-stack img:nth-child(1) { left: 1px; top: 2px; }
.tab-icon-stack img:nth-child(2) { right: 0; top: 1px; }
.tab-icon-stack img:nth-child(3) { left: 7px; bottom: 0; width: 17px; height: 17px; }

#tab-economy .tab-label {
  font-size: 8.5px;
  letter-spacing: 0;
}

.tab-label {
  max-width: 100%;
  overflow: hidden;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-tab-btn.active {
  color: var(--blue-dark);
}

.game-tab-btn.active::after {
  content: "";
  position: absolute;
  top: -7px;
  width: 27px;
  height: 3px;
  background: var(--blue);
  border-radius: 0 0 5px 5px;
}

.game-tab-btn.active .tab-icon-wrap {
  background: #e2f5ff;
  box-shadow: inset 0 -2px 0 #b4e2f6;
  transform: translateY(-2px) scale(1.04);
}

.game-tab-btn.active .tab-icon-img {
  filter: none;
}

:focus-visible {
  outline: 3px solid rgba(24, 141, 204, 0.45);
  outline-offset: 3px;
}

summary:focus-visible,
.game-tab-btn:focus-visible {
  outline-offset: -2px;
}

@media (min-width: 640px) {
  .game-main {
    padding-left: 20px;
    padding-right: 20px;
  }

  .view-hero-card {
    min-height: 136px;
    padding: 22px 24px;
  }

  .hero-featured {
    min-height: 288px;
    padding: 30px;
  }

  .hero-featured .hero-text-col {
    max-width: 54%;
  }

  .pop-card {
    padding: 22px;
  }

  .guide-steps {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 374px) {
  .header-inner {
    padding: 0 10px;
    gap: 8px;
  }

  .brand-avatar {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .logo-text { font-size: 14px; }
  .logo-subtag { display: none; }
  .play-3d-btn { padding: 0 12px; }
  .game-main { padding-left: 10px; padding-right: 10px; }
  .hero-featured .hero-text-col { max-width: 54%; }
  .hero-featured { background-position: 65% center; }
  .view-hero-card:not(.hero-featured) { min-height: 136px; }
  #view-economy .view-hero-card { min-height: 154px; }
  .narrow-title-line { display: block; }
  .view-hero-card:not(.hero-featured) .hero-text-col { max-width: 59%; }
  .hero-art img { width: 56px; height: 56px; }
  .hero-art img:nth-child(3) { width: 49px; height: 49px; }
  .booster-chip { flex-direction: column; gap: 2px; padding: 6px 3px; font-size: 10px; line-height: 1.35; text-align: center; }
  .booster-chip img { width: 31px; height: 31px; flex-basis: 31px; }
  .resource-chip { flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 10px; line-height: 1.35; text-align: center; }
  .resource-chip img { width: 31px; height: 31px; flex-basis: 31px; }
  .batch-pop-btn { padding-inline: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
