/* =========================================================================
   SAMURAI HONOR — game.css
   Every rule is scoped under .sho- so this file can't leak into, or be
   leaked into by, the shared site stylesheet (/css/styles.css).
   No image assets — all 11 symbols are emoji/CSS glyphs.
   ========================================================================= */

:root {
  --sho-black: #170a0c;
  --sho-black-mid: #200e11;
  --sho-red-deep: #3a0f14;
  --sho-red-mid: #591620;
  --sho-panel: #241014;
  --sho-panel-2: #2f151a;
  --sho-gold: #d9a94a;
  --sho-gold-bright: #f2ca7c;
  --sho-blossom: #ff9fb2;
  --sho-blossom-soft: #ffc4d1;
  --sho-ink: #f6e9df;
  --sho-ink-dim: #cbaba8;
  --sho-ink-faint: #8f6c6c;
  --sho-win-green: #3ddc97;
  --sho-danger: #ff5d6c;
  --sho-line-glow: #f2ca7c;
  --sho-border: rgba(217, 169, 74, 0.28);
  --sho-shadow: rgba(0, 0, 0, 0.6);

  --sho-radius-sm: 8px;
  --sho-radius-md: 14px;
  --sho-radius-lg: 22px;

  --sho-safe-top: env(safe-area-inset-top, 0px);
  --sho-safe-bottom: env(safe-area-inset-bottom, 0px);
  --sho-safe-left: env(safe-area-inset-left, 0px);
  --sho-safe-right: env(safe-area-inset-right, 0px);

  --sho-font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

/* Hide the shared site chrome while a hand is actually in progress. */
body:has(.sho-root.is-playing) .sho-site-header,
body:has(.sho-root.is-playing) #footer {
  display: none;
}

.sho-root {
  font-family: var(--sho-font);
  color: var(--sho-ink);
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 159, 178, 0.10), transparent 55%),
    linear-gradient(180deg, var(--sho-black) 0%, var(--sho-red-deep) 55%, var(--sho-red-mid) 100%);
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
  padding-left: var(--sho-safe-left);
  padding-right: var(--sho-safe-right);
  box-sizing: border-box;
}

.sho-root * {
  box-sizing: border-box;
}

.sho-screen {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(1.25rem + var(--sho-safe-top)) 1rem calc(1.25rem + var(--sho-safe-bottom));
}

.sho-screen[hidden] {
  display: none !important;
}

/* -------------------------------------------------------------------------
   Ambient petal-drift flicker — pure CSS, no per-frame JS.
   ------------------------------------------------------------------------- */
.sho-petal-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse 60% 40% at 30% 0%, rgba(255, 196, 209, 0.28), transparent 60%);
  opacity: 0;
  animation: sho-flicker 7s infinite ease-in-out;
}

@keyframes sho-flicker {
  0%, 91%, 100% { opacity: 0; }
  92% { opacity: 0.7; }
  92.6% { opacity: 0.1; }
  93.2% { opacity: 0.55; }
  94% { opacity: 0; }
  96% { opacity: 0.35; }
  96.4% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sho-petal-bg { animation: none; opacity: 0.06; }
}

/* -------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */
.sho-btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: var(--sho-radius-md);
  border: 1px solid var(--sho-border);
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  background: var(--sho-panel-2);
  color: var(--sho-ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.sho-btn:hover { filter: brightness(1.1); }
.sho-btn:active { transform: scale(0.97); }

.sho-btn--primary {
  background: linear-gradient(180deg, var(--sho-gold-bright), var(--sho-gold));
  color: #2a1a06;
  border-color: transparent;
  box-shadow: 0 6px 22px rgba(217, 169, 74, 0.35);
}

.sho-btn--ghost {
  background: transparent;
  border-color: var(--sho-border);
}

.sho-btn--disabled,
.sho-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}
.sho-btn:disabled:active { transform: none; }

.sho-btn--icon {
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  font-size: 1.1rem;
  line-height: 1;
}

/* -------------------------------------------------------------------------
   Menu screen
   ------------------------------------------------------------------------- */
.sho-screen--menu { justify-content: center; }

.sho-menu-card {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, var(--sho-panel), var(--sho-panel-2));
  border: 1px solid var(--sho-border);
  border-radius: var(--sho-radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: 0 20px 60px var(--sho-shadow);
}

.sho-menu-glyphs {
  font-size: 3rem;
  margin-bottom: 0.25rem;
  filter: drop-shadow(0 0 18px rgba(217, 169, 74, 0.5));
}

.sho-title {
  font-size: 2.6rem;
  margin: 0;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, var(--sho-gold-bright), var(--sho-gold) 60%, #8a5f1c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(217, 169, 74, 0.22);
}

.sho-tagline {
  color: var(--sho-ink-dim);
  margin: 0.6rem 0 1.4rem;
  font-size: 0.98rem;
  font-style: italic;
}

.sho-menu-jackpot {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.4rem;
  background: rgba(217, 169, 74, 0.08);
  border: 1px solid var(--sho-border);
  border-radius: var(--sho-radius-md);
  padding: 0.7rem 1rem;
  margin-bottom: 1.5rem;
}

.sho-menu-jackpot-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sho-ink-faint);
}

.sho-menu-jackpot-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--sho-gold-bright);
  font-variant-numeric: tabular-nums;
}

.sho-menu-jackpot-unit {
  font-size: 0.78rem;
  color: var(--sho-ink-faint);
}

.sho-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.sho-fineprint {
  margin-top: 1.4rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--sho-ink-faint);
}

/* -------------------------------------------------------------------------
   Help / paytable screen
   ------------------------------------------------------------------------- */
.sho-screen--help { align-items: stretch; padding-left: 0; padding-right: 0; }

.sho-help-panel {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  background: var(--sho-panel);
  border: 1px solid var(--sho-border);
  border-radius: var(--sho-radius-lg);
  overflow: hidden;
}

.sho-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--sho-border);
  position: sticky;
  top: 0;
  background: var(--sho-panel);
  z-index: 2;
}

.sho-help-header h2 { margin: 0; font-size: 1.2rem; }

.sho-help-body { padding: 1.25rem; }

.sho-help-note {
  color: var(--sho-ink-dim);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-top: 0;
}

.sho-paytable-wrap {
  overflow-x: auto;
  border-radius: var(--sho-radius-md);
  border: 1px solid var(--sho-border);
  margin: 1rem 0 1.5rem;
}

.sho-paytable {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
  font-size: 0.88rem;
}

.sho-paytable th, .sho-paytable td {
  padding: 0.55rem 0.7rem;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.sho-paytable th {
  color: var(--sho-ink-faint);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

.sho-paytable td:first-child, .sho-paytable th:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--sho-panel);
}

.sho-paytable-glyph { font-size: 1.3rem; margin-right: 0.4rem; }
.sho-paytable-name { color: var(--sho-ink); font-weight: 600; }
.sho-paytable-sub { display: block; color: var(--sho-ink-faint); font-size: 0.72rem; font-weight: 400; }

.sho-help-rules h3 {
  font-size: 0.98rem;
  margin: 1.1rem 0 0.35rem;
  color: var(--sho-gold-bright);
}
.sho-help-rules p {
  margin: 0 0 0.6rem;
  color: var(--sho-ink-dim);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* -------------------------------------------------------------------------
   Play screen
   ------------------------------------------------------------------------- */
.sho-screen--play {
  position: relative;
  padding-top: calc(0.6rem + var(--sho-safe-top));
  gap: 0.6rem;
}

.sho-play-topbar {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  display: grid;
  grid-template-columns: auto 1fr 1fr auto;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.sho-chip {
  background: var(--sho-panel-2);
  border: 1px solid var(--sho-border);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  min-width: 0;
}

.sho-chip-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sho-ink-faint);
}

.sho-chip-value {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--sho-gold-bright);
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sho-chip--jackpot .sho-chip-value { color: var(--sho-blossom-soft); }

.sho-status-strip {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.78rem;
  color: var(--sho-ink-faint);
  margin-bottom: 0.4rem;
}

.sho-status-item strong { color: var(--sho-ink); }

#freeSpinsIndicator strong, #bonusIndicator strong { color: var(--sho-gold-bright); }

.sho-reel-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  background: linear-gradient(180deg, var(--sho-panel), var(--sho-panel-2));
  border: 1px solid var(--sho-border);
  border-radius: var(--sho-radius-lg);
  padding: 0.6rem;
  box-shadow: 0 16px 50px var(--sho-shadow), inset 0 0 40px rgba(255, 159, 178, 0.05);
  /* Sized to content, not stretched to fill leftover viewport height — see
     bug 3 in the build notes: flex:1 1 auto + centering here would leave
     dead space above/below the (correctly, tightly sized) reel grid. */
}

.sho-reels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.35rem;
  width: 100%;
  aspect-ratio: 5 / 3;
  max-height: 52vh;
}

.sho-reel {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, rgba(89, 22, 32, 0.9), rgba(23, 10, 12, 0.95));
  border-radius: var(--sho-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.sho-reel--thud { animation: sho-thud 0.18s ease-out; }
@keyframes sho-thud {
  0% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

.sho-strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.sho-cell {
  height: 0;
  flex: 0 0 auto;
  /* aspect-ratio keeps each cell square inside the flex strip — padding-top
     percentage would resolve against the cell's own width, not the strip's
     height, which is the width-vs-height footgun documented in the build
     notes. Using aspect-ratio here can never be gotten backwards. */
  aspect-ratio: 1 / 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sho-cell .sho-glyph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.4rem, 6.4vw, 2.6rem);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}

.sho-cell--wild .sho-glyph { filter: drop-shadow(0 0 10px rgba(217, 169, 74, 0.8)); }

/* Katana Blade (id 10) reads as visibly bigger and more gilded than the
   Dragon Spirit wild, even though both are the flashiest glyphs on the
   reels — it is the single most iconic image for this theme. */
.sho-cell--top .sho-glyph {
  font-size: clamp(1.6rem, 7.4vw, 3rem);
  filter: drop-shadow(0 0 16px rgba(242, 202, 124, 1)) drop-shadow(0 0 6px #fff) drop-shadow(0 0 2px #fff);
}

.sho-cell--scatter .sho-glyph { filter: drop-shadow(0 0 8px rgba(255, 159, 178, 0.85)); }

.sho-cell--win::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 6px;
  border: 2px solid var(--sho-line-glow);
  box-shadow: 0 0 14px var(--sho-line-glow), inset 0 0 10px rgba(242, 202, 124, 0.4);
  pointer-events: none;
}

.sho-cell--win-pulse::after { animation: sho-win-pulse 0.9s ease-in-out infinite; }
@keyframes sho-win-pulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

.sho-win-banner {
  position: absolute;
  left: 50%;
  top: 8%;
  transform: translateX(-50%);
  background: rgba(23, 10, 12, 0.88);
  border: 1px solid var(--sho-gold);
  color: var(--sho-gold-bright);
  font-weight: 800;
  font-size: clamp(1rem, 4vw, 1.5rem);
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  box-shadow: 0 0 26px rgba(217, 169, 74, 0.5);
  z-index: 3;
  animation: sho-banner-pop 0.35s ease-out;
  pointer-events: none;
}

@keyframes sho-banner-pop {
  0% { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(0.9); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* -------------------------------------------------------------------------
   Controls
   ------------------------------------------------------------------------- */
.sho-controls {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.5rem 0.6rem;
  margin-top: 0.6rem;
  align-items: end;
}

.sho-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.sho-control-group--total { grid-column: 1 / 3; flex-direction: row; align-items: baseline; gap: 0.5rem; }

.sho-control-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sho-ink-faint);
}

.sho-select {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  background: var(--sho-panel-2);
  color: var(--sho-ink);
  border: 1px solid var(--sho-border);
  border-radius: var(--sho-radius-sm);
  padding: 0.5rem 0.6rem;
}

.sho-total-bet {
  font-weight: 800;
  color: var(--sho-gold-bright);
  font-variant-numeric: tabular-nums;
}

.sho-btn--spin {
  grid-column: 3;
  grid-row: 1 / 3;
  min-width: 108px;
  min-height: 64px;
  border-radius: var(--sho-radius-lg);
  background: linear-gradient(180deg, var(--sho-gold-bright), var(--sho-gold));
  color: #2a1a06;
  border: none;
  box-shadow: 0 8px 26px rgba(217, 169, 74, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
}

.sho-spin-label { font-size: 1rem; letter-spacing: 0.06em; }
.sho-spin-blade { font-size: 1.3rem; }

.sho-btn--spin.is-spinning .sho-spin-blade { animation: sho-blade-spin 0.6s linear infinite; }
@keyframes sho-blade-spin {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.25) rotate(12deg); }
}

@media (min-width: 720px) {
  .sho-controls { grid-template-columns: 1fr 1fr 1fr auto; }
  .sho-control-group--total { grid-column: 3; flex-direction: column; align-items: flex-start; }
  .sho-btn--spin { grid-column: 4; }
}

/* -------------------------------------------------------------------------
   Bonus pick overlay
   ------------------------------------------------------------------------- */
.sho-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem calc(1rem + var(--sho-safe-right)) calc(1rem + var(--sho-safe-bottom)) calc(1rem + var(--sho-safe-left));
  background: rgba(10, 4, 5, 0.82);
  backdrop-filter: blur(2px);
}

/* Explicit [hidden] guard: without this, an unrelated display:flex rule on
   .sho-overlay would beat the browser's default [hidden]{display:none} and
   the overlay would stay visible AND CLICKABLE, intercepting clicks on
   whatever screen sits under it. */
.sho-overlay[hidden] {
  display: none;
}

.sho-bonus-panel {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, var(--sho-panel), var(--sho-red-mid));
  border: 1px solid var(--sho-border);
  border-radius: var(--sho-radius-lg);
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 20px 60px var(--sho-shadow);
}

.sho-bonus-title { margin: 0 0 0.2rem; color: var(--sho-gold-bright); }
.sho-bonus-sub { margin: 0 0 1rem; color: var(--sho-ink-dim); font-size: 0.9rem; }

.sho-bonus-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.sho-bonus-tile {
  aspect-ratio: 1;
  border-radius: var(--sho-radius-md);
  border: 1px solid var(--sho-border);
  background: radial-gradient(circle at 50% 30%, #4a1b22, #230f13);
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--sho-ink);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.sho-bonus-tile:hover:not(.is-revealed) { transform: translateY(-2px); filter: brightness(1.15); }
.sho-bonus-tile:active:not(.is-revealed) { transform: scale(0.96); }

.sho-bonus-tile.is-revealed {
  cursor: default;
  background: radial-gradient(circle at 50% 30%, #5a4014, #241a08);
  border-color: var(--sho-gold);
  flex-direction: column;
  font-size: 1rem;
  font-weight: 800;
  color: var(--sho-gold-bright);
  animation: sho-tile-reveal 0.35s ease-out;
}

.sho-bonus-tile.is-dim { opacity: 0.35; cursor: default; }

@keyframes sho-tile-reveal {
  0% { transform: scale(0.7) rotateY(90deg); }
  100% { transform: scale(1) rotateY(0); }
}

.sho-bonus-total { color: var(--sho-ink-dim); font-size: 0.95rem; }
.sho-bonus-total strong { color: var(--sho-gold-bright); }

/* -------------------------------------------------------------------------
   Jackpot overlay
   ------------------------------------------------------------------------- */
.sho-overlay--jackpot { background: rgba(6, 2, 3, 0.92); }

.sho-jackpot-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 20%, rgba(255, 196, 209, 0.7), transparent 60%);
  animation: sho-jackpot-flash 1.6s ease-in-out infinite;
}

@keyframes sho-jackpot-flash {
  0%, 100% { opacity: 0; }
  4% { opacity: 1; }
  8% { opacity: 0.15; }
  12% { opacity: 0.85; }
  16% { opacity: 0; }
  55% { opacity: 0; }
  58% { opacity: 0.6; }
  61% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sho-jackpot-flash { animation: none; opacity: 0.15; }
}

.sho-jackpot-panel {
  position: relative;
  text-align: center;
  z-index: 1;
}

.sho-jackpot-glyph {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 30px rgba(242, 202, 124, 0.9));
}

.sho-jackpot-title {
  font-size: clamp(1.8rem, 8vw, 3.1rem);
  margin: 0;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #fff, var(--sho-gold-bright) 55%, var(--sho-gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sho-jackpot-sub { color: var(--sho-ink-dim); margin: 0.4rem 0; }

.sho-jackpot-amount {
  font-size: clamp(1.6rem, 7vw, 2.6rem);
  font-weight: 800;
  color: var(--sho-gold-bright);
  margin: 0.6rem 0 1.4rem;
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------------------
   Loading screen
   ------------------------------------------------------------------------- */
.sho-screen--loading { justify-content: center; align-items: center; }
.sho-loading-blade { font-size: 3rem; animation: sho-loading-pulse 1s ease-in-out infinite; }
.sho-loading-text { color: var(--sho-ink-dim); margin-top: 0.5rem; }
@keyframes sho-loading-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.08); }
}


/* Shown while the reels turn waiting on the server's outcome (SMO mode only). Softened so
   the swap between symbols reads as motion rather than a flicker. */
.sho-cell--blur, .sho-cell--blur .sho-glyph {
  filter: blur(2.5px);
  opacity: 0.72;
}

@media (prefers-reduced-motion: reduce) {
  .sho-cell--blur, .sho-cell--blur .sho-glyph { filter: none; opacity: 0.8; }
}
