:root {
  color-scheme: light;
  --arcade-ink: #170d12;
  --arcade-black: #10090d;
  --arcade-blush: #f6e4e9;
  --arcade-paper: #fff9fa;
  --arcade-pink: #f09ab4;
  --arcade-rose: #a43e60;
  --arcade-muted: #705862;
  --arcade-serif: "Playfair Display", Georgia, serif;
  --arcade-sans: "DM Sans", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; scroll-padding-top: 82px; }
body {
  min-width: 320px;
  margin: 0;
  color: var(--arcade-ink);
  background: var(--arcade-blush);
  font-family: var(--arcade-sans);
  -webkit-font-smoothing: antialiased;
}
body, main, section, article, nav, header, footer { max-width: 100%; }
button, input, select { color: inherit; font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #7c2445;
  outline-offset: 3px;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.arcade-shell { width: min(100%, 1180px); margin-inline: auto; padding-inline: 16px; }

/* Compact branded navigation */
.arcade-header {
  position: sticky;
  z-index: 30;
  top: 0;
  padding-top: env(safe-area-inset-top);
  color: #fff8fa;
  background: rgba(16, 9, 13, .97);
  border-bottom: 1px solid rgba(240, 154, 180, .45);
  box-shadow: 0 8px 22px rgba(26, 8, 15, .14);
}
.arcade-header-inner {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: min(100%, 1180px);
  min-height: 64px;
  margin-inline: auto;
  padding: 8px 12px;
}
.arcade-logo { display: block; width: 40px; height: 40px; border: 1px solid var(--arcade-pink); border-radius: 50%; object-fit: cover; }
.arcade-wordmark { display: block; min-width: 0; font: 600 12px/1.1 var(--arcade-serif); letter-spacing: .075em; white-space: nowrap; }
.arcade-wordmark small { display: block; margin-top: 5px; color: #f4a2ba; font: 700 9px/1 var(--arcade-sans); letter-spacing: .17em; }
.arcade-nav { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.arcade-nav a { display: inline-flex; min-height: 40px; align-items: center; padding: 0 4px; color: #f8eaf0; font-size: 10px; font-weight: 700; letter-spacing: .045em; white-space: nowrap; }
.arcade-nav a:last-child { color: #ffb1c7; }

/* Editorial introduction */
.arcade-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin: 16px auto 22px;
  padding: 27px 20px 25px;
  color: #fff8fa;
  background: linear-gradient(112deg, #180b11 0%, #25101a 63%, #381322 100%);
  border: 1px solid rgba(240, 154, 180, .56);
  border-radius: 22px;
  box-shadow: 0 16px 36px rgba(51, 15, 29, .18);
}
.arcade-hero::after {
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  width: 22%;
  height: 100%;
  background: linear-gradient(90deg, #1a0b12 0%, rgba(26, 11, 18, .2) 100%), url("/assets/tpr-leopard-texture.jpeg") center / cover;
  content: "";
  opacity: .3;
  pointer-events: none;
}
.hero-copy { max-width: 740px; }
.eyebrow { margin: 0; color: #a23c5c; font-size: 10px; font-weight: 800; letter-spacing: .24em; line-height: 1.5; text-transform: uppercase; }
.arcade-hero .eyebrow { color: #ffadc4; }
.arcade-hero h1 { margin: 10px 0 11px; font: 500 clamp(40px, 12vw, 68px)/.92 var(--arcade-serif); letter-spacing: -.045em; }
.arcade-hero h1 em { color: #f29ab5; font-weight: 400; }
.arcade-hero p { max-width: 570px; margin: 0; color: #f4e4ea; font-size: 14px; line-height: 1.65; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 19px; }
.button-primary, .play-button, .button-outline {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid var(--arcade-pink);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  line-height: 1.25;
  text-align: center;
  text-transform: uppercase;
  touch-action: manipulation;
  cursor: pointer;
}
.button-primary { color: #170c11; background: #f3a1ba; border-color: #f3a1ba; }
.button-outline { color: #fff7fa; background: transparent; }
.button-primary:hover, .play-button:hover { background: #ffb6ca; }

/* Category discovery */
.arcade-section { margin-block: 26px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-heading h2 { margin: 4px 0 0; font: 500 clamp(25px, 7vw, 34px)/1.05 var(--arcade-serif); letter-spacing: -.025em; }
.section-note { max-width: 240px; margin: 0; color: var(--arcade-muted); font-size: 12px; line-height: 1.5; text-align: right; }
.category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.category-tile {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 104px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px;
  overflow: hidden;
  color: #fff6f9;
  background: #1a0d13;
  border: 1px solid rgba(151, 57, 88, .54);
  border-radius: 15px;
  text-align: left;
  touch-action: manipulation;
  cursor: pointer;
  transition: border-color .18s ease, transform .18s ease, background-color .18s ease;
}
.category-tile::after { position: absolute; top: 0; right: 0; width: 24%; height: 100%; background: linear-gradient(90deg, #1a0d13 0%, rgba(240, 154, 180, .08) 100%), url("/assets/tpr-leopard-texture.jpeg") center / cover; content: ""; opacity: .28; pointer-events: none; }
.category-tile:nth-child(2) { background: #351421; }
.category-tile:nth-child(3) { color: #28141d; background: #f2cbd6; border-color: #df9eb2; }
.category-tile:nth-child(3)::after { background: linear-gradient(90deg, #f2cbd6 0%, rgba(240, 154, 180, .15) 100%), url("/assets/tpr-leopard-texture.jpeg") center / cover; opacity: .16; }
.category-tile:nth-child(4) { background: #24111a; }
.category-tile:nth-child(5) { grid-column: 1 / -1; min-height: 82px; background: #6f2941; }
.category-tile:hover, .category-tile[aria-pressed="true"] { border-color: #ffb5c9; box-shadow: inset 0 0 0 1px #ffb5c9; transform: translateY(-1px); }
.category-tile:active { transform: scale(.985); }
.category-index { position: relative; z-index: 1; color: #f0a0b8; font: italic 14px var(--arcade-serif); }
.category-tile:nth-child(3) .category-index { color: #8b3150; }
.category-name { position: relative; z-index: 1; max-width: 100%; font: 500 16px/1.1 var(--arcade-serif); }
.category-count { position: relative; z-index: 1; margin-top: 5px; color: #e9b5c4; font-size: 10px; letter-spacing: .04em; }
.category-tile:nth-child(3) .category-count { color: #784354; }

/* Featured catalog selections */
.featured-primary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
  padding: 18px;
  color: #fff8fa;
  background: linear-gradient(120deg, #180b11 0%, #32121f 68%, #512034 100%);
  border: 1px solid rgba(240, 154, 180, .65);
  border-radius: 18px;
}
.feature-copy { min-width: 0; }
.feature-number { color: #f4a2ba; font: italic 13px var(--arcade-serif); }
.feature-label { margin: 9px 0 4px; color: #f5a8be; font-size: 9px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.feature-title { margin: 0; font: 500 clamp(21px, 6vw, 31px)/1.05 var(--arcade-serif); }
.feature-description { margin: 7px 0 0; color: #f1dfe6; font-size: 12px; line-height: 1.5; }
.play-button { flex: 0 0 auto; color: #170c11; background: #f3a1ba; }
.featured-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; margin-top: 9px; }
.featured-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; padding: 13px; background: var(--arcade-paper); border: 1px solid #e7bdc9; border-radius: 15px; box-shadow: 0 6px 18px rgba(69, 29, 44, .06); }
.featured-card .feature-label { margin: 0 0 5px; color: #91405a; }
.featured-card .feature-title { font-size: 19px; }
.featured-card .feature-description { margin-top: 4px; color: var(--arcade-muted); font-size: 11px; }
.featured-card .play-button { min-height: 42px; padding: 10px 12px; font-size: 9px; }

/* Library controls and catalog */
.library-panel { padding: 16px 13px 5px; background: rgba(255, 249, 250, .7); border: 1px solid rgba(255, 255, 255, .8); border-radius: 20px 20px 0 0; }
.library-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 12px; }
.library-search, .library-select { width: 100%; min-width: 0; height: 44px; padding: 0 12px; color: #23131a; background: #fffdfd; border: 1px solid #d9aab8; border-radius: 11px; font-size: 13px; }
.select-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.results-count { min-height: 22px; margin: 11px 0 7px; color: #70434f; font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.game-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 0 0 24px; }
.game-card { display: flex; min-width: 0; min-height: 184px; flex-direction: column; padding: 14px; background: var(--arcade-paper); border: 1px solid #e5bdc8; border-radius: 15px; box-shadow: 0 7px 20px rgba(69, 29, 44, .07); }
.game-card-top { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; }
.game-number { color: #963953; font: italic 14px var(--arcade-serif); white-space: nowrap; }
.game-category { overflow: hidden; color: #714956; font-size: 9px; font-weight: 800; letter-spacing: .09em; text-align: right; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.game-card h3 { margin: 9px 0 5px; font: 500 20px/1.1 var(--arcade-serif); overflow-wrap: anywhere; }
.game-card p { margin: 0 0 12px; color: var(--arcade-muted); font-size: 12px; line-height: 1.5; }
.game-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.game-status { color: #8a5a69; font-size: 9px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.game-card .play-button { min-height: 42px; padding: 10px 13px; font-size: 9px; }
.empty-state { grid-column: 1 / -1; padding: 23px 15px; background: #fff8fa; border: 1px dashed #c98ca0; border-radius: 15px; text-align: center; }
.empty-state h3 { margin: 0 0 5px; font: 500 21px var(--arcade-serif); }
.empty-state p { margin: 0 0 12px; color: var(--arcade-muted); font-size: 13px; }
.empty-state button { min-height: 42px; padding: 8px 14px; color: #fff; background: #24111a; border: 1px solid #a84766; border-radius: 999px; font-weight: 700; }

/* Clear, honest account connection */
.mytpr-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 15px; margin: 25px 0 20px; padding: 18px; color: #fff8fa; background: #170c12; border: 1px solid rgba(240, 154, 180, .58); border-radius: 18px; }
.mytpr-card h2 { margin: 4px 0 5px; font: 500 23px/1.05 var(--arcade-serif); }
.mytpr-card p { margin: 0; color: #e9d7de; font-size: 12px; line-height: 1.55; }
.mytpr-card .button-primary { min-height: 44px; padding-inline: 13px; font-size: 9px; }
.arcade-footer { padding: 14px 0 calc(18px + env(safe-area-inset-bottom)); color: #785460; font-size: 10px; text-align: center; }

/* Existing game dialog, tuned for phones and short screens */
.game-panel { display: none; position: fixed; z-index: 100; inset: 0; align-items: center; justify-content: center; overflow: auto; padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); background: rgba(8, 5, 7, .9); }
.game-panel.is-open, .game-panel.open { display: flex; }
.game-dialog { width: min(680px, 100%); max-height: min(92vh, calc(100dvh - 20px)); overflow: auto; padding: 16px; background: #fff4f7; border: 1px solid #e995ad; border-radius: 20px; box-shadow: 0 24px 70px rgba(0, 0, 0, .48); overscroll-behavior: contain; }
.game-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.game-dialog-head h2 { margin: 3px 0 0; font: 500 27px/1.08 var(--arcade-serif); }
.game-dialog-close { flex: 0 0 44px; width: 44px; height: 44px; color: white; background: #1b0d14; border: 1px solid #ae5975; border-radius: 50%; font-size: 23px; touch-action: manipulation; }
.game-progress { height: 5px; overflow: hidden; margin: 13px 0; background: #e7c2cd; border-radius: 99px; }
.game-progress span { display: block; width: 0; height: 100%; background: #a84667; transition: width .2s; }
.game-prompt { margin: 15px 0; font: 500 22px/1.3 var(--arcade-serif); }
.game-choices { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.game-choice { min-height: 48px; padding: 12px; color: #28121b; background: #fff; border: 1px solid #c27b93; border-radius: 12px; text-align: left; touch-action: manipulation; }
.game-choice.selected { background: #f5c1d0; border-color: #8f3150; }
.game-result { margin-top: 12px; padding: 14px; color: #fff7fa; background: #1a0b12; border-radius: 14px; font-size: 13px; line-height: 1.6; }
.game-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.game-actions .play-button, .game-actions .button-outline { min-height: 44px; }
/* Keep the established game modules working inside the redesigned dialog. */
.play { min-height: 44px; padding: 11px 15px; color: #fff7fa; background: #1b0d14; border: 1px solid #a84766; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: .08em; touch-action: manipulation; }
.play:hover { background: #a84667; }
.play.secondary, .secondary { color: #28121b; background: transparent; border-color: #9b5068; }
.choices { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.choice { min-height: 48px; padding: 12px; color: #28121b; background: #fff; border: 1px solid #c27b93; border-radius: 12px; text-align: left; touch-action: manipulation; }
.choice.selected, .choice:hover { background: #f5c1d0; border-color: #8f3150; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.prompt { margin: 15px 0; font: 500 22px/1.3 var(--arcade-serif); }
.result { margin-top: 12px; padding: 14px; color: #fff7fa; background: #1a0b12; border-radius: 14px; font-size: 13px; line-height: 1.6; }
.play:disabled, .choice:disabled { cursor: not-allowed; opacity: .62; }
.community-studio { max-width: 760px; margin: auto; color: var(--arcade-ink); }
.community-studio h2 { font-family: var(--arcade-serif); font-size: clamp(1.7rem, 5vw, 2.5rem); margin: .4rem 0; }
.community-studio label { display: block; margin: 1rem 0 .35rem; font-weight: 700; }
.community-studio input:not([type=checkbox]), .community-studio select, .community-studio textarea { width: 100%; padding: .85rem; color: #24131a; background: #fffafd; border: 1px solid #d9a6b7; border-radius: 12px; font: inherit; }
.community-studio textarea { min-height: 130px; resize: vertical; }
.community-studio .consent { display: flex; align-items: flex-start; gap: .6rem; font-weight: 500; }
.community-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0; }
.community-studio button { min-height: 44px; padding: .7rem 1rem; color: white; background: #a84667; border: 0; border-radius: 999px; font: inherit; font-weight: 700; touch-action: manipulation; }
.community-saved, .community-rules { margin-top: 1.2rem; padding: 1rem; background: #fff0f5; border: 1px solid #f1c5d3; border-radius: 15px; }
.draft { padding: .8rem 0; border-bottom: 1px solid #e5bdca; }
.draft small { display: block; color: #76525d; }
.draft p { overflow-wrap: anywhere; white-space: pre-wrap; }

@media (min-width: 390px) {
  .featured-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .featured-card:last-child { grid-column: 1 / -1; }
}
@media (min-width: 560px) {
  .arcade-shell { padding-inline: 22px; }
  .arcade-header-inner { grid-template-columns: 44px minmax(0, 1fr) auto; padding-inline: 22px; }
  .arcade-logo { width: 44px; height: 44px; }
  .arcade-wordmark { font-size: 13px; }
  .arcade-nav { gap: 13px; }
  .arcade-nav a { padding-inline: 7px; font-size: 11px; }
  .arcade-hero { margin-top: 22px; padding: 34px 30px; }
  .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
  .category-tile:nth-child(5) { grid-column: auto; min-height: 104px; }
  .featured-primary { padding: 22px 24px; }
  .featured-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .featured-card:last-child { grid-column: auto; }
  .library-panel { padding: 22px 18px 7px; }
  .library-controls { grid-template-columns: minmax(190px, 1fr) minmax(250px, 1.2fr); align-items: center; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-dialog { padding: 22px; }
  .game-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 820px) {
  .arcade-shell { padding-inline: 28px; }
  .arcade-header-inner { min-height: 72px; padding-inline: 28px; }
  .arcade-hero { margin-block: 28px 32px; padding: 42px 44px; border-radius: 24px; }
  .arcade-hero::after { width: 19%; }
  .arcade-section { margin-block: 34px; }
  .category-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .category-tile, .category-tile:nth-child(5) { min-height: 126px; padding: 15px; }
  .category-tile:nth-child(5) { grid-column: auto; }
  .featured-primary { min-height: 200px; padding: 28px 30px; }
  .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
  .game-card { padding: 16px; }
  .mytpr-card { padding: 22px 26px; }
}
@media (max-width: 359px) {
  .arcade-shell { padding-inline: 12px; }
  .arcade-header-inner { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 7px; padding-inline: 9px; }
  .arcade-logo { width: 36px; height: 36px; }
  .arcade-wordmark { font-size: 10px; letter-spacing: .045em; }
  .arcade-wordmark small { font-size: 8px; letter-spacing: .12em; }
  .arcade-nav { gap: 3px; }
  .arcade-nav a { min-height: 36px; padding-inline: 3px; font-size: 9px; }
  .arcade-hero { padding: 23px 16px; }
  .category-tile { min-height: 98px; padding: 10px; }
  .category-name { font-size: 14px; }
  .featured-primary { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .featured-primary .play-button { justify-self: start; }
  .mytpr-card { grid-template-columns: minmax(0, 1fr); }
  .mytpr-card .button-primary { justify-self: start; }
}
@media (max-height: 620px) and (orientation: landscape) {
  .game-dialog { max-height: calc(100dvh - 16px); border-radius: 15px; padding: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
