/* Rice to Riches site. Colors follow lib/app/palette.dart so the page looks like the game:
   cream panels framed in wood, gold for coins, green for the main button. */

:root {
  --cream: #fbefd5;
  --cream-deep: #f1ddb2;
  --paper: #fff8e8;
  --ink: #3b2614;
  --ink-soft: #6b4d30;
  --wood-dark: #5a3a1e;
  --wood: #8b5a2b;
  --wood-light: #c08a4e;
  --gold: #f4c430;
  --gold-deep: #d99a1e;
  --green: #3fa34d;
  --green-deep: #2a7a36;
  --sky: #8fd3f4;
  --up: #d9443c;
  --down: #2f6fd6;
  --shadow: 0 6px 0 rgba(59, 38, 20, 0.18), 0 16px 32px rgba(59, 38, 20, 0.16);
  --radius: 18px;
  --pixel: "Galmuri11", "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  --body: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.7 var(--body);
  word-break: keep-all;
  overflow-wrap: break-word;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--green-deep);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--gold-deep);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Language: only the chosen half of every bilingual pair shows. */
html[data-lang="en"] [data-l="ko"],
html[data-lang="ko"] [data-l="en"] {
  display: none !important;
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--ink);
  color: var(--cream);
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.pixel {
  font-family: var(--pixel);
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--wood-dark);
  border-bottom: 3px solid var(--ink);
  transition: box-shadow 0.2s ease;
}

.site-header.is-scrolled {
  box-shadow: 0 6px 18px rgba(59, 38, 20, 0.28);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--cream);
  text-decoration: none;
  font-family: var(--pixel);
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
}

.brand img {
  border-radius: 9px;
  box-shadow: 0 0 0 2px var(--ink);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-links a {
  color: var(--cream-deep);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  padding: 8px 10px;
  border-radius: 10px;
}

.nav-links a:hover {
  background: rgba(255, 248, 232, 0.12);
  color: var(--paper);
}

.lang-toggle {
  display: inline-flex;
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  background: var(--ink);
}

.lang-toggle button {
  border: 0;
  background: transparent;
  color: var(--cream-deep);
  font: 700 13px/1 var(--body);
  padding: 8px 11px;
  min-height: 34px;
  cursor: pointer;
}

.lang-toggle button[aria-pressed="true"] {
  background: var(--gold);
  color: var(--ink);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--wood);
  color: var(--cream);
  cursor: pointer;
  padding: 0;
}

.nav-toggle svg {
  margin: auto;
}

@media (max-width: 760px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: 10px 16px 16px;
    background: var(--wood-dark);
    border-bottom: 3px solid var(--ink);
  }

  .site-header.nav-open .nav-links {
    display: flex;
  }

  .nav-links a {
    padding: 12px 10px;
    font-size: 16px;
  }

  .brand .brand-name {
    display: none;
  }
}

/* ---------- Panels and buttons (WoodPanel / TitleBand / GameButton) ---------- */

.panel {
  background: var(--paper);
  border: 4px solid var(--wood-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 0 3px var(--cream-deep);
}

.title-band {
  display: inline-block;
  margin: 0;
  padding: 8px 18px 10px;
  background: var(--wood);
  color: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: inset 0 -5px 0 rgba(59, 38, 20, 0.35);
  font-family: var(--pixel);
  font-weight: 700;
  line-height: 1.15;
  text-shadow: 0 2px 0 var(--ink);
}

.kicker {
  margin: 0 0 6px;
  color: var(--wood);
  font-family: var(--pixel);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section {
  padding: 72px 0;
}

.section-alt {
  background: var(--cream-deep);
  border-top: 3px solid rgba(90, 58, 30, 0.18);
  border-bottom: 3px solid rgba(90, 58, 30, 0.18);
}

.section-head {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 40px;
}

.section-head h2 {
  font-size: clamp(24px, 4vw, 32px);
}

.section-head p {
  margin: 14px 0 0;
  color: var(--ink-soft);
}

/* ---------- Store badges ---------- */

.store-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 176px;
  min-height: 56px;
  padding: 8px 18px 8px 14px;
  background: var(--ink);
  color: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.35);
  text-decoration: none;
  transition: transform 0.12s ease, background 0.12s ease;
}

.store-badge:hover {
  transform: translateY(-2px);
  background: #4a321b;
}

.store-badge[aria-disabled="true"] {
  background: var(--wood);
  border-color: var(--wood-dark);
  cursor: default;
  transform: none;
}

.store-glyph {
  width: 28px;
  height: 28px;
  flex: none;
}

.store-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.store-kicker {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
}

.store-name {
  font-size: 19px;
  font-weight: 800;
}

.store-note {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 56px 0 64px;
  background: var(--sky);
}

.hero-bg,
.hero-bg img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-bg img {
  object-fit: cover;
  object-position: center 40%;
}

.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(251, 239, 213, 0) 55%, rgba(251, 239, 213, 0.75) 100%);
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 48px;
  align-items: center;
}

.hero-card {
  padding: 28px 28px 26px;
  max-width: 560px;
}

.hero-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.hero-icon {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  box-shadow: 0 0 0 3px var(--ink), 0 6px 0 rgba(59, 38, 20, 0.25);
}

.hero-card h1 {
  font-size: clamp(28px, 5vw, 40px);
}

.hero-sub {
  margin: 6px 0 0;
  font-family: var(--pixel);
  font-weight: 700;
  color: var(--wood);
  font-size: 16px;
}

.tagline {
  margin: 0 0 16px;
  font-size: clamp(17px, 2.4vw, 19px);
  font-weight: 600;
  line-height: 1.6;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--cream-deep);
  border: 2px solid var(--wood-light);
  font-size: 14px;
  font-weight: 700;
  color: var(--wood-dark);
}

/* Phone frame around screenshots. */
.phone {
  position: relative;
  width: 300px;
  padding: 10px;
  background: #24170b;
  border-radius: 38px;
  box-shadow: 0 0 0 3px #3b2614, 0 24px 48px rgba(36, 23, 11, 0.38);
}

.phone img {
  width: 100%;
  border-radius: 28px;
  aspect-ratio: 720 / 1365;
  object-fit: cover;
}

.hero-phone .phone {
  transform: rotate(2.5deg);
}

@media (max-width: 860px) {
  .hero {
    padding: 28px 0 40px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    justify-items: center;
  }

  .hero-card {
    padding: 22px 18px 20px;
  }

  .hero-phone .phone {
    width: 250px;
    transform: none;
  }
}

/* ---------- Features ---------- */

.features {
  display: grid;
  gap: 56px;
}

.feature {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 48px;
  align-items: center;
}

.feature:nth-child(even) {
  grid-template-columns: minmax(0, 1fr) auto;
}

.feature:nth-child(even) .feature-shot {
  order: 2;
}

.feature-shot .phone {
  width: 260px;
}

.feature-shot a {
  display: block;
  border-radius: 38px;
}

.feature-text {
  padding: 26px 26px 24px;
}

.feature-text h3 {
  margin: 0 0 12px;
  font-family: var(--pixel);
  font-weight: 700;
  font-size: clamp(22px, 3.4vw, 26px);
  line-height: 1.3;
}

.feature-text p {
  margin: 0;
}

.feature-text p + p {
  margin-top: 10px;
}

.feature-points {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.feature-points li {
  position: relative;
  padding-left: 26px;
  font-weight: 600;
}

.feature-points li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.55em;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-deep);
}

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

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

@media (max-width: 860px) {
  .feature,
  .feature:nth-child(even) {
    grid-template-columns: 1fr;
    gap: 24px;
    justify-items: center;
  }

  .feature:nth-child(even) .feature-shot {
    order: 0;
  }

  .feature-shot .phone {
    width: 230px;
  }

  .feature-text {
    padding: 20px 18px;
  }
}

/* ---------- Regions ---------- */

.regions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.region {
  overflow: hidden;
  border-radius: 16px;
  border: 3px solid var(--wood-dark);
  background: var(--paper);
  box-shadow: 0 5px 0 rgba(59, 38, 20, 0.18);
}

.region img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.region p {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  padding: 10px 12px 12px;
  font-weight: 700;
  line-height: 1.35;
}

.region .num {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--wood);
  color: var(--paper);
  font-family: var(--pixel);
  font-size: 14px;
}

@media (max-width: 760px) {
  .regions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .region p {
    padding: 8px 10px 10px;
    font-size: 14px;
  }
}

/* ---------- Neighbor + download ---------- */

.neighbor {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  margin: 0 auto 36px;
  max-width: 620px;
}

.neighbor img {
  width: 112px;
  height: 112px;
  flex: none;
}

.bubble {
  position: relative;
  margin: 0 0 28px;
  padding: 16px 18px;
  background: var(--paper);
  border: 3px solid var(--wood-dark);
  border-radius: 16px;
  box-shadow: 0 5px 0 rgba(59, 38, 20, 0.18);
}

.bubble::before {
  content: "";
  position: absolute;
  left: -14px;
  bottom: 18px;
  border: 10px solid transparent;
  border-right: 12px solid var(--wood-dark);
  border-left: 0;
}

.bubble .who {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--wood);
}

.bubble .say {
  font-family: var(--pixel);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.5;
}

.download {
  max-width: 720px;
  margin: 0 auto;
  padding: 30px 26px 28px;
  text-align: center;
}

.download h2 {
  font-size: clamp(22px, 3.6vw, 28px);
}

.download p {
  margin: 16px 0 0;
}

.download .store-row {
  justify-content: center;
  margin-top: 22px;
}

.langs {
  margin: 22px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
}

@media (max-width: 520px) {
  .neighbor img {
    width: 84px;
    height: 84px;
  }

  .bubble .say {
    font-size: 16px;
  }

  .store-badge {
    width: 100%;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--ink);
  color: var(--cream-deep);
  padding: 28px 0 32px;
  font-size: 14px;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--cream);
  text-decoration: none;
  font-weight: 700;
}

.footer-brand img {
  border-radius: 7px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.footer-links a {
  color: var(--cream-deep);
  text-decoration: none;
  padding: 6px 0;
}

.footer-links a:hover {
  color: var(--paper);
  text-decoration: underline;
}

.footer-note {
  margin: 14px 0 0;
  color: #b9a283;
  font-size: 13px;
}

/* ---------- Legal pages ---------- */

.legal-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 20px 64px;
}

.legal-header h1 {
  font-size: clamp(26px, 5vw, 34px);
}

.legal-header .sub {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-weight: 700;
}

.legal-meta {
  margin: 20px 0 0;
  padding: 16px 18px;
  font-size: 15px;
  line-height: 1.8;
}

.legal-langs {
  display: flex;
  gap: 16px;
  margin: 18px 0 0;
  font-weight: 700;
}

.legal-part {
  margin-top: 44px;
}

.legal-part h2 {
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--wood-light);
  font-size: 24px;
}

.legal-summary {
  padding: 14px 16px;
  background: var(--cream-deep);
  border-left: 5px solid var(--gold-deep);
  border-radius: 10px;
}

.legal-section h3 {
  margin: 28px 0 8px;
  font-size: 19px;
}

.legal-section p,
.legal-section li {
  color: #3f2b18;
}

.legal-section ul {
  padding-left: 22px;
}

.legal-section li + li {
  margin-top: 6px;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 15px;
  background: var(--paper);
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border: 1px solid var(--wood-light);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: var(--cream-deep);
}

.back-top {
  margin-top: 36px;
  text-align: center;
}

/* ---------- Centered pages (404, /play) ---------- */

.page-center {
  min-height: calc(100vh - 160px);
  display: grid;
  place-items: center;
  padding: 48px 20px;
  text-align: center;
}

.page-center .panel {
  padding: 30px 24px 28px;
  max-width: 520px;
}

.page-center .hero-icon {
  margin: 0 auto 16px;
}

.page-center .store-row {
  justify-content: center;
  margin-top: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 22px;
  border: 3px solid var(--green-deep);
  border-radius: 14px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.18);
}

.btn:hover {
  background: #47b456;
}

/* ---------- Lightbox ---------- */

.lightbox {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(20, 12, 4, 0.92);
  color: var(--cream);
}

.lightbox::backdrop {
  background: rgba(20, 12, 4, 0.6);
}

.lb-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 64px 64px 56px;
}

.lb-stage img {
  max-height: calc(100vh - 120px);
  width: auto;
  border-radius: 22px;
  box-shadow: 0 0 0 3px var(--ink);
}

.lb-btn {
  position: absolute;
  width: 48px;
  height: 48px;
  border: 2px solid var(--cream-deep);
  border-radius: 50%;
  background: rgba(59, 38, 20, 0.85);
  color: var(--cream);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.lb-close {
  top: 14px;
  right: 14px;
}

.lb-prev {
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.lb-next {
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.lb-count {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  text-align: center;
  font-weight: 700;
}

html.lb-open {
  overflow: hidden;
}

@media (max-width: 600px) {
  .lb-stage {
    padding: 64px 10px 56px;
  }

  .lb-prev,
  .lb-next {
    top: auto;
    bottom: 8px;
    transform: none;
  }
}

/* ---------- Reveal ---------- */

html.reveal-on .reveal {
  transform: translateY(18px);
  transition: transform 0.6s ease;
}

html.reveal-on .reveal.is-in {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .store-badge,
  html.reveal-on .reveal {
    transition: none;
    transform: none;
  }
}
