
@font-face {
  font-family: "Pokemon DS";
  src: url("https://raw.githubusercontent.com/boranblok/PokemonRomTools/master/TranslationTextEditor/Fonts/pokemon-ds-font.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #171a16;
  --paper: #f4efe5;
  --paper-deep: #e1d9c8;
  --accent: #d73232;
  --accent-dark: #8d1515;
  --accent-light: #ef5757;
  --gold: #f3c649;
  --line: #8a8373;
  --black: #090b09;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-logo: "Pokemon Solid", Impact, Haettenschweiler, "Arial Black", sans-serif;
  --font-game: "Pokemon DS", "Courier New", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-body: Arial, Helvetica, sans-serif;
  font-family: var(--font-game);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: #efe9dd; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.8), transparent 30%),
    linear-gradient(135deg, #f6f1e8, #e8dfd0);
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.device,
.primary-cta,
.brand-sub,
.intro-panel h1 {
  font-family: var(--font-game);
}
.description-box,
.notice-card,
.error-card,
.move-level,
.move-name,
.data-cell,
.detail-section h3,
.stat-name,
.stat-value,
.total-row,
.filter-chip,
.type-chip,
.status-line,
.bottom-bar button,
.search-box input,
.filter-toggle,
.sprite-switch { font-family: var(--font-game); }

.site-layout {
  width: min(1120px, calc(100% - 40px));
  min-height: calc(100vh - 70px);
  margin: 0 auto;
  padding: 34px 0 24px;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) 430px;
  gap: clamp(36px, 7vw, 86px);
  align-items: center;
}
.intro-panel { max-width: 520px; }
.brand-lockup { margin-bottom: 38px; }
.brand-main {
  display: inline-block;
  color: #f4cc38;
  font-family: var(--font-logo);
  font-size: clamp(66px, 8vw, 108px);
  font-weight: 400;
  line-height: .78;
  letter-spacing: 1px;
  -webkit-text-stroke: 3px #28569b;
  paint-order: stroke fill;
  text-shadow: 4px 5px 0 #173d7a;
  transform: rotate(-2deg);
}
.brand-sub {
  margin-top: 20px;
  color: var(--accent);
  font-size: clamp(20px, 2.2vw, 30px);
  letter-spacing: 1px;
}
.mini-ball, .row-ball {
  display: inline-block;
  width: 1em;
  height: 1em;
  background: center / contain no-repeat url("./assets/pixel-pokeball.png");
  vertical-align: -.14em;
  image-rendering: pixelated;
}
.intro-panel h1 {
  color: #bd3e2b;
  font-size: clamp(30px, 3.6vw, 44px);
  line-height: 1.08;
  margin: 0 0 24px;
}
.intro-copy {
  max-width: 590px;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
}
.feature-list { margin: 28px 0; }
.feature-list p {
  margin: 12px 0;
  font-family: var(--font-body);
  font-size: 15px;
}
.feature-list span { display: inline-block; width: 28px; font-weight: 700; }
.primary-cta {
  border: 3px solid var(--black);
  border-radius: 8px;
  padding: 14px 22px;
  background: var(--accent);
  color: #fffaf0;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 4px 4px 0 var(--black);
  cursor: pointer;
}
.primary-cta:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--black); }
.fan-note { margin-top: 30px; font-family: var(--font-body); font-size: 13px; opacity: .7; }

.device {
  position: relative;
  height: min(850px, calc(100vh - 64px));
  min-height: 650px;
  overflow: hidden;
  border: 10px solid var(--black);
  border-radius: 34px;
  background: var(--paper);
  box-shadow: 0 24px 55px rgba(22, 22, 18, .28), inset 0 0 0 2px #4d5148;
}
.device-notch {
  position: absolute;
  z-index: 20;
  top: -1px;
  left: 50%;
  width: 118px;
  height: 24px;
  transform: translateX(-50%);
  border-radius: 0 0 16px 16px;
  background: var(--black);
  pointer-events: none;
}
.screen {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr auto;
  background:
    linear-gradient(rgba(255,255,255,.22), rgba(255,255,255,0)),
    var(--paper);
}
.app-header {
  min-height: 88px;
  padding: calc(25px + var(--safe-top)) 14px 10px;
  display: grid;
  grid-template-columns: 46px 1fr 46px;
  align-items: center;
  text-align: center;
  color: #1b1b1b;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(0,0,0,.035) 4px 5px),
    linear-gradient(#fcfcfb, #d8d7d2 62%, #c1c0bc);
  border-bottom: 4px solid #848484;
  text-shadow: 1px 1px 0 rgba(255,255,255,.35);
}
.app-header h2 { margin: 1px 0 0; font-size: 32px; line-height: 1; letter-spacing: 1px; font-weight: 900; }
.eyebrow { display: block; font-size: 12px; letter-spacing: 1.4px; opacity: .82; }
.icon-button {
  width: 44px;
  height: 44px;
  border: 2px solid #7f7f7f;
  border-radius: 8px;
  background: rgba(255,255,255,.55);
  color: #252525;
  font-size: 25px;
  font-weight: 900;
  cursor: pointer;
}
.icon-button:disabled { opacity: .4; cursor: default; }
.ghost { box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.counter-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 2px solid #a9a59b;
  background: #f8f5ec;
}
.counter-strip div { padding: 10px 4px; text-align: center; border-right: 1px solid #c6c0b2; }
.counter-strip div:last-child { border-right: 0; }
.counter-strip span { display: block; font-size: 12px; font-weight: 900; }
.counter-strip strong { display: block; font-size: 24px; }
.search-area {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid #b8b19f;
}
.search-box {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  min-width: 0;
  border: 2px solid #57594f;
  border-radius: 7px;
  background: #fffdf5;
  box-shadow: inset 2px 2px 0 #d6cfbd;
}
.search-box span { text-align: center; font-size: 22px; }
.search-box input {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  outline: 0;
}
.filter-toggle {
  border: 2px solid var(--black);
  border-radius: 6px;
  padding: 0 14px;
  background: linear-gradient(#e94848, #c62020);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 3px 0 var(--accent-dark);
  cursor: pointer;
}
.filters-panel {
  max-height: 265px;
  overflow-y: auto;
  padding: 10px;
  border-bottom: 2px solid #b9af9d;
  background: #ebe3d3;
}
.filter-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.filter-chip, .type-chip {
  border: 2px solid #383a35;
  border-radius: 5px;
  padding: 10px 6px;
  background: #c9c4b7;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.16);
}
.filter-chip.active { background: var(--accent); color: white; }
.filter-label { margin: 12px 0 7px; font-size: 13px; font-weight: 900; }
.type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.type-chip { color: #fff; text-shadow: 1px 1px 0 rgba(0,0,0,.45); }
.type-chip.active { outline: 3px solid var(--gold); outline-offset: 1px; }
.status-line {
  min-height: 28px;
  padding: 6px 10px;
  border-bottom: 1px solid #bbb4a2;
  background: #efe7d6;
  font-size: 14px;
  font-weight: 900;
}
.pokemon-list { overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #ad9575 #ded8ca; }
.pokemon-row {
  width: 100%;
  min-height: 78px;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: 34px 58px minmax(0, 1fr) auto 64px 16px;
  gap: 7px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid #c4bdac;
  background: rgba(255,255,255,.28);
  text-align: left;
  cursor: pointer;
}
.pokemon-row:nth-child(even) { background: rgba(238,224,198,.55); }
.pokemon-row:hover, .pokemon-row:focus-visible { background: #fff4c8; }
.row-ball { width: 28px; height: 28px; }
.pokemon-id { font-size: 15px; font-weight: 900; }
.pokemon-name { overflow: hidden; font-size: 24px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; letter-spacing: .3px; }
.row-badges { display: flex; gap: 3px; font-size: 14px; }
.pokemon-sprite { width: 60px; height: 60px; object-fit: contain; image-rendering: pixelated; }
.row-arrow { font-size: 24px; font-weight: 900; }
.empty-state { padding: 50px 24px; text-align: center; font-size: 18px; font-weight: 900; line-height: 1.6; }
.bottom-bar {
  min-height: calc(62px + var(--safe-bottom));
  padding: 7px 8px calc(7px + var(--safe-bottom));
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 4px;
  color: #fff9ef;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.06) 4px 5px),
    linear-gradient(#ea4a4a, #d73232 58%, #a91515);
  border-top: 4px solid var(--accent-dark);
}
.bottom-bar button {
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}
kbd {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  padding: 0 3px;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: #f7f0dd;
  color: var(--accent-dark);
  font: inherit;
  box-shadow: inset 0 -2px 0 #bba78f;
}
.detail-screen { grid-template-rows: auto auto 1fr auto; }
.detail-header { padding-left: 10px; padding-right: 10px; }
.detail-header h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 36px; font-weight: 900; }
.detail-tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 3px solid var(--accent-dark); }
.detail-tab {
  min-height: 54px;
  border: 0;
  border-right: 1px solid #777467;
  background: #d4cfc1;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
}
.detail-tab:last-child { border-right: 0; }
.detail-tab.active { background: linear-gradient(#ea4a4a, #d73232); color: white; }
.detail-body { min-height: 0; overflow-y: auto; padding: 12px; }
.loading-card { min-height: 330px; display: grid; place-content: center; text-align: center; font-size: 16px; font-weight: 900; }
.pixel-loader {
  width: 50px;
  height: 50px;
  margin: 0 auto 16px;
  border: 7px solid #b5ad99;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s steps(8) infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hero-card {
  position: relative;
  min-height: 234px;
  display: grid;
  place-items: center;
  border: 3px solid #8d8b84;
  border-radius: 8px;
  background:
    linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,.08)),
    repeating-linear-gradient(0deg, transparent 0 5px, rgba(52,80,48,.025) 6px 7px),
    #ebebe8;
  box-shadow: inset 4px 4px 0 rgba(255,255,255,.55), inset -4px -4px 0 rgba(67,75,62,.1);
}
.hero-card::after {
  content: "";
  position: absolute;
  inset: auto 12% 16px;
  height: 12px;
  border-radius: 50%;
  background: rgba(30,38,27,.12);
  filter: blur(3px);
}
.hero-sprite { z-index: 1; width: min(200px, 58vw); height: 180px; object-fit: contain; image-rendering: pixelated; }
.sprite-switch {
  position: absolute;
  z-index: 2;
  right: 10px;
  bottom: 10px;
  border: 2px solid var(--black);
  border-radius: 5px;
  padding: 8px 10px;
  background: #fffaf0;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}
.detail-section {
  margin-top: 10px;
  border: 2px solid #a49d8a;
  border-radius: 7px;
  background: rgba(255,255,255,.4);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.4);
}
.detail-section h3 {
  margin: 0;
  padding: 10px 10px;
  border-bottom: 1px solid #a49d8a;
  background: #f1e4c7;
  font-size: 18px;
  letter-spacing: .5px;
}
.data-grid { display: grid; grid-template-columns: 1fr 1fr; }
.data-cell { min-height: 60px; padding: 10px; border-right: 1px solid #bbb4a3; border-bottom: 1px solid #bbb4a3; }
.data-cell:nth-child(even) { border-right: 0; }
.data-cell span { display: block; margin-bottom: 5px; font-size: 15px; font-weight: 900; opacity: .8; }
.data-cell strong { font-size: 20px; }
.type-pill {
  display: inline-block;
  margin: 2px 3px 2px 0;
  padding: 5px 8px;
  border: 2px solid rgba(0,0,0,.55);
  border-radius: 4px;
  color: white;
  font-size: 12px;
  font-weight: 900;
  text-shadow: 1px 1px 0 rgba(0,0,0,.4);
}
.description-box { padding: 16px; font-size: 22px; font-weight: 700; line-height: 1.65; }
.evolution-row { display: flex; align-items: center; gap: 5px; overflow-x: auto; padding: 9px; }
.evolution-button {
  min-width: 88px;
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.evolution-button img { display: block; width: 68px; height: 68px; margin: auto; object-fit: contain; image-rendering: pixelated; }
.evolution-arrow { font-weight: 900; opacity: .6; }
.matchup-list { padding: 10px; }
.matchup-group { margin: 7px 0; }
.matchup-group > strong { display: inline-block; min-width: 104px; font-size: 12px; }
.stat-list { padding: 11px; }
.stat-row { display: grid; grid-template-columns: 112px 44px 1fr; gap: 9px; align-items: center; margin: 13px 0; }
.stat-name, .stat-value { font-size: 18px; font-weight: 900; }
.stat-value { text-align: right; }
.stat-track { height: 15px; border: 2px solid #55584f; background: #d3cebe; box-shadow: inset 2px 2px 0 rgba(0,0,0,.12); }
.stat-fill { height: 100%; width: 0; background: linear-gradient(90deg, #f5d95f, #f08a2f 58%, #d74228); transition: width .35s steps(8); }
.total-row { display: flex; justify-content: space-between; padding: 12px; border-top: 2px solid #a49d8a; font-size: 16px; font-weight: 900; }
.move-list { border: 2px solid #a49d8a; border-radius: 7px; overflow: hidden; }
.move-row { display: grid; grid-template-columns: 72px 1fr; gap: 10px; padding: 12px; border-bottom: 1px solid #b7b09e; background: rgba(255,255,255,.25); }
.move-row:last-child { border-bottom: 0; }
.move-level { font-size: 17px; font-weight: 900; opacity: .8; }
.move-name { font-size: 22px; font-weight: 900; }
.notice-card, .error-card { padding: 20px; border: 2px solid #9f9784; border-radius: 8px; background: #f5efdf; line-height: 1.6; font-size: 20px; }
.error-card button { margin-top: 12px; border: 2px solid var(--black); border-radius: 5px; padding: 9px 12px; background: var(--accent); color: white; font-weight: 900; cursor: pointer; }
.detail-bottom { justify-content: space-between; }
.detail-bottom button.active { color: #ffe16f; }
.toast {
  position: absolute;
  z-index: 50;
  left: 50%;
  bottom: 70px;
  max-width: calc(100% - 36px);
  transform: translate(-50%, 16px);
  padding: 10px 13px;
  border: 3px solid var(--black);
  border-radius: 7px;
  background: #fff5cc;
  font-size: 13px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  box-shadow: 4px 4px 0 rgba(0,0,0,.28);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.legal-footer {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 28px;
  color: #5f5b51;
  font-family: var(--font-body);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.type-normal { background: #8f8b78; }
.type-fire { background: #d4472d; }
.type-water { background: #4273b9; }
.type-electric { background: #e2b62f; }
.type-grass { background: #4e934c; }
.type-ice { background: #62a9b3; }
.type-fighting { background: #9a4937; }
.type-poison { background: #8a4b91; }
.type-ground { background: #b58b3b; }
.type-flying { background: #657dbc; }
.type-psychic { background: #c65279; }
.type-bug { background: #7e9132; }
.type-rock { background: #927630; }
.type-ghost { background: #5c527c; }
.type-dragon { background: #5c3a9f; }
.type-dark { background: #4e4640; }
.type-steel { background: #777c83; }

@media (max-width: 820px) {
  body { background: var(--paper); }
  .site-layout { width: 100%; min-height: 100svh; padding: 0; display: block; }
  .intro-panel, .legal-footer { display: none; }
  .device {
    width: 100%;
    height: 100svh;
    min-height: 560px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .device-notch { display: none; }
  .app-header { padding-top: calc(12px + var(--safe-top)); }
}
@media (max-height: 700px) and (min-width: 821px) {
  .device { height: 640px; min-height: 640px; }
  .site-layout { align-items: start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


.letter-button img {
  width: 30px;
  height: 26px;
  display: block;
  margin: auto;
  image-rendering: pixelated;
}

.letter-modal {
  position: absolute;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
}
.letter-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(10, 10, 9, .72);
  cursor: pointer;
}
.letter-card {
  position: relative;
  z-index: 1;
  width: min(100%, 390px);
  max-height: calc(100% - 24px);
  overflow-y: auto;
  border: 4px solid var(--black);
  border-radius: 10px;
  background: #f7f0df;
  box-shadow: 7px 7px 0 rgba(0,0,0,.35);
}
.letter-card-header {
  min-height: 76px;
  padding: 10px;
  display: grid;
  grid-template-columns: 46px 1fr 38px;
  gap: 8px;
  align-items: center;
  color: #fff9ef;
  background: linear-gradient(#e94848, #c62020 65%, #931010);
  border-bottom: 4px solid #721010;
}
.letter-card-header img {
  width: 42px;
  height: 36px;
  image-rendering: pixelated;
}
.letter-card-header span {
  display: block;
  font-size: 12px;
  opacity: .85;
}
.letter-card-header h3 {
  margin: 2px 0 0;
  font-family: var(--font-game);
  font-size: 22px;
  line-height: 1;
}
.letter-close {
  width: 36px;
  height: 36px;
  border: 2px solid rgba(255,255,255,.65);
  border-radius: 6px;
  background: rgba(0,0,0,.13);
  color: #fff;
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
}
.letter-form {
  padding: 15px;
  font-family: var(--font-game);
}
.letter-form > p {
  margin: 0 0 15px;
  font-size: 16px;
  line-height: 1.55;
}
.letter-form label {
  display: block;
  margin-top: 13px;
}
.letter-form label > span {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 900;
}
.letter-form small { font-size: .75em; opacity: .68; }
.letter-form input,
.letter-form textarea {
  width: 100%;
  border: 3px solid #54534d;
  border-radius: 6px;
  background: #fffdf5;
  color: var(--ink);
  padding: 10px;
  font-family: var(--font-game);
  font-size: 17px;
  line-height: 1.45;
  box-shadow: inset 2px 2px 0 #d4cbb8;
}
.letter-form textarea { resize: vertical; min-height: 170px; }
.letter-meta {
  min-height: 28px;
  margin-top: 7px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}
.letter-meta #letter-status { flex: 1; }
.letter-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  border: 3px solid var(--black);
  border-radius: 7px;
  background: linear-gradient(#e94848, #c62020);
  color: #fff9ef;
  font-family: var(--font-game);
  font-size: 17px;
  font-weight: 900;
  box-shadow: 0 4px 0 #721010;
  cursor: pointer;
}
.letter-submit:disabled { opacity: .55; cursor: wait; }

@media (max-width: 420px) {
  .counter-strip span { font-size: 10px; }
  .counter-strip strong { font-size: 21px; }
  .letter-modal { padding: 10px; }
  .letter-card-header h3 { font-size: 20px; }
}
