* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: #f6f6f6;
  background-image: url("./assets/tentacle-bg.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
  color: #111;
  position: relative;
}

.ships_left_position {
  position: fixed;
  left: 0px;
  z-index: -2;
  bottom: 0;
  opacity: 60%;
  }
  
.ships_right_position {
  position: fixed;
  right: 0px;
  z-index: -2;
  bottom: 0;
  opacity: 90%;
  }

.site-header {
  min-height: 56px;
  padding: 20px 16px 10px;
}

.site-header-inner {
  width: min(980px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #102635;
}

.site-logo-image {
  width: 152px;
  height: auto;
  object-fit: contain;
  display: block;
}

.site-logo-text {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.site-register-button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid #121212;
  background: #121212;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  letter-spacing: 1px;
  font-size: 15px;
  font-weight: 400;
}

.page {
  display: flex;
  justify-content: center;
  padding: 24px 16px 36px;
}

.home-page {
  display: block;
}

.bank-section {
  width: 100%;
  max-width: 980px;
  text-align: center;
  margin: 0 auto;
}

.main-banner {
  width: 100%;
  height: auto;
  margin: 0 0 42px;
  border-radius: 10px;
  overflow: hidden;
}

.bank-section-content {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.main-banner-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.story-section {
  margin: 78px auto 0;
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 18px;
  align-items: center;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(15, 33, 48, 0.06);
}

.story-title {
  margin: 0 0 10px;
  font-size: 22px;
}

.story-text p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.story-image-wrap {
  display: flex;
  justify-content: center;
}

.story-image {
  width: min(100%, 340px);
  height: auto;
  display: block;
  border-radius: 10px;
}

.site-footer {
  margin: 16px 0 20px;
  text-align: center;
  color: #3a4956;
  font-size: 13px;
}

.site-footer p {
  margin: 0;
}

.lighthouse {
  width: 300px;
  height: auto;
  margin: 0 auto 12px 149px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lighthouse-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.main-title {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 1px;
}

.treasure-title {
  margin: 12px 0 48px;
  font-size: 14px;
  font-weight: 400;
 letter-spacing: 1px;
}

.balance-value {
  margin: 8px 0 24px;
  font-size: 17px;
  font-weight: 500;
}

.controls-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
}

.fake-select,
.setup-button {
  min-height: 38px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
}

.fake-select {
  flex: 1;
  max-width: 260px;
  text-align: left;
  padding: 0 12px;
  display: flex;
  align-items: center;
}

.setup-button {
  min-width: 130px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}

.setup-icon {
  font-size: 26px;
  line-height: 1;
}

.amount-buttons {
  margin-top: 14px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.amount-button,
.top-up-button,
.modal-action,
.play-button {
  min-height: 38px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  cursor: pointer;
}

.amount-button,
.top-up-button,
.modal-action,
.play-button,
.setup-button,
.fleet-action-button {
  transition:
    transform 0.18s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .amount-button:hover,
  .top-up-button:hover,
  .modal-action:hover,
  .play-button:hover,
  .setup-button:hover,
  .fleet-action-button:hover,
  .site-register-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(17, 27, 36, 0.14);
  }

  .amount-button:not(.active):hover,
  .top-up-button:hover,
  .setup-button:hover,
  .fleet-action-button:not(.fleet-action-button--dark):hover {
    background: #f8fbff;
    border-color: #b2c6d6;
  }

  .play-button:hover,
  .modal-action:hover,
  .fleet-action-button--dark:hover,
  .amount-button.active:hover,
  .site-register-button:hover {
    background: #1d2f3d;
    border-color: #1d2f3d;
    color: #fff;
  }
}

.amount-button.active {
  background: #0d0d0d;
  color: #fff;
  border-color: #0d0d0d;
}

.top-up-row {
  margin-top: 14px;
  display: flex;
  justify-content: flex-start;
}

.top-up-button {
  min-width: 150px;
  padding: 0 14px;
}

.play-hint {
  margin: 14px 0 20px;
  font-size: 14px;
  color: #3b3b3b;
  text-align: center;
}

.play-button {
  min-width: 150px;
  padding: 0 16px;
  border-color: #0d0d0d;
  background: #0d0d0d;
  color: #fff;
  letter-spacing: 1px;
  font-size: 15px;
  font-weight: 400;
}

.is-hidden {
  display: none;
}

.fleet-section {
  width: 100%;
  max-width: 860px;
}

.fleet-breadcrumbs,
.battle-breadcrumbs {
  margin: 0 0 12px;
  font-size: 14px;
  color: #b4b4b4;
}

.fleet-breadcrumbs a,
.battle-breadcrumbs a {
  color: #1a1a1a;
  text-decoration: none;
}

.fleet-breadcrumbs a:hover,
.battle-breadcrumbs a:hover {
  text-decoration: underline;
}

.fleet-title {
  margin: 0 0 16px;
  font-size: 30px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fleet-title-icon {
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.fleet-layout {
  display: flex;
  gap: 18px;
  align-items: stretch;
}

.fleet-board-wrap {
  --board-cell-size: 27.3px;
  --board-gap: 3px;
  width: 100%;
  max-width: 480px;
}

.board-frame {
  width: fit-content;
  border: 1px solid #d2d2d2;
  border-radius: 6px;
  padding: 4px;
  background: #f7f7f7;
}

.board-top-row {
  display: flex;
  gap: var(--board-gap);
}

.board-corner {
  width: var(--board-cell-size);
  height: var(--board-cell-size);
  color: #212121;
  display: flex;
  align-items: center;
  justify-content: center;
}

.board-corner svg {
  width: 22px;
  height: 22px;
}

.board-top-labels {
  display: grid;
  grid-template-columns: repeat(10, var(--board-cell-size));
  gap: var(--board-gap);
}

.board-side-labels {
  width: var(--board-cell-size);
  display: grid;
  grid-template-rows: repeat(10, var(--board-cell-size));
  gap: var(--board-gap);
}

.board-top-label,
.board-side-label {
  border-radius: 4px;
  background: #212121;
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.board-top-label {
  width: var(--board-cell-size);
  height: var(--board-cell-size);
}

.board-side-label {
  width: var(--board-cell-size);
  height: var(--board-cell-size);
}

.board-center-row {
  margin-top: var(--board-gap);
  display: flex;
  gap: var(--board-gap);
}

.fleet-board {
  width: fit-content;
  display: grid;
  grid-template-columns: repeat(10, var(--board-cell-size));
  grid-auto-rows: var(--board-cell-size);
  gap: var(--board-gap);
}

.board-frame.invalid-attempt {
  border-color: #d34e4e;
  animation: board-shake 0.22s linear;
}

.board-cell {
  width: var(--board-cell-size);
  height: var(--board-cell-size);
  border-radius: 3px;
  background: #ffffff;
  border: 1px solid #ececec;
  cursor: pointer;
}

.board-cell.ship {
  background: linear-gradient(180deg, #ecf7ff 0%, #def0ff 100%);
  border-color: transparent;
  position: relative;
}

.board-cell.ship.selected {
  outline: 1px solid rgba(47, 63, 76, 0.45);
}

.board-cell.ship.invalid {
  background: linear-gradient(180deg, #f3aaaa 0%, #dc7272 100%);
  border-color: #c65656;
}

.board-ship-stretch {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2d4e64;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

.board-ship-stretch.horizontal {
  width: calc((100% * var(--ship-span)) + (3px * (var(--ship-span) - 1)));
  height: 100%;
}

.board-ship-stretch.vertical {
  width: 100%;
  height: calc((100% * var(--ship-span)) + (3px * (var(--ship-span) - 1)));
}

.board-ship-stretch svg,
.board-ship-stretch .ship-icon-image {
  width: 100%;
  height: 82%;
  object-fit: contain;
  display: block;
}

.board-ship-stretch.vertical svg,
.board-ship-stretch.vertical .ship-icon-image {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc((100% * var(--ship-span)) + (3px * (var(--ship-span) - 1)));
  height: 82%;
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center;
}

@keyframes board-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  50% {
    transform: translateX(4px);
  }
  75% {
    transform: translateX(-3px);
  }
}

.fleet-instruction {
  margin: 6px 0 0;
  max-width: 320px;
  font-size: 13px;
  line-height: 1.4;
}

.fleet-side {
  width: 100%;
  max-width: 320px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

.fleet-actions {
  margin-top: auto;
  display: flex;
  gap: 10px;
}

.fleet-action-button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #bdbdbd;
  border-radius: 5px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.fleet-action-button--dark {
  border-color: #121212;
  background: #121212;
  color: #fff;
}

.fleet-action-icon {
  width: 20px;
  height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fleet-action-icon svg {
  width: 100%;
  height: 100%;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 12px;
  z-index: 3000;
}

.modal.open {
  display: flex;
}

.modal-content {
  width: min(640px, 100%);
  background-color: #fff;
  background-image: url("./assets/tentacle-bg.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  border-radius: 8px;
  padding: 16px 12px;
  text-align: center;
}

#modal-title {
  margin: 0;
  font-size: 17px;
  text-transform: uppercase;
}

#modal-text {
  margin: 8px 0 12px;
  font-size: 13px;
  text-transform: uppercase;
}

.modal-action {
  min-width: 90px;
  min-height: 38px;
  font-size: 14px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-transform: uppercase;
  background: #121212;
  border-color: #121212;
  color: #fff;
}

.modal-image {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  margin: 0 auto 12px;
}

.matchmaking-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 18, 24, 0.52);
  z-index: 1000;
}

.matchmaking-overlay.is-hidden {
  display: none;
}

.matchmaking-content {
  width: min(680px, 96vw);
  min-height: 300px;
  padding: 20px 16px 16px;
  border-radius: 12px;
  background-color: #ffffff;
  background-image: url("./assets/tentacle-bg.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.matchmaking-progress {
  --progress: 0%;
  width: 116px;
  height: 116px;
  margin: 0 auto;
  border-radius: 50%;
  background: conic-gradient(#1d2f3d var(--progress), #dce5ec 0);
  display: flex;
  align-items: center;
  justify-content: center;
}

.matchmaking-progress.is-hidden {
  display: none;
}

.matchmaking-progress-inner {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #1d2f3d;
}

.matchmaking-title {
  margin: 12px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: #2c3f4f;
}

.matchmaking-matchup {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: min(560px, 92vw);
  margin-left: auto;
  margin-right: auto;
}

.matchmaking-matchup.is-hidden {
  display: none;
}

.matchmaking-player {
  text-align: center;
}

.matchmaking-player .battle-avatar {
  width: 104px;
  height: 104px;
  margin-bottom: 4px;
}

.matchmaking-name {
  margin: 0;
  font-size: 13px;
}

.matchmaking-vs-image {
  width: 102px;
  height: 66px;
  object-fit: contain;
}

.game-section {
  width: min(560px, 100%);
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 12px;
  padding: 24px 18px;
  text-align: center;
}

.game-title {
  margin: 0;
  font-size: 30px;
}

.game-status {
  margin: 10px 0 14px;
  font-size: 16px;
  text-align: center;
}

.game-meta {
  margin: 6px 0;
  font-size: 14px;
  color: #3b3b3b;
  text-align: center;
}

#back-to-lobby {
  display: block;
  margin: 14px auto 0;
}

.game-page {
  align-items: flex-start;
}

.battle-section {
  width: min(980px, 100%);
}

.battle-boards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
  justify-items: center;
  align-items: flex-start;
}

.battle-board-col {
  min-width: 0;
}

.battle-board-wrap {
  --board-cell-size: 26px;
}

.battle-board-title {
  margin: 0 0 8px;
  font-size: 30px;
}

.battle-players {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.battle-player {
  justify-self: center;
  text-align: center;
}

.battle-avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: none;
  margin: 0 auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  background: #fff;
}

.battle-avatar--enemy {
  border-color: #6c1010;
  box-shadow: 0 0 10px rgba(167, 20, 20, 0.38);
}

.battle-avatar--photo {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.battle-name {
  margin: 0;
  font-size: 32px;
}

.battle-turn {
  justify-self: center;
  text-align: center;
  width: 140px;
  height: 132px;
}

.battle-turn-label {
  margin: 0;
  font-size: 26px;
}

.battle-turn-timer {
  margin: 4px 0 0;
  font-size: 64px;
  line-height: 1;
}

.enemy-marker {
  display: inline-flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  color: #138a20;
  font-size: 15px;
}

.board-cell.shot-hit {
  background: #ffe6e6;
  border-color: #f0b3b3;
}

.board-cell.shot-sunk {
  background: #ffcccc;
  border-color: #cf6b6b;
}

.board-cell.shot-miss {
  background: #f5f9fc;
}

.board-cell.shot-nearby {
  background: #f7fbff;
}

.shot-mark {
  display: inline-flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.shot-mark.hit {
  color: #c0392b;
}

.shot-mark.sunk {
  color: #8f1f1f;
}

.shot-mark.miss {
  color: #5f7484;
}

.shot-mark.nearby {
  color: rgba(95, 116, 132, 0.45);
}

@media (max-width: 920px) {
  .site-logo-text {
    font-size: 16px;
  }

  .site-register-button {
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
  }

  .main-title {
    font-size: 20px;
  }

  .treasure-title {
    font-size: 16px;
  }

  .balance-value {
    font-size: 14px;
  }

  .fake-select,
  .setup-button,
  .amount-button,
  .top-up-button,
  .modal-action,
  .play-button {
    font-size: 12px;
  }

  .controls-row {
    flex-direction: column;
  }

  .setup-button,
  .fake-select,
  .top-up-button,
  .play-button {
    width: 100%;
    max-width: 260px;
  }

  .top-up-row {
    justify-content: center;
  }

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

  .story-section {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .story-title {
    font-size: 20px;
  }

  .fleet-title {
    font-size: 24px;
  }

  .fleet-layout {
    flex-direction: column;
  }

  .fleet-side {
    max-width: none;
    min-height: auto;
  }

  .fleet-instruction {
    max-width: none;
  }

  .fleet-actions {
    margin-top: 14px;
    flex-wrap: wrap;
  }

  .battle-board-title {
    font-size: 24px;
  }

  .battle-boards {
    grid-template-columns: 1fr;
    row-gap: 16px;
  }

  .battle-name {
    font-size: 22px;
  }

  .battle-turn-label {
    font-size: 18px;
  }

  .battle-turn-timer {
    font-size: 44px;
  }

  .battle-players {
    row-gap: 12px;
  }
}

@media (max-width: 560px) {

.lighthouse {
  width: 206px;
  height: auto;
  margin: 0 auto 12px 140px;
}

  .story-section {
    margin-top: 18px;
    padding: 12px;
  }

  .story-text p {
    font-size: 13px;
  }

  .matchmaking-content {
    width: min(360px, 96vw);
  }

  .matchmaking-matchup {
    width: 100%;
    gap: 8px;
  }

  .matchmaking-player .battle-avatar {
    width: 72px;
    height: 72px;
  }

  .matchmaking-vs-image {
    width: 72px;
    height: 46px;
  }

  .fleet-board-wrap {
    --board-cell-size: 22px;
  }

  .fleet-title {
    font-size: 20px;
  }

  .board-top-label,
  .board-side-label {
    font-size: 10px;
  }

  .fleet-action-button {
    width: 100%;
  }

  .battle-breadcrumbs {
    font-size: 14px;
  }

  .battle-board-wrap {
    --board-cell-size: 20px;
  }

  .battle-players {
    gap: 16px;
  }

  .battle-avatar {
    width: 44px;
    height: 44px;
    font-size: 14px;
  }

  .battle-name {
    font-size: 16px;
  }
}

