* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #041018;
  color: #f8fbff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #12384d 0%, #061827 58%, #02070c 100%);
}

.game-stage {
  --game-scale: 1;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1280px;
  height: 720px;
  overflow: hidden;
  background: #071c29;
  touch-action: none;
  transform: translate(-50%, -50%) scale(var(--game-scale));
  transform-origin: center center;
}

.rotate-device {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 28px;
  background: radial-gradient(circle at 50% 38%, #124b63 0%, #062034 54%, #02070c 100%);
}

.rotate-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(320px, 100%);
  padding: 26px 22px 24px;
  border: 1px solid rgba(151, 235, 255, 0.48);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(5, 50, 75, 0.88), rgba(2, 18, 30, 0.94));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44), inset 0 0 22px rgba(68, 213, 255, 0.1);
  text-align: center;
}

.rotate-card span {
  color: #7fe9ff;
  font-size: 13px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.rotate-card strong {
  color: #fff5ba;
  font-size: 34px;
  line-height: 1;
  text-shadow: 0 0 20px rgba(255, 206, 74, 0.5);
}

.rotate-card p {
  margin: 0;
  color: #d8f8ff;
  font-size: 16px;
  font-weight: 800;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.room-select-screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 42px;
  background: radial-gradient(circle at 50% 34%, rgba(24, 91, 122, 0.92), rgba(4, 17, 28, 0.94) 62%, rgba(1, 5, 10, 0.98) 100%);
}

.room-select-screen[hidden] {
  display: none;
}

.room-select-panel {
  width: min(900px, 100%);
}

.room-kicker {
  display: block;
  color: #7fe9ff;
  font-size: 14px;
  font-weight: 950;
  text-align: center;
  text-transform: uppercase;
}

.room-select-panel h1 {
  margin: 8px 0 22px;
  color: #fff5ba;
  font-size: 42px;
  line-height: 1;
  text-align: center;
  text-shadow: 0 0 24px rgba(255, 206, 74, 0.42);
}

.room-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.room-card {
  min-height: 214px;
  padding: 16px 14px;
  border: 1px solid rgba(151, 235, 255, 0.44);
  border-radius: 8px;
  color: #f7fdff;
  background: linear-gradient(180deg, rgba(5, 50, 75, 0.88), rgba(2, 18, 30, 0.94));
  box-shadow: inset 0 0 20px rgba(68, 213, 255, 0.08), 0 18px 42px rgba(0, 0, 0, 0.34);
  cursor: pointer;
}

.room-card:hover,
.room-card:focus-visible {
  border-color: rgba(255, 218, 99, 0.78);
  box-shadow: inset 0 0 22px rgba(255, 218, 99, 0.12), 0 0 26px rgba(255, 202, 74, 0.2), 0 18px 42px rgba(0, 0, 0, 0.34);
  outline: none;
}

.room-card span,
.room-card small {
  display: block;
  font-weight: 900;
  text-transform: uppercase;
}

.room-card span {
  color: #7fe9ff;
  font-size: 11px;
}

.room-card strong {
  display: block;
  margin: 6px 0 14px;
  color: #fff5ba;
  font-size: 25px;
  line-height: 1.05;
}

.room-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.room-card div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.room-card dt,
.room-card dd {
  margin: 0;
  font-size: 12px;
  font-weight: 850;
}

.room-card dt {
  color: #92eaf6;
}

.room-card dd {
  color: #f8fbff;
  text-align: right;
}

.room-card small {
  margin-top: 14px;
  color: #ffd978;
  font-size: 11px;
}

.seat-info-layer,
.jackpot-hud,
.bottom-controls,
.weapon-panel,
.right-tools,
.table-strip {
  position: absolute;
  z-index: 3;
  pointer-events: none;
}

.table-strip {
  left: 50%;
  top: 106px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid rgba(151, 235, 255, 0.34);
  border-radius: 8px;
  background: rgba(2, 18, 30, 0.68);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
  transform: translateX(-50%);
}

.table-strip[hidden] {
  display: none;
}

.table-strip div {
  min-width: 74px;
  padding: 4px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
}

.table-strip span,
.table-strip strong {
  display: block;
  line-height: 1.1;
  text-align: center;
}

.table-strip span {
  color: #8ce4f2;
  font-size: 9px;
  font-weight: 950;
  text-transform: uppercase;
}

.table-strip strong {
  margin-top: 2px;
  color: #fff5ba;
  font-size: 12px;
  font-weight: 950;
}

.table-exit-button {
  min-width: 54px;
  height: 38px;
  border: 1px solid rgba(135, 230, 255, 0.48);
  border-radius: 8px;
  color: #f7fdff;
  background: linear-gradient(180deg, rgba(21, 91, 112, 0.94), rgba(8, 44, 65, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 10px 18px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  font-size: 12px;
  font-weight: 950;
  pointer-events: auto;
  text-transform: uppercase;
}

.seat-info-layer {
  inset: 0;
}

.seat-info {
  position: absolute;
  width: 174px;
  padding: 8px 10px 9px;
  border: 1px solid rgba(151, 235, 255, 0.42);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(5, 50, 75, 0.78), rgba(2, 18, 30, 0.86));
  box-shadow: inset 0 0 18px rgba(68, 213, 255, 0.08), 0 10px 26px rgba(0, 0, 0, 0.26);
  pointer-events: none;
}

.seat-top-left {
  top: max(10px, env(safe-area-inset-top));
  left: max(54px, calc(env(safe-area-inset-left) + 54px));
}

.seat-top-right {
  top: max(10px, env(safe-area-inset-top));
  right: max(54px, calc(env(safe-area-inset-right) + 54px));
}

.seat-bottom-left {
  bottom: max(10px, env(safe-area-inset-bottom));
  left: max(54px, calc(env(safe-area-inset-left) + 54px));
}

.seat-bottom-right {
  right: max(54px, calc(env(safe-area-inset-right) + 54px));
  bottom: max(10px, env(safe-area-inset-bottom));
}

.seat-name {
  display: block;
  margin-bottom: 4px;
  color: #7fe9ff;
  font-size: 10px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.seat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 21px;
}

.seat-row span {
  color: #8ce4f2;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.seat-row strong {
  color: #f8fbff;
  font-size: 18px;
  line-height: 1;
  text-shadow: 0 0 12px rgba(128, 242, 255, 0.36);
}

.gem-row strong,
.win-row strong {
  color: #ffd978;
}

.is-player {
  border-color: rgba(255, 218, 99, 0.68);
  box-shadow: inset 0 0 18px rgba(255, 218, 99, 0.1), 0 0 20px rgba(255, 202, 74, 0.16), 0 10px 26px rgba(0, 0, 0, 0.28);
}

.jackpot-hud {
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  width: min(440px, calc(100vw - 360px));
  min-width: 320px;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 5px;
}

.mega-panel,
.jackpot-small,
.shot-cost,
.tool-button,
.weapon-button,
.side-button,
.special-meter {
  border: 1px solid rgba(151, 235, 255, 0.42);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(4, 42, 61, 0.88), rgba(2, 18, 30, 0.92));
  box-shadow: inset 0 0 22px rgba(68, 213, 255, 0.08), 0 10px 28px rgba(0, 0, 0, 0.28);
}

.mega-panel {
  width: 100%;
  padding: 6px 16px 8px;
  text-align: center;
  background: linear-gradient(180deg, rgba(84, 23, 36, 0.92), rgba(24, 16, 37, 0.94));
  border-color: rgba(255, 218, 99, 0.76);
  box-shadow: 0 0 28px rgba(255, 195, 59, 0.28), inset 0 0 18px rgba(255, 230, 116, 0.14);
}

.mega-panel span,
.jackpot-small span,
.shot-cost span,
.special-meter span,
.weapon-button span {
  display: block;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.mega-panel span {
  color: #ffd978;
}

.mega-panel strong {
  display: block;
  margin-top: 1px;
  font-size: 27px;
  line-height: 1;
  color: #fff5ba;
  text-shadow: 0 0 16px rgba(255, 206, 74, 0.62);
}

.minor-row {
  display: grid;
  grid-template-columns: 1fr 1fr minmax(74px, 0.75fr);
  width: 92%;
  gap: 6px;
}

.jackpot-small {
  padding: 5px 9px 6px;
  text-align: center;
  border-color: rgba(255, 213, 91, 0.42);
}

.jackpot-small span {
  color: #7fe9ff;
}

.jackpot-small strong {
  display: block;
  margin-top: 2px;
  font-size: 17px;
  line-height: 1;
  color: #fff6bf;
}

.boss-chip strong {
  color: #97f7ff;
}

.shot-cost strong {
  display: block;
  margin-top: 2px;
  font-size: 19px;
  line-height: 1;
  color: #fff;
}

.bottom-controls {
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: end;
  gap: 12px;
}

.cannon-panel,
.tool-row {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.icon-button,
.tool-button,
.side-button,
.close-button {
  border: 1px solid rgba(135, 230, 255, 0.48);
  border-radius: 8px;
  color: #f7fdff;
  background: linear-gradient(180deg, rgba(21, 91, 112, 0.94), rgba(8, 44, 65, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 10px 18px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.icon-button {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 30px;
  font-weight: 950;
}

.icon-button:disabled,
.tool-button:disabled,
.side-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.shot-cost {
  min-width: 92px;
  padding: 9px 12px;
  text-align: center;
  pointer-events: auto;
}

.shot-cost span {
  color: #7fe9ff;
}

.shot-cost strong {
  font-size: 25px;
  color: #71f0ff;
}

.tool-button {
  width: 88px;
  height: 68px;
  padding: 0 10px;
  font-size: 15px;
  font-weight: 900;
  text-transform: uppercase;
}

.target-button {
  width: 76px;
}

.tool-button.is-active {
  color: #09202d;
  background: linear-gradient(180deg, #ffe98c, #ffb33e);
  border-color: rgba(255, 239, 170, 0.85);
}

.weapon-panel {
  right: max(14px, env(safe-area-inset-right));
  top: 27%;
  display: grid;
  gap: 12px;
  width: 112px;
}

.weapon-button {
  min-height: 66px;
  padding: 9px 8px;
  color: #f7fdff;
  cursor: pointer;
  pointer-events: auto;
}

.weapon-button span {
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.62);
}

.weapon-button strong {
  display: inline-block;
  margin-top: 7px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #1b1200;
  background: #ffd45a;
  font-size: 16px;
}

.phoenix-button {
  background: linear-gradient(180deg, rgba(180, 43, 34, 0.9), rgba(47, 14, 28, 0.94));
}

.dragon-button {
  background: linear-gradient(180deg, rgba(27, 92, 176, 0.92), rgba(19, 28, 69, 0.94));
}

.right-tools {
  right: max(16px, env(safe-area-inset-right));
  bottom: max(86px, calc(env(safe-area-inset-bottom) + 86px));
  display: grid;
  justify-items: end;
  gap: 12px;
}

.dev-panel {
  position: absolute;
  z-index: 4;
  left: max(12px, env(safe-area-inset-left));
  top: 132px;
  width: 156px;
  display: grid;
  gap: 5px;
  padding: 9px;
  border: 1px solid rgba(151, 235, 255, 0.34);
  border-radius: 8px;
  background: rgba(2, 18, 30, 0.68);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.dev-panel[hidden] {
  display: none;
}

.dev-panel div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 17px;
}

.dev-panel span {
  color: #94e9f5;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.dev-panel strong {
  color: #fff5b7;
  font-size: 12px;
  line-height: 1.2;
}

.dev-panel p {
  margin: 3px 0 0;
  color: #d8f8ff;
  font-size: 10px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.side-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 950;
  pointer-events: auto;
}

.log-button {
  width: 52px;
  border-radius: 8px;
  font-size: 12px;
  text-transform: uppercase;
}

.special-meter {
  width: 98px;
  height: 64px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  border-radius: 8px;
  border-color: rgba(217, 155, 255, 0.78);
  background: radial-gradient(circle at 38% 30%, rgba(255, 208, 255, 0.4), rgba(115, 39, 191, 0.88) 48%, rgba(34, 13, 65, 0.96) 100%);
  box-shadow: 0 0 30px rgba(183, 91, 255, 0.55), inset 0 0 22px rgba(255, 255, 255, 0.16);
  pointer-events: auto;
}

.special-meter span {
  width: 82px;
  color: #fff;
  font-size: 10px;
  text-align: center;
}

.charge-track {
  width: 70px;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(1, 10, 17, 0.72);
}

.charge-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #40e7ff, #ffe56b, #ff7a45);
  box-shadow: 0 0 18px rgba(255, 221, 97, 0.65);
}

.info-modal,
.records-modal {
  width: min(820px, calc(100vw - 32px));
  border: 1px solid rgba(142, 228, 255, 0.55);
  border-radius: 8px;
  padding: 0;
  color: #f7fdff;
  background: linear-gradient(180deg, rgba(6, 47, 69, 0.98), rgba(3, 18, 31, 0.98));
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.62);
}

.info-modal::backdrop,
.records-modal::backdrop {
  background: rgba(0, 7, 13, 0.62);
}

.info-modal form,
.records-modal form {
  padding: 22px;
}

.info-modal h1,
.records-modal h1 {
  margin: 0 0 14px;
  font-size: 24px;
}

.info-modal p,
.records-modal p {
  margin: 14px 0 18px;
  color: #bdeff8;
}

.records-modal {
  width: min(740px, calc(100vw - 32px));
}

.records-modal h2 {
  margin: 16px 0 10px;
  color: #fff5ba;
  font-size: 15px;
  line-height: 1.1;
  text-transform: uppercase;
}

.info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
  gap: 14px;
}

.info-section h2 {
  margin: 0 0 10px;
  color: #fff5ba;
  font-size: 15px;
  line-height: 1.1;
  text-transform: uppercase;
}

.fish-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: min(440px, calc(100dvh - 250px));
  overflow: auto;
}

.fish-table div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.fish-table span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.fish-table strong {
  color: #ffd978;
}

.rules-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.rules-panel ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: #d8f8ff;
  font-size: 13px;
  line-height: 1.35;
}

.settlement-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.settlement-summary div,
.event-row {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.settlement-summary div {
  padding: 9px 10px;
}

.settlement-summary span,
.event-row span {
  display: block;
  color: #8ce4f2;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.settlement-summary strong {
  display: block;
  margin-top: 3px;
  color: #fff5ba;
  font-size: 17px;
  line-height: 1.1;
}

.event-log {
  display: grid;
  gap: 8px;
  max-height: min(320px, calc(100dvh - 360px));
  overflow: auto;
}

.event-row {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 9px 10px;
}

.event-row strong {
  color: #f8fbff;
  font-size: 14px;
}

.event-row small {
  color: #bdeff8;
  font-size: 11px;
}

.event-row em {
  color: #ffd978;
  font-style: normal;
  font-weight: 950;
}

.close-button {
  width: 100%;
  height: 44px;
  font-weight: 900;
}

@media (max-width: 900px) and (orientation: portrait) {
  .game-stage {
    visibility: hidden;
    pointer-events: none;
  }

  .rotate-device {
    display: grid;
  }
}

@media (max-width: 980px) {
  .room-select-screen {
    padding: 24px;
  }

  .room-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .room-select-panel h1 {
    font-size: 34px;
  }

  .room-card {
    min-height: 180px;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .fish-table {
    max-height: 260px;
  }

  .settlement-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .event-row {
    grid-template-columns: 62px 1fr auto;
  }
}
