:root {
  --thr-cyan: #00cccc;
  --thr-bright: #7ffcff;
  --thr-ink: #03090b;
  --thr-panel: #07171a;
  --thr-bone: #e7dbc0;
  --thr-gold: #e2a843;
}

[hidden] { display: none !important; }

.thr-shell { max-width: 1180px; }
.thr-tagline {
  margin: .15rem 0 1rem;
  color: #91aaaa;
  text-align: center;
  font-style: italic;
  letter-spacing: .08em;
}

.thr-account {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .65rem;
  align-items: end;
  margin: 1rem auto;
  padding: .8rem;
  border: 1px solid #17666b;
  background: linear-gradient(180deg, rgba(8, 34, 37, .94), rgba(2, 13, 15, .94));
  box-shadow: inset 0 0 25px rgba(0, 204, 204, .08);
}

.thr-field {
  flex: 1 1 280px;
  max-width: 420px;
}

.thr-field label {
  display: block;
  margin-bottom: .25rem;
  color: #9adfe0;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.thr-account input,
.thr-account button,
.thr-console button {
  min-height: 42px;
  border: 1px solid #188b91;
  color: #dffefe;
  background: #07191c;
  font-family: Cinzel, serif;
}

.thr-account input {
  box-sizing: border-box;
  width: 100%;
  padding: .55rem .65rem;
}

.thr-account button,
.thr-console button,
.thr-lever {
  cursor:
    url('/images/cursors/hover.cur') 11 0,
    url('/images/cursors/hover.png') 11 0,
    pointer;
}

.thr-account button:hover,
.thr-console button:hover {
  border-color: var(--thr-bright);
  color: #fff;
  box-shadow: 0 0 14px rgba(0, 255, 255, .25);
}

.thr-primary { background: #0a4e52 !important; }

.thr-balance {
  display: flex;
  min-width: 122px;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .2rem .55rem;
  border: 1px solid rgba(226, 168, 67, .5);
  background: #0d0c08;
}

.thr-balance img { width: 34px; height: 34px; object-fit: contain; }
.thr-balance strong { display: block; color: #ffe08a; font-size: 1.2rem; line-height: 1; }
.thr-balance small { display: block; color: #96886c; font-size: .62rem; text-transform: uppercase; }
.thr-restore {
  display: grid;
  flex: 1 1 300px;
  grid-template-columns: minmax(190px, 1fr) auto;
  max-width: 430px;
  gap: .4rem;
}

.thr-machine-wrap {
  position: relative;
  width: min(100%, 980px);
  max-width: 980px;
  margin: 1.2rem auto 2rem;
  padding: 0;
  aspect-ratio: 1;
  background: transparent url('../images/cabinet-v2.webp') center / contain no-repeat;
  filter: drop-shadow(0 18px 25px rgba(0, 0, 0, .65));
  isolation: isolate;
}

.thr-machine {
  position: absolute;
  inset: 0;
  min-height: 0;
  padding: 0;
}

.thr-screen {
  position: absolute;
  top: 32.2%;
  left: 15.2%;
  box-sizing: border-box;
  width: 72.8%;
  height: 31.9%;
  overflow: hidden;
  padding: .55%;
  border: 2px solid #50452f;
  border-radius: 2px;
  background: #020707;
  box-shadow: inset 0 0 24px #000;
}

.thr-reels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .45%;
  height: 100%;
  aspect-ratio: auto;
}

.thr-reel {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  overflow: hidden;
  padding: 4px;
  border: 1px solid #514a38;
  background: linear-gradient(90deg, #061012, #112529 50%, #061012);
  box-shadow: inset 0 0 18px #000;
}

.thr-cell {
  position: relative;
  min-width: 0;
  border: 1px solid rgba(119, 189, 188, .15);
  border-radius: 4px;
  background: rgba(0, 0, 0, .28);
  transition: filter .14s, transform .14s, box-shadow .14s;
}

.thr-symbol {
  position: absolute;
  inset: 5%;
  background-image: url('../images/symbols.webp');
  background-repeat: no-repeat;
  background-size: 300% 300%;
  filter: drop-shadow(0 3px 2px #000);
}

.sym-skull { background-position: 0 0; }
.sym-bones { background-position: 50% 0; }
.sym-raven { background-position: 100% 0; }
.sym-planchette { background-position: 0 50%; }
.sym-lantern { background-position: 50% 50%; }
.sym-seven { background-position: 100% 50%; }
.sym-bell { background-position: 0 100%; }
.sym-web { background-position: 50% 100%; }
.sym-wild { background-position: 100% 100%; }

.thr-reel.is-spinning .thr-cell {
  animation: thr-reel-blur .16s linear infinite;
  filter: blur(2px) brightness(1.25);
}

@keyframes thr-reel-blur {
  0% { transform: translateY(-6%); }
  50% { transform: translateY(7%); }
  100% { transform: translateY(-6%); }
}

.thr-cell.is-win {
  z-index: 2;
  transform: scale(1.06);
  border-color: #fff4a5;
  background: rgba(0, 219, 227, .18);
  box-shadow: inset 0 0 15px rgba(255, 233, 120, .5), 0 0 16px #00e0e8;
  animation: thr-win-pulse .65s ease-in-out infinite alternate;
}

@keyframes thr-win-pulse {
  to { filter: brightness(1.35); box-shadow: inset 0 0 22px rgba(255, 240, 149, .8), 0 0 24px #00f4ff; }
}

.thr-free-banner {
  position: absolute;
  z-index: 5;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  padding: .28rem .8rem;
  border: 1px solid #91ffff;
  border-radius: 999px;
  color: #dfffff;
  background: rgba(1, 24, 27, .92);
  font-size: .72rem;
  letter-spacing: .08em;
  box-shadow: 0 0 18px #00aeb5;
}

.thr-win-flash {
  position: absolute;
  z-index: 8;
  inset: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: white;
  background: radial-gradient(circle, rgba(0, 151, 160, .78), rgba(0, 0, 0, .72));
  text-shadow: 0 0 8px #00ffff, 0 3px 0 #111;
  animation: thr-pop .28s ease-out;
}

.thr-win-flash:not([hidden]) { display: flex !important; }
.thr-win-flash span { color: #fff0aa; font-size: clamp(1rem, 2.5vw, 1.6rem); letter-spacing: .25em; }
.thr-win-flash strong { font-size: clamp(2.4rem, 7vw, 5rem); line-height: 1; }
@keyframes thr-pop { from { opacity: 0; transform: scale(.82); } }

.thr-message {
  position: absolute;
  top: 65.2%;
  left: 17%;
  width: 68%;
  min-height: 1.2rem;
  margin: 0;
  color: #d8efef;
  text-align: center;
  font-size: clamp(.55rem, 1.15vw, .82rem);
  text-shadow: 0 2px 2px #000;
}

.thr-console {
  position: absolute;
  top: 70.6%;
  left: 14.5%;
  box-sizing: border-box;
  display: grid;
  width: 71%;
  grid-template-columns: 42px 78px 42px minmax(110px, 1.25fr) minmax(88px, 1fr) minmax(80px, .8fr) minmax(80px, .8fr);
  gap: 4px;
  align-items: stretch;
  padding: 6px;
  border: 2px solid #796844;
  background: linear-gradient(#1b1a14, #080907);
  box-shadow: inset 0 0 12px #000;
}

.thr-console button { min-width: 0; padding: .35rem; font-size: .69rem; }
.thr-step { font-size: 1.4rem !important; }
.thr-meter {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border: 1px solid #335b5d;
  color: #80acac;
  background: #010707;
  font-size: .55rem;
  letter-spacing: .08em;
}
.thr-meter strong { color: #f0d57d; font-size: 1rem; }

.thr-spin {
  border-color: #ca9a43 !important;
  color: #fff3c6 !important;
  background: radial-gradient(circle at 50% 30%, #1c7776, #083132 65%, #071719) !important;
  box-shadow: inset 0 0 0 2px #0d1110, inset 0 0 0 3px #9b7a3b;
}
.thr-spin span { display: block; font-size: 1rem; font-weight: 700; letter-spacing: .1em; }
.thr-spin small { color: #93c9c9; font-size: .5rem; }

.thr-lever {
  position: absolute;
  top: 29%;
  right: -8.5%;
  width: 18%;
  height: 49%;
  border: 0;
  background: transparent;
}
.lever-arm {
  position: absolute;
  z-index: 2;
  bottom: 36%;
  left: 34%;
  width: 32%;
  height: 78%;
  background: url('../images/lever-handle-v2.webp') center bottom / contain no-repeat;
  filter: drop-shadow(3px 4px 2px rgba(0, 0, 0, .75));
  transform-origin: 50% 96%;
}
.lever-knob { display: none; }
.lever-base {
  position: absolute;
  z-index: 3;
  bottom: 20%;
  left: 5%;
  width: 90%;
  aspect-ratio: 1;
  background: url('../images/lever-mount-v2.webp') center / contain no-repeat;
  filter: drop-shadow(3px 4px 3px rgba(0, 0, 0, .8));
}
.thr-lever.is-pulling .lever-arm { animation: thr-pull .65s cubic-bezier(.25, .8, .25, 1); }
@keyframes thr-pull {
  0%, 100% { transform: rotate(0); }
  46% { transform: rotate(58deg); }
}

.thr-paytable {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem;
  border: 1px solid #17666b;
  background: linear-gradient(145deg, rgba(8, 27, 30, .96), rgba(2, 11, 13, .96));
}
.thr-pay-head { display: block; text-align: center; }
.thr-pay-head h2 { margin: 0; color: #baffff; }
.thr-pay-head p { max-width: none; margin: .35rem 0 0; color: #a2bbbb; font-size: .86rem; }
.thr-kicker { color: #d1aa5b !important; font-size: .62rem !important; letter-spacing: .2em; text-transform: uppercase; }
.thr-pay-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 1rem;
}
.thr-pay-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  min-width: 0;
  min-height: 116px;
  padding: .65rem .8rem;
  border: 1px solid #2a686c;
  text-align: left;
  background: #030c0e;
}
.thr-pay-card .thr-symbol {
  position: relative;
  inset: auto;
  display: block;
  grid-row: 1 / 3;
  width: 94px;
  aspect-ratio: 1;
}
.thr-pay-card strong { display: block; color: #e6ffff; font-size: .98rem; white-space: normal; }
.thr-pay-card span { display: block; color: #f0ce72; font-size: .88rem; line-height: 1.4; }

.thr-divider { max-width: 980px; margin: 2rem auto 1rem; border: 0; border-top: 1px solid rgba(0, 204, 204, .35); }
.leaderboard { max-width: 980px; margin: 0 auto; }
.leaderboard h2 { color: #aefefe; }
#lbTable { width: 100%; border-collapse: collapse; border: 1px solid #008b8b; }
#lbTable th, #lbTable td { padding: .55rem; border: 1px solid #008b8b; text-align: left; }
#lbTable th { color: #aefefe; background: rgba(0, 204, 204, .14); }
#lbTable td:last-child, #lbTable th:last-child { text-align: right; }
.empty-cell { color: #71898a; font-style: italic; text-align: center !important; }

.thr-modal {
  position: fixed;
  z-index: 10000;
  inset: 0;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, .86);
}
.thr-modal:not([hidden]) { display: grid !important; }
.thr-modal > div { max-width: 560px; padding: 1.4rem; border: 1px solid #00aeb5; background: #061416; box-shadow: 0 0 35px rgba(0, 204, 204, .25); }
.thr-modal h2 { margin-top: 0; color: #baffff; }
.thr-modal code { display: block; overflow-wrap: anywhere; padding: .8rem; border: 1px solid #6c6044; color: #ffe294; background: #020606; }
.thr-modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }
.thr-modal button { min-height: 40px; border: 1px solid #188b91; color: #e9ffff; background: #07191c; }
.sr-only { position: absolute; overflow: hidden; width: 1px; height: 1px; clip: rect(0, 0, 0, 0); white-space: nowrap; }

button:disabled { cursor: not-allowed; opacity: .5; }

@media (max-width: 900px) {
  .thr-machine-wrap { width: 92%; }
  .thr-console { grid-template-columns: 30px 58px 30px 1.3fr 1fr; padding: 3px; gap: 2px; }
  .thr-console button { min-height: 34px; font-size: .55rem; }
  #autoBtn, #soundBtn { grid-column: span 1; }
  .thr-pay-card { grid-template-columns: 72px minmax(0, 1fr); min-height: 82px; padding: .4rem; }
  .thr-pay-card .thr-symbol { width: 66px; }
  .thr-pay-card strong { font-size: .7rem; }
  .thr-pay-card span { font-size: .65rem; }
}

@media (max-width: 620px) {
  .thr-account { align-items: stretch; }
  .thr-field, .thr-restore { flex-basis: 100%; max-width: none; }
  .thr-machine-wrap { width: 100%; margin-inline: 0; }
  .thr-reels { gap: 2px; }
  .thr-reel { gap: 2px; padding: 2px; }
  .thr-symbol { inset: 1%; }
  .thr-lever { display: none; }
  .thr-console { top: 72%; left: 12%; width: 76%; grid-template-columns: 24px 45px 24px 1fr; }
  .thr-console .thr-meter:nth-of-type(2) { grid-column: span 2; }
  #autoBtn, #soundBtn { grid-column: span 2; }
  .thr-pay-grid { grid-template-columns: 1fr; }
  .thr-pay-card { grid-template-columns: 88px minmax(0, 1fr); }
  .thr-pay-card .thr-symbol { width: 82px; }
  .thr-pay-card strong { font-size: .84rem; }
  .thr-pay-card span { font-size: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .thr-reel.is-spinning .thr-cell,
  .thr-cell.is-win,
  .thr-lever.is-pulling .lever-arm,
  .thr-win-flash { animation: none; }
}
