:root {
  --ink: #173126;
  --ink-2: #23473a;
  --paper: #f7f6ec;
  --paper-2: #eef4e7;
  --panel: #fffefa;
  --line: #c8d5c8;
  --line-strong: #7f9d82;
  --muted: #65756d;
  --green: #145c3d;
  --green-2: #1f7652;
  --mint: #dfeee4;
  --gold: #b98a22;
  --gold-soft: #f2dfad;
  --blue: #315f8f;
  --red: #a63e34;
  --shadow: 0 7px 24px rgba(21, 71, 47, 0.11);
  --engrave: rgba(20, 92, 61, 0.055);
  font-family: "Leelawadee UI", Tahoma, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(30deg, var(--engrave) 12%, transparent 12.5%, transparent 87%, var(--engrave) 87.5%),
    linear-gradient(150deg, var(--engrave) 12%, transparent 12.5%, transparent 87%, var(--engrave) 87.5%),
    linear-gradient(90deg, rgba(185, 138, 34, 0.04) 1px, transparent 1px);
  background-size: 68px 118px, 68px 118px, 34px 34px;
  background-position: 0 0, 34px 59px, 0 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.5), transparent 22%, transparent 78%, rgba(255, 255, 255, 0.5)),
    repeating-linear-gradient(0deg, transparent 0 11px, rgba(20, 92, 61, 0.025) 12px);
  opacity: 0.72;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(185, 138, 34, 0.35);
  outline-offset: 3px;
}

.language-switch {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 20;
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid rgba(20, 92, 61, 0.26);
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.82);
  box-shadow: 0 8px 22px rgba(20, 68, 46, 0.12);
  opacity: 0.58;
  backdrop-filter: blur(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.language-switch:hover,
.language-switch:focus-within {
  opacity: 1;
  transform: translateY(-1px);
}

.language-switch button {
  min-width: 42px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 900;
}

.language-switch button.active {
  background: var(--green);
  color: #ffffff;
}

.game-header {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 28px));
  display: grid;
  justify-items: center;
  gap: 6px;
  margin: 0 auto;
  padding: 20px 0 13px;
  text-align: center;
}

.home-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: transform 180ms ease, filter 180ms ease;
}

.home-logo:hover {
  transform: translateY(-2px) scale(1.035);
  filter: drop-shadow(0 8px 12px rgba(20, 92, 61, 0.16));
}

.home-logo img {
  width: min(136px, 36vw);
  height: auto;
  display: block;
}

.game-mark {
  position: relative;
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 10px;
  align-items: end;
  padding: 8px 21px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 254, 250, 0.98), rgba(223, 238, 228, 0.94)),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(20, 92, 61, 0.05) 19px);
  box-shadow: var(--shadow);
}

.game-mark::before,
.game-mark::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 88px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(20, 92, 61, 0.46));
}

.game-mark::before {
  right: calc(100% + 15px);
}

.game-mark::after {
  left: calc(100% + 15px);
  transform: rotate(180deg);
}

.game-mark span,
.game-mark strong {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 0.92;
  letter-spacing: 0;
}

.game-mark span {
  color: var(--ink);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 900;
}

.game-mark strong {
  color: var(--gold);
  font-size: clamp(2.25rem, 5.6vw, 3.7rem);
  font-weight: 900;
  text-shadow: 0 1px 0 #fff7d8;
}

.game-header p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.market-date {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 12px;
  background: rgba(255, 254, 250, 0.88);
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(20, 92, 61, 0.08);
  backdrop-filter: blur(8px);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto 26px;
}

.title-band {
  display: grid;
  grid-template-columns: 86px 1fr minmax(230px, 330px);
  gap: 14px;
  align-items: center;
  min-height: 86px;
  margin-top: 16px;
  padding: 14px 18px;
  border: 1px solid var(--line-strong);
  border-left: 5px solid var(--green);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(223, 238, 228, 0.92), rgba(255, 254, 250, 0.92)),
    repeating-linear-gradient(90deg, transparent 0 16px, rgba(20, 92, 61, 0.04) 17px);
  box-shadow: var(--shadow);
}

.title-band p,
.title-band h1,
.title-band span {
  margin: 0;
}

.title-band p {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(20, 92, 61, 0.32);
  border-radius: 50%;
  background: #fffdf2;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
}

.title-band h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.35rem;
  line-height: 1;
  letter-spacing: 0;
  color: var(--ink);
}

.title-band span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.45;
  text-align: right;
}

.comparison-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(218px, 0.78fr) minmax(260px, 1fr);
  gap: 10px;
  align-items: stretch;
  padding: 12px 0 12px;
}

.invest-panel,
.bridge-panel,
.result-panel,
.asset-lab,
.leaderboard {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.96);
  box-shadow: var(--shadow);
}

.invest-panel,
.result-panel {
  min-height: 320px;
  padding: 15px;
}

.panel-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  color: var(--ink-2);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.24rem;
  line-height: 1.12;
  letter-spacing: 0;
}

.era {
  display: inline-grid;
  place-items: center;
  min-width: 56px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 4px 9px;
  background: #fff3c7;
  color: #7a5a12;
  font-size: 0.76rem;
  font-weight: 900;
}

.money-input {
  display: grid;
  gap: 6px;
}

.money-input span,
.search-box span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.money-input input {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 14px;
  background:
    linear-gradient(90deg, rgba(223, 238, 228, 0.7), rgba(255, 253, 242, 0.9)),
    #fffdf2;
  color: var(--green);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.05rem;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.56);
}

.quick-amounts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 10px 0 14px;
}

.quick-amounts button,
.filters button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.quick-amounts button:hover,
.filters button:hover {
  transform: translateY(-1px);
  border-color: var(--green);
  background: var(--paper-2);
  box-shadow: 0 5px 12px rgba(20, 92, 61, 0.1);
}

.stat-list {
  display: grid;
  gap: 7px;
  margin: 0;
}

.stat-list div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: baseline;
  border-bottom: 1px dashed rgba(20, 92, 61, 0.22);
  padding-bottom: 7px;
}

.stat-list dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.stat-list dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  text-align: right;
  font-size: 0.86rem;
  font-weight: 900;
}

.bridge-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto auto auto 1fr;
  align-content: stretch;
  justify-items: center;
  min-height: 320px;
  padding: 22px 18px 16px;
  overflow: hidden;
  color: #ffffff;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(242, 223, 173, 0.18), transparent 42%),
    repeating-linear-gradient(0deg, transparent 0 12px, rgba(255, 255, 255, 0.035) 13px),
    #173126;
}

.bridge-panel::before {
  content: "$";
  position: absolute;
  inset: auto auto 0 -12px;
  color: rgba(255, 255, 255, 0.05);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13rem;
  font-weight: 900;
  line-height: 0.8;
}

.bridge-panel::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(242, 223, 173, 0.28);
  border-radius: 6px;
  pointer-events: none;
}

.asset-token {
  position: relative;
  z-index: 1;
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  background: var(--asset-color, var(--gold));
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.14), 0 7px 18px rgba(0, 0, 0, 0.18);
}

.asset-token-logo {
  max-width: 47px;
  max-height: 47px;
  display: block;
  object-fit: contain;
}

.asset-token .logo-fallback {
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 900;
}

.bridge-company {
  position: relative;
  z-index: 1;
  max-width: 100%;
  margin: 15px 0 0;
  color: #ffffff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 3.4vw, 2.35rem);
  font-weight: 900;
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.bridge-symbol {
  position: relative;
  z-index: 1;
  max-width: 100%;
  margin: 7px 0 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.bridge-kicker {
  position: relative;
  z-index: 1;
  margin: 20px 0 4px;
  color: rgba(242, 223, 173, 0.74);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#returnPercent {
  position: relative;
  z-index: 1;
  margin-top: 13px;
  border: 1px solid rgba(242, 223, 173, 0.35);
  border-radius: 12px;
  padding: 8px 17px;
  background: rgba(242, 223, 173, 0.1);
  color: #f2dfad;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4.6vw, 3.2rem);
  line-height: 1;
  font-weight: 900;
}

.bridge-panel strong {
  position: relative;
  z-index: 1;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 3.6vw, 2.55rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.bridge-foot {
  position: relative;
  z-index: 1;
  align-self: end;
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  font-weight: 900;
}

.future-value {
  margin: 4px 0 14px;
  color: var(--green);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.58rem;
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.stat-list-result {
  margin-bottom: 11px;
}

.verdict {
  border: 1px solid rgba(20, 92, 61, 0.24);
  border-left: 4px solid var(--gold);
  border-radius: 7px;
  padding: 9px 11px;
  background: #f5f7ee;
  color: var(--ink-2);
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.42;
}

.asset-lab {
  padding: 12px;
}

.lab-toolbar {
  display: grid;
  grid-template-columns: 1fr minmax(190px, 260px);
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.filters {
  display: flex;
  gap: 6px;
  overflow: auto;
  padding: 2px 1px 3px;
}

.filters button {
  flex: 0 0 auto;
  min-height: 33px;
  padding: 0 12px;
  white-space: nowrap;
}

.filters button.active {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
  box-shadow: 0 4px 0 rgba(185, 138, 34, 0.3);
}

.search-box {
  display: grid;
  gap: 5px;
}

.search-box input {
  height: 37px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 11px;
  background: #ffffff;
  font-weight: 800;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.asset-card {
  min-height: 96px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #ffffff;
  text-align: left;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.asset-card:hover {
  transform: translateY(-2px);
  border-color: var(--green);
  box-shadow: 0 7px 16px rgba(20, 92, 61, 0.11);
}

.asset-card.active {
  border-color: var(--green);
  background:
    linear-gradient(135deg, rgba(223, 238, 228, 0.82), rgba(255, 253, 242, 0.95)),
    #fffdf2;
  box-shadow: inset 0 0 0 2px rgba(185, 138, 34, 0.18);
}

.asset-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.logo-shell,
.coin {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(23, 49, 38, 0.28);
  border-radius: 50%;
  background: #ffffff;
  color: var(--asset-color, var(--gold));
  font-size: 0.66rem;
  font-weight: 900;
  box-shadow: inset 0 0 0 3px rgba(223, 238, 228, 0.52);
}

.asset-logo {
  max-width: 19px;
  max-height: 19px;
  display: block;
  object-fit: contain;
}

.photo-icon {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border-radius: inherit;
  object-fit: cover;
}

.logo-fallback {
  color: var(--asset-color, var(--gold));
  font-size: 0.62rem;
  font-weight: 900;
}

.hidden {
  display: none !important;
}

.tag {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 900;
}

.asset-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

.asset-card strong {
  color: var(--green);
  font-size: 0.86rem;
  font-weight: 900;
}

.empty-assets {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.leaderboard {
  display: grid;
  grid-template-columns: 174px 1fr;
  gap: 13px;
  align-items: start;
  margin-top: 12px;
  padding: 12px;
}

.board-title p,
.board-title h2 {
  margin: 0;
}

.board-title p {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.board-title h2 {
  margin-top: 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.34rem;
  line-height: 1.08;
}

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

.rank-row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  background: #fffdf7;
}

.rank-logo {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(23, 49, 38, 0.2);
  border-radius: 50%;
  background: #ffffff;
  font-size: 0.68rem;
  box-shadow: inset 0 0 0 3px rgba(223, 238, 228, 0.45);
}

.rank-logo-img {
  max-width: 16px;
  max-height: 16px;
  display: block;
  object-fit: contain;
}

.rank-logo .logo-fallback {
  font-size: 0.54rem;
}

.rank-row b {
  min-width: 0;
  overflow: hidden;
  font-size: 0.84rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-row span {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
}

.rank-row strong {
  grid-column: 2 / -1;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

footer {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 28px));
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto;
  padding: 17px 0 30px;
  color: var(--muted);
  font-size: 0.78rem;
}

footer a {
  color: var(--green);
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 4px;
}

footer .support-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  text-decoration: none;
  white-space: nowrap;
}

footer .support-link b {
  color: var(--muted);
  font-weight: 900;
}

footer .support-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (max-width: 1020px) {
  .comparison-grid {
    grid-template-columns: 1fr 1fr;
  }

  .bridge-panel {
    grid-column: 1 / -1;
    min-height: 260px;
    order: 3;
  }

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

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

@media (max-width: 760px) {
  body {
    background-size: 58px 100px, 58px 100px, 29px 29px;
  }

  .game-header,
  .app-shell,
  footer {
    width: min(100% - 20px, 1120px);
  }

  .language-switch {
    top: 10px;
    left: 10px;
  }

  .game-header {
    padding-top: 16px;
  }

  .home-logo img {
    width: 106px;
  }

  .game-mark {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 9px 18px 11px;
  }

  .game-mark::before,
  .game-mark::after {
    display: none;
  }

  .game-mark span {
    font-size: 2rem;
  }

  .game-mark strong {
    font-size: 2.35rem;
  }

  .market-date {
    max-width: 100%;
    overflow: hidden;
    font-size: 0.7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .title-band {
    grid-template-columns: auto 1fr;
    min-height: auto;
    margin-top: 10px;
    padding: 12px;
  }

  .title-band p {
    width: 50px;
    height: 50px;
    font-size: 0.6rem;
  }

  .title-band h1 {
    font-size: 1.72rem;
  }

  .title-band span {
    grid-column: 1 / -1;
    text-align: left;
  }

  .comparison-grid,
  .lab-toolbar,
  .leaderboard {
    grid-template-columns: 1fr;
  }

  .invest-panel,
  .result-panel,
  .bridge-panel {
    min-height: 0;
  }

  .bridge-panel {
    min-height: 282px;
    padding: 18px 14px 14px;
  }

  .asset-token {
    width: 64px;
    height: 64px;
  }

  .asset-token-logo {
    max-width: 39px;
    max-height: 39px;
  }

  .bridge-company {
    margin-top: 12px;
    font-size: 1.48rem;
  }

  #returnPercent {
    margin-top: 10px;
    font-size: 2.2rem;
  }

  .bridge-panel strong {
    font-size: 1.7rem;
  }

  .bridge-foot {
    margin-top: 13px;
  }

  .panel-head h2 {
    font-size: 1.14rem;
  }

  .money-input input {
    min-height: 50px;
    font-size: 1.7rem;
  }

  .quick-amounts {
    grid-template-columns: repeat(4, 1fr);
  }

  .bridge-panel {
    order: initial;
  }

  .future-value {
    font-size: 2.08rem;
  }

  .asset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .asset-card {
    min-height: 104px;
    padding: 8px;
  }

  .asset-card h3 {
    font-size: 0.84rem;
  }

  .asset-card strong {
    font-size: 0.82rem;
  }

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

  footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 430px) {
  .quick-amounts {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .language-switch button {
    min-width: 38px;
  }
}

@media (max-width: 340px) {
  .asset-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
