* {
  box-sizing: border-box;
}

:root {
  --canvas: #fbfbfa;
  --surface: #f4f5f7;
  --surface-strong: #e9ecf2;
  --border: rgba(16, 24, 40, 0.11);
  --border-strong: rgba(16, 24, 40, 0.22);
  --text: #111114;
  --muted: #666a73;
  --accent: #3857ff;
  --accent-strong: #1f3ed2;
  --accent-soft: #eef2ff;
  --accent-warm: #555b66;
  --accent-pink: #555b66;
  --red: #d84f45;
  --green: #34a853;
  --blue: #3d72d9;
  --purple: #7550c6;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.08);
  --radius: 8px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Avenir Next", "Segoe UI Variable", "SF Pro Display", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--canvas);
  color: var(--text);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.08;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
}

body.game-active {
  --canvas: #0d0e0b;
  --surface: #171812;
  --surface-strong: #202116;
  --border: rgba(242, 222, 177, 0.16);
  --border-strong: rgba(229, 184, 91, 0.48);
  --text: #f7f1e4;
  --muted: #b7ad9d;
  --accent: #e5b85b;
  --accent-strong: #ffd37a;
  --shadow: 0 24px 80px rgba(5, 6, 3, 0.46);
  background:
    radial-gradient(circle at 18% 12%, rgba(229, 184, 91, 0.14), transparent 28rem),
    linear-gradient(180deg, #12130d 0%, #0d0e0b 54%, #090a08 100%);
}

button,
input {
  font: inherit;
}

button {
  min-height: 2.45rem;
  padding: 0.62rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: none;
  transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-out), border-color 160ms var(--ease-out), opacity 160ms var(--ease-out);
}

button:hover {
  background: var(--accent);
}

button:active {
  transform: scale(0.97);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  filter: grayscale(0.35);
}

.button-quiet {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.positive {
  color: #67d985;
}

.negative {
  color: #ff7f76;
}

#top-bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.5rem;
  padding: 0.75rem 1rem 0.75rem 15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(13, 15, 12, 0.88);
  backdrop-filter: blur(14px);
}

body.game-active #top-bar {
  display: flex;
}

.top-brand,
.menu-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.top-brand {
  border-radius: 8px;
  cursor: pointer;
}

.top-brand:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 4px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--text);
  color: var(--canvas);
  font-size: 0.78rem;
  font-weight: 900;
}

.brand-copy {
  display: grid;
  gap: 0.1rem;
}

.brand-name {
  font-size: 0.98rem;
  font-weight: 800;
}

.brand-mode {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.55rem;
  height: 2.55rem;
  min-height: 2.55rem;
  padding: 0;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.icon-button svg {
  width: 1.12rem;
  height: 1.12rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#bankroll-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.55rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: rgba(229, 184, 91, 0.1);
  cursor: pointer;
}

#bankroll-display span:first-child {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

#bankroll-display strong {
  color: var(--accent-strong);
  font-size: 1.02rem;
  line-height: 1;
}

.money-symbol {
  font-size: 0.62em;
  vertical-align: 0.18em;
  opacity: 0.78;
}

.money-amount {
  font-size: 1.22em;
}

.menu {
  position: fixed;
  inset: 0;
  display: grid;
  align-items: start;
  justify-items: center;
  min-height: 100dvh;
  overflow: auto;
  padding: 0 clamp(1rem, 4vw, 3rem);
  transition: padding 180ms var(--ease-out);
}

.menu-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "nav"
    "hero";
  align-items: start;
  gap: clamp(1rem, 2.2vw, 1.6rem);
  width: min(88rem, 100%);
  min-height: 100dvh;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: clamp(1rem, 2.6vw, 2rem) 0;
  overflow: visible;
}

body.idle-active #game-info,
body.idle-active #stats-menu,
body.idle-active #settings-menu,
body.idle-active #bankroll-display,
body.idle-active #bankroll-log {
  display: none !important;
}

body.idle-active #game-wrapper {
  padding-right: 1.25rem;
}

#idle-realms {
  display: grid;
  gap: 1rem;
  width: min(78rem, 100%);
  margin: 0 auto;
}

.idle-hero,
.idle-panel {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius);
  background: rgba(18, 21, 17, 0.86);
  box-shadow: var(--shadow);
}

.idle-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  background:
    linear-gradient(120deg, rgba(52, 168, 83, 0.16), rgba(61, 114, 217, 0.12)),
    rgba(18, 21, 17, 0.88);
}

.idle-kicker {
  margin: 0 0 0.3rem;
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.idle-hero h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  letter-spacing: 0;
}

.idle-hero p:last-child {
  max-width: 42rem;
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.idle-gold {
  min-width: 8rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: rgba(229, 184, 91, 0.1);
  text-align: right;
}

.idle-gold span,
.idle-panel-head span,
.idle-action small,
.idle-upgrade small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.idle-gold strong {
  display: block;
  color: var(--accent-strong);
  font-size: 2rem;
  line-height: 1;
}

.idle-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(18rem, 0.8fr);
  gap: 1rem;
}

.idle-panel {
  padding: 1rem;
}

.idle-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.idle-panel-head h3 {
  margin: 0;
  font-size: 1rem;
}

.idle-actions,
.idle-upgrades,
.idle-inventory,
.idle-log {
  display: grid;
  gap: 0.65rem;
}

.idle-action,
.idle-upgrade {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  width: 100%;
  min-height: 4.25rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  text-align: left;
}

.idle-action.selected {
  border-color: var(--border-strong);
  background: rgba(229, 184, 91, 0.14);
}

.idle-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 auto;
  border-radius: 7px;
  background: rgba(61, 114, 217, 0.2);
  color: #dce7ff;
  font-size: 0.76rem;
  font-weight: 900;
}

.idle-action span:nth-child(2),
.idle-upgrade span {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.idle-upgrade em {
  color: var(--accent-strong);
  font-style: normal;
  white-space: nowrap;
}

.idle-progress {
  margin-top: 1rem;
}

.idle-progress-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.idle-progress-track {
  height: 0.8rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.idle-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #34a853, #e5b85b);
  transition: width 180ms linear;
}

.idle-inventory div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
}

.idle-inventory p {
  margin: 0;
  color: var(--muted);
}

.idle-log {
  margin: 0;
  padding: 0;
  list-style: none;
}

.idle-log li {
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.88rem;
}

.menu-brand {
  grid-area: auto;
  align-items: center;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.menu-brand .brand-mark {
  width: 2.55rem;
  height: 2.55rem;
  border-color: var(--text);
  border-radius: 10px;
  background: var(--text);
  color: var(--canvas);
  box-shadow: none;
}

.menu-brand-copy {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.menu-kicker {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 900;
}

.portfolio-nav {
  grid-area: nav;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(1rem, 2vw, 2rem);
  min-height: 4.65rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(251, 251, 250, 0.84);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.nav-actions,
.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.nav-link,
.hero-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.55rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: none;
  transition: color 160ms var(--ease-out), background-color 160ms var(--ease-out), transform 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.nav-link:active,
.hero-link:active {
  transform: scale(0.97);
}

.primary-link {
  color: #f8f9ff;
  background: var(--text);
  padding-inline: 1rem;
}

.nav-link.is-active {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 0.14rem;
  text-underline-offset: 0.45rem;
}

.portfolio-hero {
  grid-area: hero;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(23rem, 1fr);
  align-items: center;
  gap: clamp(2.75rem, 7vw, 7.5rem);
  min-height: calc(100dvh - 7rem);
  padding-block: clamp(1.6rem, 4vw, 3.5rem) clamp(1rem, 2vw, 1.6rem);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.15rem;
  padding: 0;
}

.menu h1,
.hero-copy h1 {
  display: block;
  margin: 0;
  max-width: none;
  color: var(--text);
  font-size: clamp(3.5rem, 5.9vw, 7.1rem);
  line-height: 1.02;
  letter-spacing: 0;
  white-space: nowrap;
}

.hero-word {
  display: inline-block;
  padding-bottom: 0.06em;
  margin-bottom: -0.06em;
  transform-origin: 0 100%;
}

.hero-summary {
  max-width: 32rem;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.06rem, 1.45vw, 1.24rem);
  line-height: 1.55;
  text-wrap: pretty;
}

.hero-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  min-height: 3.35rem;
  padding: 0.7rem 1.55rem;
  border-color: var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #f8f9ff;
  text-decoration: none;
  transform: translateZ(0);
}

.hero-button span:last-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 160ms var(--ease-out);
}

.hero-link {
  min-height: 3.35rem;
  padding: 0.7rem 1.35rem;
  border-color: rgba(35, 68, 216, 0.42);
  color: var(--text);
}

.hero-code-card {
  position: relative;
  justify-self: end;
  width: min(44.5rem, 100%);
  overflow: hidden;
  border: 1px solid rgba(17, 24, 39, 0.13);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(56, 87, 255, 0.06), rgba(255, 255, 255, 0) 42%),
    #fbfcff;
  box-shadow: 0 28px 88px rgba(17, 24, 39, 0.1);
  transition:
    width 680ms cubic-bezier(0.16, 1, 0.3, 1),
    height 680ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 260ms var(--ease-out),
    box-shadow 260ms var(--ease-out);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.hero-code-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0) 27%),
    linear-gradient(270deg, rgba(56, 87, 255, 0.08), rgba(56, 87, 255, 0) 48%);
  mix-blend-mode: multiply;
}

.hero-code-card * {
  -webkit-user-select: none;
  user-select: none;
}

.hero-code-card.is-previewing {
  border-color: rgba(75, 111, 255, 0.32);
  box-shadow: 0 30px 84px rgba(75, 111, 255, 0.13);
}

.code-card-bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 3rem;
  padding: 0 0.92rem;
  border-bottom: 1px solid rgba(17, 24, 39, 0.1);
  background: rgba(244, 246, 250, 0.86);
}

.code-window-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.52rem;
  flex: 0 0 auto;
}

.code-window-controls span {
  position: relative;
  display: grid;
  place-items: center;
  width: 0.82rem;
  height: 0.82rem;
  border-radius: 50%;
  background: #d0d6df;
  transition: transform 160ms var(--ease-out), filter 160ms var(--ease-out);
}

.code-window-controls span::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.58rem;
  height: 0.58rem;
  background: var(--control-glyph, rgba(20, 20, 22, 0.62));
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.84);
  transform-origin: center;
  transition: opacity 120ms var(--ease-out), transform 120ms var(--ease-out);
  -webkit-mask: var(--control-icon) center / contain no-repeat;
  mask: var(--control-icon) center / contain no-repeat;
}

.code-window-controls span::after {
  content: none;
}

.code-window-controls span:nth-child(1) {
  --control-glyph: rgba(107, 22, 22, 0.82);
  --control-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 3l6 6M9 3L3 9' stroke='black' stroke-width='2.25' stroke-linecap='round'/%3E%3C/svg%3E");
  background: #ff5f57;
}

.code-window-controls span:nth-child(2) {
  --control-glyph: rgba(103, 76, 9, 0.82);
  --control-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 6h6' stroke='black' stroke-width='2.35' stroke-linecap='round'/%3E%3C/svg%3E");
  background: #ffbd2e;
}

.code-window-controls span:nth-child(3) {
  --control-glyph: rgba(7, 86, 32, 0.84);
  --control-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 2.75v6.5M2.75 6h6.5' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
  background: #28c840;
}

@media (hover: hover) and (pointer: fine) {
  .hero-code-card:hover .code-window-controls span,
  .code-window-controls:hover span {
    transform: scale(1.05);
    filter: saturate(1.08);
  }

  .code-window-controls span:hover {
    transform: scale(1.16);
  }

  .hero-code-card:hover .code-window-controls span::before,
  .code-window-controls:hover span::before {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.code-card-title {
  font-family: ui-monospace, "SFMono-Regular", "SF Mono", Consolas, monospace;
  font-size: clamp(0.82rem, 1vw, 1rem);
  font-weight: 700;
}

.code-card-title {
  color: #747b88;
}

.hero-code-card pre {
  margin: 0;
  padding: clamp(1.35rem, 2.8vw, 2.05rem);
  overflow-x: auto;
  color: #202633;
  font-family: ui-monospace, "SFMono-Regular", "SF Mono", Consolas, monospace;
  font-size: clamp(0.86rem, 1.08vw, 1rem);
  line-height: 1.8;
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
  transition:
    opacity 240ms var(--ease-out),
    transform 360ms cubic-bezier(0.16, 1, 0.3, 1),
    filter 260ms var(--ease-out);
}

.hero-code-card pre code {
  display: block;
}

.terminal-projects-view {
  position: relative;
  z-index: 1;
  height: calc(100% - 3rem);
  padding: clamp(1rem, 2vw, 1.35rem);
  overflow: hidden;
  opacity: 0;
  transform: translateY(0.55rem) scale(0.992);
  filter: blur(8px);
  transition:
    opacity 320ms var(--ease-out),
    transform 560ms cubic-bezier(0.16, 1, 0.3, 1),
    filter 360ms var(--ease-out);
}

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

.projects-page {
  grid-area: hero;
  display: grid;
  align-content: start;
  min-height: calc(100dvh - 7rem);
  padding-block: clamp(1.5rem, 4vw, 3.25rem) clamp(2.4rem, 5vw, 4.5rem);
}

.projects-shell {
  display: grid;
  grid-template-columns: minmax(18rem, 0.72fr) minmax(0, 1fr);
  grid-template-areas:
    "header stage"
    "index index";
  gap: clamp(1.25rem, 3vw, 2.4rem) clamp(2rem, 5vw, 5rem);
  align-items: end;
}

.projects-header {
  grid-area: header;
  display: grid;
  gap: 0.8rem;
  max-width: 36rem;
}

.projects-kicker {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 900;
}

.projects-header h1 {
  margin: 0;
  max-width: 8ch;
  color: var(--text);
  font-size: clamp(4rem, 8vw, 8.5rem);
  line-height: 0.86;
  letter-spacing: 0;
}

.projects-header p:not(.projects-kicker) {
  max-width: 37rem;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.45vw, 1.22rem);
  line-height: 1.55;
}

.projects-stage {
  grid-area: stage;
  justify-self: end;
  display: grid;
  gap: 0.7rem;
  width: min(38rem, 100%);
}

.stage-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1.76 / 1;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.09);
}

.stage-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0) 24%),
    linear-gradient(0deg, rgba(17, 24, 39, 0.1), rgba(17, 24, 39, 0) 46%);
}

.stage-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.012);
  transition: transform 760ms cubic-bezier(0.16, 1, 0.3, 1), opacity 180ms var(--ease-out), filter 180ms var(--ease-out);
}

.projects-stage.is-switching .stage-frame img {
  opacity: 0;
  filter: blur(10px);
  transform: scale(1.08) translateY(1rem);
}

.projects-stage p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: right;
}

.project-index {
  grid-area: index;
  display: grid;
  margin-top: clamp(1rem, 3vw, 2rem);
  border-top: 1px solid var(--border);
}

.project-row {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr) minmax(16rem, 0.45fr);
  align-items: center;
  gap: clamp(1rem, 2.4vw, 2rem);
  min-height: clamp(8.4rem, 13vw, 11rem);
  padding-block: clamp(1rem, 2.6vw, 1.6rem);
  border-bottom: 1px solid var(--border);
  cursor: default;
  outline: 0;
  transition: transform 260ms var(--ease-out), border-color 260ms var(--ease-out), opacity 260ms var(--ease-out);
}

.project-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.project-number {
  color: var(--accent-strong);
  font-family: ui-monospace, "SFMono-Regular", "SF Mono", Consolas, monospace;
  font-size: 0.85rem;
  font-weight: 900;
}

.project-main {
  display: grid;
  gap: 0.45rem;
}

.project-main h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(2.15rem, 4.6vw, 5rem);
  line-height: 0.88;
  letter-spacing: 0;
}

.project-main p {
  max-width: 34rem;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.15vw, 1.08rem);
  line-height: 1.5;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.project-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 1.85rem;
  padding: 0.35rem 0.68rem;
  border: 1px solid rgba(31, 62, 210, 0.16);
  border-radius: 999px;
  background: rgba(238, 242, 255, 0.82);
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 900;
  white-space: nowrap;
}

[data-route-reveal] {
  opacity: 0;
  transform: translateY(1.35rem) scale(0.98);
}

.route-projects [data-route-reveal] {
  animation: routeReveal 760ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.route-projects .projects-stage[data-route-reveal] {
  animation-delay: 90ms;
}

.route-projects .project-index [data-route-reveal]:nth-child(1) {
  animation-delay: 120ms;
}

.route-projects .project-index [data-route-reveal]:nth-child(2) {
  animation-delay: 180ms;
}

.route-projects .project-index [data-route-reveal]:nth-child(3) {
  animation-delay: 240ms;
}

.route-projects .project-index [data-route-reveal]:nth-child(4) {
  animation-delay: 300ms;
}

.code-line {
  display: block;
  min-height: 1.8em;
}

.code-line.has-terminal-cursor::after {
  content: "";
  display: inline-block;
  width: 0.52em;
  height: 1.1em;
  margin-left: 0.22em;
  border-radius: 2px;
  background: var(--accent);
  vertical-align: -0.18em;
  animation: terminalCursorBlink 1.05s steps(2, end) infinite;
}

.hero-code-card.is-backspacing .code-line.has-terminal-cursor::after {
  animation-duration: 420ms;
}

.hero-code-card.is-typing .code-line.has-terminal-cursor::after {
  animation-duration: 560ms;
}

.hero-code-card.is-line-animating .code-line {
  animation: codeLineReveal 640ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--line-index) * 92ms);
}

.code-token.keyword,
.code-token.boolean {
  color: var(--accent-strong);
}

.code-token.variable {
  color: #111827;
}

.code-token.property {
  color: #7c3aed;
}

.code-token.operator {
  color: #64748b;
}

.code-token.string {
  color: #16803d;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(1.15rem);
  transition: opacity 620ms var(--ease-out), transform 620ms var(--ease-out);
}

[data-reveal-delay="1"] {
  transition-delay: 120ms;
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (hover: hover) and (pointer: fine) {
  button:hover,
  .primary-link:hover {
    background: #2a2a2a;
  }

  .nav-link:hover,
  .hero-link:hover {
    color: var(--text);
    background: var(--surface);
  }

  .hero-button:hover {
    border-color: var(--accent-strong);
    background: var(--accent-strong);
    color: #f8f9ff;
  }

  .hero-button:hover span:last-child {
    transform: translateX(2px);
  }

  .project-row:hover,
  .project-row:focus-visible,
  .project-row.is-active {
    border-color: rgba(31, 62, 210, 0.28);
    transform: translateX(0.6rem);
  }

  .project-row:hover .project-main h2,
  .project-row:hover .project-main h3,
  .project-row:focus-visible .project-main h2,
  .project-row:focus-visible .project-main h3,
  .project-row.is-active .project-main h2,
  .project-row.is-active .project-main h3 {
    color: var(--accent-strong);
  }

  .project-row:hover .project-tags span,
  .project-row:focus-visible .project-tags span,
  .project-row.is-active .project-tags span {
    border-color: rgba(31, 62, 210, 0.26);
    background: #ffffff;
  }

  .projects-stage:hover .stage-frame img {
    transform: scale(1.045);
  }

}

.hero-code-card.is-project-window {
  width: min(31rem, 100%);
  height: clamp(37rem, 72vh, 43rem);
  min-height: 0;
  border-color: rgba(31, 62, 210, 0.18);
  box-shadow: 0 36px 110px rgba(17, 24, 39, 0.13);
}

.hero-code-card.is-project-window::after {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0) 22%),
    linear-gradient(270deg, rgba(56, 87, 255, 0.07), rgba(56, 87, 255, 0) 52%);
}

.hero-code-card.is-content-leaving pre:not([hidden]),
.hero-code-card.is-content-leaving .terminal-projects-view:not([hidden]) {
  opacity: 0;
  transform: translateY(0.55rem) scale(0.988);
  filter: blur(8px);
}

.hero-code-card.is-content-entering pre:not([hidden]),
.hero-code-card.is-content-entering .terminal-projects-view:not([hidden]) {
  opacity: 0;
  transform: translateY(0.55rem) scale(0.992);
  filter: blur(8px);
}

.hero-code-card.is-project-window .terminal-projects-view:not([hidden]) {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

.hero-code-card.is-content-leaving pre:not([hidden]),
.hero-code-card.is-content-leaving .terminal-projects-view:not([hidden]),
.hero-code-card.is-content-entering pre:not([hidden]),
.hero-code-card.is-content-entering .terminal-projects-view:not([hidden]) {
  opacity: 0;
  transform: translateY(0.55rem) scale(0.992);
  filter: blur(8px);
}

.terminal-projects-view .projects-shell {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "index";
  height: 100%;
  gap: clamp(0.9rem, 1.8vw, 1.25rem);
  align-items: stretch;
}

.terminal-projects-view [data-route-reveal] {
  animation: none !important;
}

.terminal-projects-view .projects-header {
  gap: 0.5rem;
  max-width: 24rem;
}

.terminal-projects-view .projects-kicker {
  font-size: 0.74rem;
}

.terminal-projects-view .projects-header h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(2.15rem, 4.1vw, 3.15rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.terminal-projects-view .projects-header p:not(.projects-kicker) {
  max-width: 24rem;
  font-size: clamp(0.9rem, 1.05vw, 1rem);
  line-height: 1.45;
}

.terminal-projects-view .projects-stage {
  width: 100%;
  gap: 0.45rem;
}

.terminal-projects-view .stage-frame {
  border-radius: 12px;
  box-shadow: 0 18px 56px rgba(15, 23, 42, 0.09);
}

.terminal-projects-view .projects-stage p {
  font-size: 0.76rem;
}

.terminal-projects-view .project-index {
  min-height: 0;
  max-height: none;
  height: 100%;
  margin-top: 0;
  border-top: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.terminal-projects-view .project-row {
  grid-template-columns: 1.7rem minmax(0, 1fr);
  gap: 0.75rem 0.9rem;
  min-height: 0;
  padding-block: 0.74rem;
  opacity: 0;
  transform: translateY(0.65rem);
  transition:
    opacity 420ms var(--ease-out),
    transform 620ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 260ms var(--ease-out);
}

.hero-code-card.is-project-window:not(.is-content-entering):not(.is-content-leaving) .terminal-projects-view .project-row {
  opacity: 1;
  transform: translateY(0);
}

.hero-code-card.is-project-window:not(.is-content-entering):not(.is-content-leaving) .terminal-projects-view .project-row:nth-child(1) {
  transition-delay: 60ms;
}

.hero-code-card.is-project-window:not(.is-content-entering):not(.is-content-leaving) .terminal-projects-view .project-row:nth-child(2) {
  transition-delay: 105ms;
}

.hero-code-card.is-project-window:not(.is-content-entering):not(.is-content-leaving) .terminal-projects-view .project-row:nth-child(3) {
  transition-delay: 150ms;
}

.hero-code-card.is-project-window:not(.is-content-entering):not(.is-content-leaving) .terminal-projects-view .project-row:nth-child(4) {
  transition-delay: 195ms;
}

.terminal-projects-view .project-main {
  gap: 0.25rem;
}

.terminal-projects-view .project-main h3 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.16rem, 2.1vw, 1.75rem);
  line-height: 1;
  letter-spacing: 0;
}

.terminal-projects-view .project-main p {
  max-width: 29rem;
  font-size: 0.84rem;
  line-height: 1.4;
}

.terminal-projects-view .project-tags {
  grid-column: 2;
  justify-content: flex-start;
  gap: 0.34rem;
}

.terminal-projects-view .project-tags span {
  min-height: 1.55rem;
  padding: 0.26rem 0.5rem;
  font-size: 0.64rem;
}

@media (min-width: 981px) {
  .hero-code-card,
  .hero-code-card.is-visible {
    position: absolute;
    top: 50%;
    right: 0;
    width: min(34.6rem, 100%);
    transform: translateY(-50%);
  }

  .hero-code-card.is-project-window {
    width: min(31rem, 100%);
  }
}

body.game-active .menu {
  inset: 0 auto 0 0;
  width: 14.75rem;
  padding: 4.75rem 0.7rem 1rem;
  place-items: start stretch;
  overflow: visible;
  border: 0;
  background: transparent;
  backdrop-filter: blur(12px);
  animation: sidebarSlideIn 260ms ease both;
  transition: width 220ms ease, padding 220ms ease, background 220ms ease;
}

.sidebar-toggle {
  display: none;
}

body.game-active .sidebar-toggle {
  position: absolute;
  top: 5.35rem;
  right: -0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  min-height: 1.85rem;
  padding: 0;
  border-radius: 50%;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(36, 36, 38, 0.96);
  color: #f5f5f7;
  box-shadow: none;
  z-index: 2;
}

body.game-active.sidebar-collapsed .menu {
  width: 3.5rem;
  padding-inline: 0.55rem;
}

body.game-active.sidebar-collapsed .menu-panel {
  opacity: 0;
  pointer-events: none;
}

body.game-active.sidebar-collapsed #top-bar {
  padding-left: 4.75rem;
}

body.game-active.sidebar-collapsed #game-wrapper {
  padding-left: 4.75rem;
}

body.game-active .menu-panel {
  display: block;
  width: 100%;
  min-height: calc(100dvh - 6.1rem);
  padding: 0.55rem;
  border: 1px solid rgba(242, 222, 177, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(229, 184, 91, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(13, 14, 10, 0.94);
  box-shadow: none;
  transition: opacity 180ms ease;
}

body.game-active .portfolio-nav,
body.game-active .portfolio-hero,
body.game-active .projects-page,
body.game-active .menu-brand {
  display: none;
}

@keyframes sidebarSlideIn {
  from {
    opacity: 0;
    transform: translateX(-100%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes cardBreathe {
  0%,
  100% {
    box-shadow: 0 28px 88px rgba(17, 24, 39, 0.1);
  }

  50% {
    box-shadow: 0 34px 104px rgba(31, 62, 210, 0.14);
  }
}

@keyframes heroWordReveal {
  from {
    opacity: 0;
    transform: translate3d(0, 1.2rem, 0) rotateX(28deg);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotateX(0);
  }
}

@keyframes codeLineReveal {
  from {
    opacity: 0;
    filter: blur(2px);
    transform: translate3d(0, 0.48rem, 0);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: translate3d(0, 0, 0);
  }
}

@keyframes routeReveal {
  from {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(1.35rem) scale(0.98);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
  }
}

@keyframes terminalCursorBlink {
  0%,
  46% {
    opacity: 1;
  }

  47%,
  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-copy.is-visible .hero-word {
    animation: heroWordReveal 900ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .hero-copy.is-visible .hero-word:nth-child(1) {
    animation-delay: 40ms;
  }

  .hero-copy.is-visible .hero-word:nth-child(2) {
    animation-delay: 150ms;
  }

  .hero-copy.is-visible .hero-word:nth-child(3) {
    animation-delay: 260ms;
  }

  .hero-code-card {
    animation: cardBreathe 7s var(--ease-out) infinite;
  }
}

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

  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }

  [data-route-reveal] {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .code-line.has-terminal-cursor::after {
    animation: none !important;
  }
}

#game-wrapper {
  display: none;
  width: 100%;
  min-height: 100dvh;
  padding: 5.25rem 1.25rem 2rem 15rem;
}

body.game-active #game-wrapper {
  display: block;
}

#game-container {
  display: none;
  width: min(61rem, 100%);
  margin: 0 auto;
  opacity: 0;
  transition: opacity 240ms ease;
}

body.game-active #game-container {
  display: block;
  opacity: 1;
}

.play-shell {
  display: grid;
  gap: 1rem;
}

.table-head {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 1rem;
}

.table-head h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.75rem);
  line-height: 1;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

#table {
  position: relative;
  display: grid;
  gap: 1rem;
  min-height: 30rem;
  padding: 1rem;
  border: 1px solid rgba(246, 221, 156, 0.26);
  border-radius: var(--radius);
  background:
    radial-gradient(ellipse at 50% 52%, rgba(255, 255, 255, 0.16), transparent 68%),
    radial-gradient(ellipse at 50% 118%, rgba(246, 221, 156, 0.32), transparent 34%),
    linear-gradient(180deg, #157048, #0d472d);
  box-shadow: inset 0 0 0 0.45rem rgba(20, 12, 7, 0.35), var(--shadow);
}

.result-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  min-width: min(21rem, calc(100% - 2rem));
  max-width: calc(100% - 2rem);
  padding: 1rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(17, 18, 15, 0.92);
  color: var(--text);
  box-shadow: var(--shadow);
  text-align: center;
  font-size: clamp(1.35rem, 4vw, 2.25rem);
  font-weight: 900;
  line-height: 1.05;
  opacity: 0;
  transform: translate(-50%, -42%) scale(0.96);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.result-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.result-toast.loss {
  border-color: rgba(255, 112, 101, 0.42);
  color: #ffb0aa;
}

.result-toast.win {
  border-color: rgba(103, 217, 133, 0.48);
  color: #a9efbd;
}

.result-toast.push {
  border-color: rgba(255, 209, 102, 0.5);
  color: var(--accent-strong);
}

.result-toast.player-blackjack {
  border-color: rgba(103, 217, 133, 0.62);
  color: #bdf7cc;
  background: linear-gradient(180deg, rgba(21, 70, 39, 0.96), rgba(17, 18, 15, 0.94));
}

.result-toast.dealer-blackjack {
  border-color: rgba(255, 112, 101, 0.58);
  color: #ffc0bb;
  background: linear-gradient(180deg, rgba(84, 24, 24, 0.96), rgba(17, 18, 15, 0.94));
}

.table-zone {
  display: grid;
  grid-template-rows: auto minmax(7.4rem, 1fr);
  align-content: stretch;
  min-height: 12.75rem;
  padding: 1rem;
  border: 1px solid rgba(246, 221, 156, 0.18);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(0, 0, 0, 0.12));
}

.zone-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.zone-title small {
  display: none;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: none;
}

.hand {
  display: grid;
  justify-items: center;
  gap: 0.55rem;
  min-height: 6.6rem;
  padding: 0.5rem;
  border-radius: var(--radius);
}

.hand.win .card {
  box-shadow: 0 0 0 3px rgba(89, 217, 123, 0.48), 0 18px 24px rgba(0, 0, 0, 0.22);
}

.hand.loss .card {
  box-shadow: 0 0 0 3px rgba(255, 112, 101, 0.5), 0 18px 24px rgba(0, 0, 0, 0.22);
}

.hand.push .card {
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.5), 0 18px 24px rgba(0, 0, 0, 0.22);
}

.cards {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  min-height: 6rem;
}

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  min-height: 1.8rem;
  padding: 0.18rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--accent-strong);
  font-weight: 900;
}

#player-hands {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  min-height: 7.4rem;
}

#player-hands.split {
  flex-direction: row;
  justify-content: center;
  flex-wrap: wrap;
}

.card {
  position: relative;
  display: inline-block;
  width: clamp(3.45rem, 8vw, 4.5rem);
  aspect-ratio: 2 / 3;
  padding: 0.34rem;
  border: 1px solid rgba(0, 0, 0, 0.22);
  border-radius: 8px;
  background: linear-gradient(145deg, #fffdf7, #e6dcc8);
  color: #17120a;
  font-weight: 900;
  box-shadow: 0 14px 18px rgba(0, 0, 0, 0.22);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.card .corner {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  font-size: clamp(0.72rem, 1.4vw, 0.92rem);
  line-height: 1;
}

.card .corner.bottom {
  inset: auto 0.35rem 0.35rem auto;
  transform: rotate(180deg);
}

.card .suit {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(1.35rem, 4vw, 2rem);
}

.card.hearts,
.card.diamonds {
  color: #c92d24;
}

.card.back {
  border: 0.22rem solid #f2d88d;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.16) 0 0.28rem, transparent 0.28rem 0.58rem),
    linear-gradient(145deg, #6e1d28, #281116);
}

.decision-stage {
  position: relative;
  min-height: 6.7rem;
}

#bet-options,
#controls {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  min-height: 5.6rem;
  padding: 0.9rem;
  border: 1px solid rgba(246, 221, 156, 0.22);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.045));
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
}

.bet-readout {
  display: grid;
  gap: 0.1rem;
  min-width: 7.5rem;
  padding-right: 0.8rem;
}

.bet-readout span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.bet-readout strong {
  color: var(--accent-strong);
  font-size: 1.45rem;
  line-height: 1;
}

#chips,
#bet-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

#bet-options {
  display: grid;
  grid-template-columns: minmax(9.5rem, auto) auto minmax(16rem, 1fr);
  align-items: center;
}

#chips {
  justify-content: flex-start;
}

#bet-buttons {
  justify-content: flex-start;
  min-width: 16rem;
}

#chips .chip {
  position: relative;
  width: 3.25rem;
  height: 3.25rem;
  min-height: 3.25rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow:
    inset 0 0 0 0.16rem rgba(0, 0, 0, 0.18),
    inset 0 -0.45rem 0 rgba(0, 0, 0, 0.18),
    0 10px 18px rgba(0, 0, 0, 0.28);
}

#chips .chip::before {
  content: "";
  position: absolute;
  inset: 0.33rem;
  border: 1px dashed rgba(17, 18, 15, 0.32);
  border-radius: inherit;
  pointer-events: none;
}

#chips .chip.red {
  background: radial-gradient(circle, #f47067 0 31%, var(--red) 32% 100%);
}

#chips .chip.green {
  background: radial-gradient(circle, #68d283 0 31%, #168247 32% 100%);
}

#chips .chip.blue {
  background: radial-gradient(circle, #78a3ff 0 31%, var(--blue) 32% 100%);
}

#chips .chip.purple {
  background: radial-gradient(circle, #b99cff 0 31%, var(--purple) 32% 100%);
}

#deal {
  min-width: 6.75rem;
}

#controls {
  justify-content: center;
  opacity: 0;
  transform: translateY(0.65rem);
  pointer-events: none;
}

#controls button {
  min-width: 5.3rem;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

#controls button {
  position: absolute;
  width: 0;
  min-width: 0;
  opacity: 0;
  transform: translateY(0.45rem) scale(0.97);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    min-width 180ms ease,
    padding 180ms ease;
}

#controls button.active-control {
  position: static;
  width: auto;
  min-width: 5.3rem;
  opacity: 1;
  transform: translateY(0) scale(1);
  padding-inline: 1rem;
  pointer-events: auto;
}

#bet-buttons button {
  display: none;
  min-width: 4.1rem;
  min-height: 2.75rem;
  padding-inline: 0.85rem;
  margin: 0;
  opacity: 0;
  transform: translateY(0.35rem);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    filter 180ms ease,
    border-color 180ms ease;
}

#bet-buttons button.active-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#bet-buttons .secondary-action {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

#bet-buttons .secondary-action.active-control {
  border-color: rgba(246, 221, 156, 0.24);
}

#bet-buttons .primary-action {
  min-width: 6.75rem;
  background: linear-gradient(180deg, #54d17b, #218a49);
  color: #06120a;
}

#deal.ready {
  box-shadow: 0 0 0 1px rgba(103, 217, 133, 0.22), 0 14px 28px rgba(33, 138, 73, 0.28);
}

#deal:disabled {
  opacity: 0.45;
  transform: none;
  pointer-events: none;
}

#bet-options,
#controls {
  transition: opacity 220ms ease, transform 220ms ease, filter 220ms ease, visibility 220ms ease;
}

#bet-options.hidden-panel {
  opacity: 0;
  transform: translateY(-0.65rem);
  visibility: hidden;
  pointer-events: none;
}

#controls.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.bet-readout {
  min-width: 9.5rem;
  padding: 0.72rem 0.9rem;
  border: 1px solid rgba(255, 209, 102, 0.34);
  border-radius: 7px;
  background: rgba(255, 209, 102, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.bet-readout strong {
  font-size: 2.35rem;
}

#hit {
  border-color: rgba(82, 200, 121, 0.42);
}

#stand {
  border-color: rgba(255, 209, 102, 0.42);
}

#double,
#split {
  border-color: rgba(127, 166, 255, 0.42);
}

.recommendation {
  min-height: 6.6rem;
  padding: 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(229, 184, 91, 0.13), rgba(255, 255, 255, 0.06));
  color: var(--text);
  line-height: 1.45;
}

.recommendation .action {
  color: var(--accent-strong);
  font-size: 1.2rem;
  font-weight: 900;
}

.recommendation .explanation {
  margin-top: 0.35rem;
  color: var(--muted);
}

#game-info,
#stats-menu,
#settings-menu {
  display: none;
  position: fixed;
  top: 5.5rem;
  left: 14.75rem;
  z-index: 25;
  width: 14rem;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(16, 18, 15, 0.92);
  box-shadow: var(--shadow);
}

body.game-active #game-info,
body.game-active #stats-menu,
body.game-active #settings-menu {
  display: grid;
  gap: 0.6rem;
}

#stats-menu {
  top: 21rem;
  right: 1rem;
  left: auto;
}

#settings-menu {
  top: 29.5rem;
  right: 1rem;
  left: auto;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 900;
}

.panel-body {
  display: grid;
  gap: 0.6rem;
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.metric-row strong {
  color: var(--text);
  font-size: 0.95rem;
}

#count-log {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-height: 2.4rem;
  max-height: 5rem;
  overflow: auto;
  padding: 0.55rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.76rem;
}

#count-log span {
  display: inline-flex;
  align-items: center;
}

.popover,
#bankroll-log {
  position: fixed;
  top: 5rem;
  right: 1rem;
  z-index: 40;
  width: min(23rem, calc(100vw - 2rem));
  max-height: calc(100vh - 6rem);
  overflow: auto;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(16, 18, 15, 0.96);
  color: var(--text);
  box-shadow: var(--shadow);
}

#bankroll-log {
  display: none;
}

#bankroll-log.show {
  display: block;
}

#stats-menu ul,
#bankroll-log {
  list-style: none;
}

#stats-menu ul,
#bankroll-log {
  margin: 0;
}

#stats-menu ul {
  padding: 0;
}

#stats-menu li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  color: var(--muted);
}

#stats-menu li.divider {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#stats-menu strong {
  color: var(--text);
}

.stats-actions,
.settings-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

#settings-menu .settings-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

#stats-menu .stats-actions {
  display: grid;
  grid-template-columns: 1fr;
}

#stats-menu .stats-actions button {
  width: 100%;
  min-height: 2.25rem;
  padding: 0.45rem 0.55rem;
  font-size: 0.78rem;
}

#settings-menu label {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.82rem;
}

#settings-menu input {
  width: 100%;
  min-height: 2.35rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 0.35rem 0.55rem;
}

#bankroll-log {
  padding: 0.5rem 0.85rem;
}

#bankroll-log li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 800;
}

#bankroll-log li span {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

#bankroll-log li strong {
  font: inherit;
}

#bankroll-log li.win {
  color: #67d985;
}

#bankroll-log li.loss {
  color: #ff7f76;
}

#bankroll-log li.push {
  color: var(--accent-strong);
}

@keyframes moneyUp {
  0% { color: var(--accent-strong); transform: scale(1); }
  50% { color: #67d985; transform: scale(1.18); }
  100% { color: var(--accent-strong); transform: scale(1); }
}

@keyframes moneyDown {
  0% { color: var(--accent-strong); transform: scale(1); }
  50% { color: #ff7f76; transform: scale(0.92); }
  100% { color: var(--accent-strong); transform: scale(1); }
}

.money-up {
  animation: moneyUp 0.6s ease;
}

.money-down {
  animation: moneyDown 0.6s ease;
}

#reset-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.74);
}

#reset-overlay .dialog {
  width: min(24rem, 100%);
  padding: 1.25rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #151713;
  text-align: center;
  box-shadow: var(--shadow);
}

#reset-overlay .dialog p {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.45;
}

.bankrupt-stats {
  display: grid;
  gap: 0.45rem;
  margin: 0 0 1rem;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(229, 184, 91, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.04);
  text-align: left;
}

.bankrupt-stats div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.bankrupt-stats dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.bankrupt-stats dd {
  margin: 0;
  color: var(--text);
  font-weight: 900;
}

@media (max-width: 980px) {
  .menu {
    align-items: start;
  }

  .menu-panel {
    grid-template-columns: 1fr;
    grid-template-areas:
      "nav"
      "hero";
  }

  .portfolio-hero {
    grid-template-columns: 1fr;
    min-height: auto;
    gap: 2rem;
  }

  .hero-copy {
    padding: 0;
  }

  .hero-code-card {
    max-width: 44rem;
    margin-inline: auto;
  }

  .hero-code-card.is-project-window {
    position: relative;
    top: auto;
    right: auto;
    transform: none;
    width: min(44rem, 100%);
    height: auto;
    min-height: auto;
  }

  .hero-copy h1 {
    font-size: 4.1rem;
  }

  .projects-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "stage"
      "index";
    align-items: start;
  }

  .terminal-projects-view .projects-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "stage"
      "index";
  }

  .projects-stage {
    justify-self: stretch;
    width: 100%;
  }

  .projects-stage p {
    text-align: left;
  }

  .project-row {
    grid-template-columns: 2.4rem minmax(0, 1fr);
    align-items: start;
  }

  .terminal-projects-view .project-row {
    grid-template-columns: 2.4rem minmax(0, 1fr);
  }

  .project-tags {
    grid-column: 2;
    justify-content: flex-start;
  }

  .terminal-projects-view .project-tags {
    grid-column: 2;
    justify-content: flex-start;
  }

  #top-bar {
    padding-left: 1rem;
  }

  body.game-active .menu {
    position: static;
    width: 100%;
    padding: 5rem 1rem 0;
    border-right: 0;
  }

  body.game-active .menu-panel {
    min-height: 0;
  }

  #game-wrapper {
    padding: 1rem;
  }

  #game-info,
  #stats-menu {
    position: static;
    width: auto;
    margin: 0 1rem 1rem;
    cursor: default;
  }

  body.game-active {
    display: flex;
    flex-direction: column;
  }

  .decision-stage {
    min-height: 12.5rem;
  }

  #bet-options,
  #controls {
    align-content: center;
  }

  #controls {
    min-width: 0;
  }
}

@media (max-width: 700px) {
  .menu {
    padding: 0 1rem;
  }

  .menu-panel {
    padding: 0.75rem 0 1rem;
  }

  .hero-copy {
    padding: 0;
  }

  .hero-copy h1 {
    max-width: none;
    font-size: 3.45rem;
    line-height: 0.9;
  }

  .hero-summary {
    font-size: 1rem;
  }

  .hero-actions {
    gap: 0.6rem;
  }

  .hero-button,
  .hero-link {
    min-height: 3rem;
    padding: 0.62rem 1rem;
  }

  .hero-code-card {
    max-width: 100%;
  }

  .terminal-projects-view {
    padding: 0.85rem;
  }

  .projects-page {
    padding-block: 2rem 2.5rem;
  }

  .projects-header h1 {
    font-size: 3.2rem;
  }

  .projects-shell {
    gap: 1.25rem;
  }

  .project-row {
    min-height: 0;
    padding-block: 1rem;
  }

  .project-main h2 {
    font-size: 2rem;
    line-height: 0.95;
  }

  .terminal-projects-view .project-main h3 {
    font-size: 1.3rem;
    line-height: 0.98;
  }

  .project-tags span {
    min-height: 1.7rem;
    padding: 0.3rem 0.55rem;
    font-size: 0.68rem;
  }

  .portfolio-nav,
  .menu-brand {
    align-items: flex-start;
  }

  .portfolio-nav {
    position: relative;
    top: auto;
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 0 0.75rem;
    border-bottom: 1px solid var(--border);
    background: transparent;
    backdrop-filter: none;
  }

  .nav-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .nav-link {
    flex: 1 1 calc(50% - 0.5rem);
    min-height: 2.25rem;
    padding: 0.42rem 0.5rem;
    font-size: 0.8rem;
  }

  #top-bar {
    align-items: flex-start;
    flex-direction: column;
    min-height: auto;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .table-head {
    flex-direction: column;
  }

  #table {
    min-height: 26rem;
  }

  .table-zone {
    min-height: 10.5rem;
  }

  #settings-menu {
    right: 1rem;
  }

  #settings-menu label {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .hero-copy h1 {
    font-size: 2.75rem;
  }
}
