/* Founders World — base shell. The GameUI layer appends its own styles. */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0C0A08; }
body { font-family: "Instrument Sans", ui-sans-serif, system-ui, sans-serif; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }


/* Founders World game UI layer */

:root {
  --fw-ivory: #F5F0E6;
  --fw-black: #0C0A08;
  --fw-gold: #C5A059;
  --fw-gold-hi: #E8C274;
  --fw-bronze: #7A5626;
  --fw-ink: #1A1712;
  --fw-ink-soft: rgba(26, 23, 18, 0.72);
  --fw-font: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
}

#title, .fw-overlay, .fw-dialogue, .fw-zone, .fw-clarity, .fw-hint, .fw-joy, .fw-action {
  font-family: var(--fw-font);
  box-sizing: border-box;
}
#title *, .fw-overlay *, .fw-dialogue *, .fw-clarity *, .fw-joy * {
  box-sizing: border-box;
  font-family: inherit;
}

.fw-out {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Gold pill button */
.fw-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  background: var(--fw-gold);
  color: var(--fw-ink);
  border: none;
  border-radius: 999px;
  padding: 15px 42px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(12, 10, 8, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: background 0.25s, transform 0.25s, box-shadow 0.25s;
}
.fw-pill:hover {
  background: var(--fw-gold-hi);
  transform: translateY(-1px);
  box-shadow: 0 16px 38px rgba(12, 10, 8, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.fw-pill:active { transform: translateY(0); }
.fw-pill:focus-visible { outline: 2px solid var(--fw-gold-hi); outline-offset: 3px; }

/* 1. Title screen: transparent center, vignetted top and bottom */
#title {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 9vh 24px 7vh;
  background: linear-gradient(to bottom,
    rgba(12, 10, 8, 0.78) 0%,
    rgba(12, 10, 8, 0) 32%,
    rgba(12, 10, 8, 0) 60%,
    rgba(12, 10, 8, 0.85) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}
#title.fw-in { opacity: 1; }
#title .fw-pill { pointer-events: auto; }
.fw-wordmark {
  margin: 0;
  color: #FFFFFF;
  font-weight: 800;
  font-size: clamp(42px, 8vw, 96px);
  letter-spacing: 0.14em;
  text-align: center;
  text-shadow: 0 4px 30px rgba(12, 10, 8, 0.6);
}
.fw-title-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.fw-tagline {
  margin: 0;
  color: var(--fw-ivory);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 2px 14px rgba(12, 10, 8, 0.8);
}

/* Shared full-screen overlay */
.fw-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(12, 10, 8, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.fw-overlay.fw-in { opacity: 1; }
.fw-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 920px;
  width: 100%;
  margin: auto;
  transform: translateY(14px);
  transition: transform 0.5s ease;
}
.fw-overlay.fw-in .fw-box { transform: translateY(0); }
.fw-overlay-title {
  margin: 0;
  color: var(--fw-ivory);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}
.fw-overlay-title::after {
  content: "";
  display: block;
  width: 56px;
  height: 1px;
  margin: 16px auto 0;
  background: var(--fw-gold);
  opacity: 0.85;
}

/* 2. Industry select */
.fw-select-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-top: 30px;
  width: min(340px, 100%);
}
.fw-option {
  appearance: none;
  background: rgba(245, 240, 230, 0.05);
  border: 1px solid rgba(197, 160, 89, 0.55);
  border-radius: 999px;
  color: var(--fw-ivory);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  padding: 13px 30px;
  cursor: pointer;
  transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.25s;
}
.fw-option:hover, .fw-option:focus-visible {
  background: var(--fw-gold);
  border-color: var(--fw-gold);
  color: var(--fw-ink);
  transform: translateY(-1px);
}
.fw-option:focus-visible { outline: 2px solid var(--fw-gold-hi); outline-offset: 3px; }

/* 3. Dialogue */
.fw-dialogue {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 60;
  width: min(560px, calc(100vw - 32px));
  opacity: 0;
  transform: translate(-50%, 14px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.fw-dialogue.fw-in { opacity: 1; transform: translate(-50%, 0); }
.fw-dialogue.fw-out { transform: translate(-50%, 14px); }
.fw-nameplate {
  position: absolute;
  top: -13px;
  left: 18px;
  z-index: 2;
  background: var(--fw-gold);
  color: var(--fw-ink);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(12, 10, 8, 0.35);
}
.fw-dialogue-card {
  position: relative;
  background: var(--fw-ivory);
  border: 1px solid rgba(197, 160, 89, 0.4);
  border-radius: 14px;
  padding: 26px 70px 24px 22px;
  box-shadow: 0 20px 50px rgba(12, 10, 8, 0.45);
}
.fw-dialogue-text {
  margin: 0;
  min-height: 4.4em;
  color: var(--fw-ink);
  font-size: 15px;
  line-height: 1.55;
}
.fw-advance {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--fw-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(12, 10, 8, 0.3);
  transition: background 0.25s, transform 0.25s;
}
.fw-advance:hover { background: var(--fw-gold-hi); transform: scale(1.06); }
.fw-advance:focus-visible { outline: 2px solid var(--fw-bronze); outline-offset: 2px; }
.fw-tri {
  display: block;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid var(--fw-ink);
  margin-left: 3px;
}

/* 4. Zone card */
.fw-zone {
  position: fixed;
  left: 26px;
  bottom: 100px;
  z-index: 40;
  color: #FFFFFF;
  font-size: clamp(22px, 4.5vw, 42px);
  font-weight: 700;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  text-shadow: 0 2px 20px rgba(12, 10, 8, 0.85), 0 0 4px rgba(12, 10, 8, 0.6);
  opacity: 0;
  transform: translateX(-26px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}
.fw-zone.fw-in { opacity: 1; transform: translateX(0); }

/* 5. Clarity meter */
.fw-clarity {
  position: fixed;
  top: 20px;
  right: 22px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  pointer-events: none;
}
.fw-clarity-label {
  color: var(--fw-ivory);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  text-shadow: 0 1px 8px rgba(12, 10, 8, 0.8);
}
.fw-clarity-track {
  position: relative;
  width: 120px;
  height: 2px;
  background: rgba(245, 240, 230, 0.28);
}
.fw-clarity-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: linear-gradient(90deg, var(--fw-gold), var(--fw-gold-hi));
  box-shadow: 0 0 8px rgba(232, 194, 116, 0.55);
  transition: width 0.6s ease;
}

/* 6. Card deal */
.fw-cards-row {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: stretch;
  gap: 18px;
  margin-top: 30px;
  width: 100%;
}
.fw-card {
  background: var(--fw-ivory);
  border: 1px solid rgba(197, 160, 89, 0.4);
  border-radius: 14px;
  padding: 22px 20px;
  width: 250px;
  text-align: left;
  box-shadow: 0 18px 44px rgba(12, 10, 8, 0.4);
  opacity: 0;
  animation: fw-deal 0.55s ease forwards;
}
@keyframes fw-deal {
  from { opacity: 0; transform: translateY(28px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.fw-card-kind {
  display: inline-block;
  background: rgba(197, 160, 89, 0.18);
  color: var(--fw-bronze);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}
.fw-card-title {
  margin: 12px 0 8px;
  color: var(--fw-ink);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}
.fw-card-body {
  margin: 0;
  color: var(--fw-ink-soft);
  font-size: 13.5px;
  line-height: 1.55;
}
.fw-footnote {
  margin: 20px 0 0;
  color: rgba(245, 240, 230, 0.66);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.fw-cards-continue {
  margin-top: 28px;
  opacity: 0;
  animation: fw-fadeup 0.5s ease forwards;
}
@keyframes fw-fadeup {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 640px) {
  .fw-cards-row { flex-direction: column; align-items: center; }
  .fw-card { width: min(340px, 100%); }
}

/* 7. End card */
.fw-end-box { max-width: 480px; }
.fw-monogram {
  width: 86px;
  height: auto;
  margin-bottom: 22px;
  filter: drop-shadow(0 6px 20px rgba(12, 10, 8, 0.5));
}
.fw-end-title {
  margin: 0;
  color: var(--fw-ivory);
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 700;
  letter-spacing: 0.08em;
}
.fw-end-title::after {
  content: "";
  display: block;
  width: 56px;
  height: 1px;
  margin: 18px auto 0;
  background: var(--fw-gold);
  opacity: 0.85;
}
.fw-end-body {
  margin: 18px 0 0;
  color: rgba(245, 240, 230, 0.78);
  font-size: 15px;
  line-height: 1.6;
}
.fw-end-cta { margin-top: 28px; }
.fw-replay {
  appearance: none;
  background: none;
  border: none;
  margin-top: 18px;
  color: rgba(245, 240, 230, 0.7);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  transition: color 0.25s;
}
.fw-replay:hover, .fw-replay:focus-visible { color: var(--fw-gold-hi); }

/* 8. Touch joystick and action button */
.fw-joy {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 46;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(245, 240, 230, 0.08);
  border: 1px solid rgba(245, 240, 230, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.fw-joy-knob {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--fw-gold-hi), var(--fw-gold) 70%);
  box-shadow: 0 4px 12px rgba(12, 10, 8, 0.45);
  pointer-events: none;
}
.fw-action {
  position: fixed;
  right: 22px;
  bottom: 34px;
  z-index: 46;
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 50%;
  background: var(--fw-gold);
  color: var(--fw-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(12, 10, 8, 0.45);
  touch-action: manipulation;
}
.fw-action:active { background: var(--fw-gold-hi); transform: scale(0.96); }

/* 9. Hint */
.fw-hint {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 44;
  transform: translate(-50%, 8px);
  color: rgba(245, 240, 230, 0.85);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 1px 10px rgba(12, 10, 8, 0.85);
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
  white-space: nowrap;
}
.fw-hint.fw-in { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  #title, .fw-overlay, .fw-box, .fw-dialogue, .fw-zone, .fw-hint, .fw-clarity-fill { transition: none; }
  .fw-card, .fw-cards-continue { animation-duration: 0.01s; animation-delay: 0s !important; }
}
