*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 500px;
  margin: 0;
  background: #000;
}

body {
  font-family: "Pretendard", "Noto Sans KR", Arial, sans-serif;
  color: #fff;
  overflow-x: hidden;
}

button {
  font: inherit;
  cursor: pointer;
}

.game-pc-wrap {
  width: min(100%, 1320px);
  min-width: 500px;
  margin: 0 auto;
  padding: 8px 10px 10px;
  background: #000;
}

.top-layout {
  display: grid;
  grid-template-columns: minmax(290px, 400px) minmax(360px, 500px) minmax(290px, 400px);
  gap: 10px;
  align-items: start;
}

.side-panel,
.chat-panel {
  height: 500px;
  padding: 14px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(39, 190, 20, 0.18), transparent 36%),
    linear-gradient(180deg, #020703 0%, #000 100%);
  border: 4px solid #28b915;
  box-shadow:
    inset 0 0 18px rgba(40, 185, 21, 0.15),
    0 0 12px rgba(40, 185, 21, 0.25);
  overflow: hidden;
}

.chat-panel {
  background:
    radial-gradient(circle at top right, rgba(39, 190, 20, 0.14), transparent 36%),
    linear-gradient(180deg, #020703 0%, #000 100%);
}

.panel-head {
  position: relative;
  margin-bottom: 12px;
}

.panel-label {
  color: #ffc425;
  font-size: 17px;
  line-height: 1;
  font-weight: 500;
}

.panel-title {
  margin-top: 2px;
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  color: #fff;
}

.panel-toggle {
  display: none;
  position: absolute;
  right: 0;
  top: 8px;
  min-width: 70px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.round-badge {
  position: absolute;
  right: 0;
  top: 21px;
  min-width: 78px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffc425;
  font-size: 17px;
  font-weight: 800;
  background: rgba(8, 11, 8, 0.95);
  border: 2px solid rgba(255, 186, 34, 0.65);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 16px;
}

.summary-card {
  height: 66px;
  border-radius: 9px;
  border: 1px solid #27b617;
  background: #030403;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 10px rgba(38, 184, 17, 0.08);
}

.summary-card span {
  margin-bottom: 3px;
  font-size: 15px;
  font-weight: 700;
}

.summary-card strong {
  font-size: 15px;
  font-weight: 500;
}

.green { color: #31ff3d !important; }
.red { color: #ff3b3b !important; }
.blue { color: #0096ff !important; }
.yellow { color: #ffc425 !important; }

.tab-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 18px;
}

.tab-btn {
  height: 42px;
  border-radius: 8px;
  border: 1px solid rgb(27 113 16);
  background: #050700;
  color: rgba(255, 255, 255, 0.45);
  font-size: 15px;
  font-weight: 800;
}

.tab-btn.active {
  color: #ffc425;
  border: 3px solid #28b915;
  box-shadow:
    inset 0 0 12px rgba(40, 185, 21, 0.14),
    0 0 8px rgba(40, 185, 21, 0.28);
}

.history-table {
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #27b617;
  background: #030700;
}

.history-row {
  display: grid;
  grid-template-columns: 0.7fr 0.6fr 1.25fr 0.85fr 1.2fr;
  min-height: 39px;
  align-items: center;
  border-bottom: 1px solid rgba(39, 182, 23, 0.35);
}

.history-row:last-child {
  border-bottom: 0;
}

.history-head {
  min-height: 48px;
  background: linear-gradient(180deg, #123907, #061800);
}

.history-row div {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.history-head div {
  font-size: 17px;
  font-weight: 500;
}

.result-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: #000;
}

.result-win { background: #43f036; }
.result-lose { background: #ff4242; }

.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
}

.page-btn {
  width: 31px;
  height: 31px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #07100d;
  color: rgba(255, 255, 255, 0.65);
  font-size: 15px;
  font-weight: 800;
}

.page-btn.active {
  background: #116b2e;
  color: #fff;
  border-color: #31ff3d;
}

.center-frame {
  width: 100%;
  overflow: hidden;
  background: #050505;
}

@media (min-width: 1000px) {
  .center-frame {
    height: 500px;
  }
}

.center-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
  transform: none !important;
  transform-origin: initial !important;
}

.history-empty {
  height: 156px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.45);
  font-size: 16px;
  font-weight: 700;
}

.chat-box {
  height: 392px;
  margin-top: 10px;
  border-radius: 9px;
  border: 1px solid #27b617;
  overflow: hidden;
  background: #020502;
  display: flex;
  flex-direction: column;
}

.chat-status {
  height: 34px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(39, 182, 23, 0.55);
  background: rgba(16, 38, 7, 0.9);
}

.chat-users {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #ccc;
}

.online-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #44e733;
  box-shadow: 0 0 10px rgba(68, 231, 51, 0.8);
}

.chat-space {
  flex: 1;
  padding: 14px;
  color: rgba(255, 255, 255, 0.25);
  font-size: 15px;
}

.chat-input-row {
  height: 52px;
  padding: 7px 9px;
  display: flex;
  gap: 8px;
  border-top: 1px solid rgba(39, 182, 23, 0.5);
}

.chat-input {
  flex: 1;
  height: 38px;
  padding: 0 14px;
  border-radius: 7px;
  border: 1px solid rgba(39, 182, 23, 0.45);
  background: #010201;
  color: rgba(255, 255, 255, 0.45);
  font-size: 15px;
  display: flex;
  align-items: center;
}

.send-btn {
  width: 47px;
  height: 38px;
  border-radius: 7px;
  border: 2px solid #28b915;
  background: linear-gradient(180deg, #1a6610, #062d04);
  color: #fff;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(40, 185, 21, 0.45);
}

.send-btn svg {
  display: block;
}

.bet-board {
  margin-top: 10px;
  height: 265px;
  border-radius: 22px;
  border: 4px solid #006edb;
  background:
    radial-gradient(circle at 15% 20%, rgba(43, 185, 20, 0.13), transparent 35%),
    linear-gradient(180deg, #041006 0%, #010602 100%);
  box-shadow:
    inset 0 0 22px rgba(0, 110, 219, 0.16),
    0 0 12px rgba(0, 110, 219, 0.32);
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(560px, 720px) minmax(360px, 1fr);
  gap: 18px;
}

.amount-panel {
  padding: 12px;
  border-radius: 13px;
  border: 1px solid rgba(0, 110, 219, 0.8);
  background: rgba(1, 8, 3, 0.95);
}

.amount-top {
  display: grid;
  grid-template-columns: 90px minmax(170px, 1fr) minmax(170px, 210px);
  align-items: center;
  margin-bottom: 8px;
}

.round-icons {
  display: flex;
  gap: 7px;
}

.round-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #eee;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.round-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.timer {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 21px;
  font-weight: 500;
}

.timer img {
  width: 30px;
  height: 30px;
}

.timer strong {
  color: #ff2626;
  font-size: 28px;
}

.balance {
  justify-self: end;
  min-width: 0;
  width: 100%;
  height: 38px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  color: #30ff55;
  font-size: 20px;
  font-weight: 500;
  background: rgba(4, 16, 3, 0.8);
  border-radius: 10px;
  text-shadow: 0 0 10px rgba(48, 255, 85, 0.5);
}

.balance img {
  width: 26px;
  height: 26px;
}

.bet-input {
  height: 50px;
  padding: 0 24px;
  border-radius: 999px;
  background: #fff;
  color: #000;
  border: 3px solid rgba(221, 164, 52, 0.9);
  font-size: 24px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.18);
  margin-bottom: 10px;
}

.bet-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #000;
  font: inherit;
  font-weight: 500;
}

.amount-bottom {
  display: grid;
  grid-template-columns: 1fr 118px;
  gap: 10px;
  align-items: end;
}

.chip-row {
  display: flex;
  gap: clamp(2px, 1.2vw, 5px);
  align-items: center;
}

.amount-btn {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.amount-btn img {
  width: 100%;
  height: 100%;
  display: block;
}

.amount-btn span {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 23px;
  font-weight: 500;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.65);
  white-space: nowrap;
}

.utility-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.utility-btn,
.symbol-badge {
  height: 31px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 500;
}

.symbol-badge {
  border-color: rgba(255, 255, 255, 0.35);
}

.bet-button-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
}

.image-bet-btn {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  overflow: hidden;
  color: #fff;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.18);
}

.image-bet-btn img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
}

.image-bet-btn .bet-label {
  position: absolute;
  left: 28%;
  top: 45%;
  transform: translate(-50%, -50%);
  font-size: 43px;
  font-weight: 500;
  color: #fff;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.75),
    0 0 10px rgba(255, 255, 255, 0.45);
}

.image-bet-btn .animal-label {
  left: 48%;
  top: 45%;
}

.image-bet-btn .bet-rate {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 16px;
  font-weight: 500;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.image-bet-btn:active,
.amount-btn:active,
.round-icon:active,
.utility-btn:active,
.tab-btn:active,
.page-btn:active,
.send-btn:active {
  transform: scale(0.97);
}

.pc-settings-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.pc-settings-modal.active {
  display: flex;
}

.pc-settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.74);
}

.pc-settings-dialog {
  position: relative;
  width: 430px;
  border-radius: 16px;
  border: 3px solid #28b915;
  background:
    radial-gradient(circle at top left, rgba(49, 255, 61, 0.16), transparent 42%),
    linear-gradient(180deg, #071307, #010501);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65), 0 0 20px rgba(40, 185, 21, 0.3);
  overflow: hidden;
}

.pc-settings-header {
  height: 58px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(40, 185, 21, 0.45);
}

.pc-settings-header strong {
  color: #ffc425;
  font-size: 24px;
  font-weight: 500;
}

.pc-settings-close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 26px;
  line-height: 1;
}

.pc-settings-body {
  padding: 16px;
}

.pc-settings-note {
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 14px;
  font-weight: 700;
}

.pc-settings-row {
  display: grid;
  grid-template-columns: 64px 1fr 122px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.pc-settings-row label {
  color: #fff;
  font-size: 16px;
  font-weight: 500;
}

.pc-settings-row input {
  width: 100%;
  height: 38px;
  border-radius: 8px;
  border: 2px solid rgba(255, 196, 37, 0.72);
  background: #fff;
  color: #000;
  padding: 0 10px;
  font-size: 16px;
  font-weight: 500;
}

.pc-settings-colors {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.pc-color-pick {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 4px 8px rgba(255, 255, 255, 0.22);
}

.pc-color-pick.red { background: #df1818; }
.pc-color-pick.blue { background: #0b73ff; }
.pc-color-pick.green { background: #2bcf18; }

.pc-color-pick.selected {
  border-color: #ffc425;
  box-shadow: 0 0 0 3px rgba(255, 196, 37, 0.18), 0 0 14px rgba(255, 196, 37, 0.55);
}

.pc-settings-actions {
  padding: 0 16px 16px;
}

.pc-settings-save {
  width: 100%;
  height: 44px;
  border-radius: 10px;
  border: 2px solid #28b915;
  background: linear-gradient(180deg, #1c7a13, #073204);
  color: #fff;
  font-size: 18px;
  font-weight: 500;
  box-shadow: 0 0 14px rgba(40, 185, 21, 0.42);
}

/* 1000px 미만: 게임을 위로, 내역/채팅을 아래 2열로 재배치 */
@media (max-width: 999px) {
  .game-pc-wrap {
    padding: 8px 0 10px;
  }

  .top-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    padding: 0 8px;
  }

  .center-frame {
    grid-column: 1 / -1;
    grid-row: 1;
    width: calc(100% + 16px);
    margin-left: -8px;
    margin-right: -8px;
  }

  .bet-board {
    margin-left: 8px;
    margin-right: 8px;
  }

  .side-panel,
  .chat-panel {
    grid-row: 2;
    width: 100%;
    height: 480px;
    padding: 12px;
    border-radius: 18px;
  }

  .side-panel.is-collapsed,
  .chat-panel.is-collapsed {
    height: 76px;
  }

  .side-panel.is-collapsed > :not(.panel-head),
  .chat-panel.is-collapsed > :not(.panel-head) {
    display: none;
  }

  .panel-toggle {
    display: block;
  }

  .side-panel .round-badge {
    right: 82px;
    top: 10px;
  }

  .panel-title {
    font-size: 25px;
  }

  .panel-label,
  .history-head div {
    font-size: 14px;
  }

  .history-row div {
    font-size: 11px;
  }

  .chat-box {
    height: 356px;
  }

  .bet-board {
    height: auto;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 11px;
    border-radius: 18px;
  }

  .amount-panel {
    min-width: 0;
  }

  .bet-button-panel {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: 1fr;
    min-height: 112px;
  }
}

/* 정사각형 중국점이 넓어지는 태블릿 구간: 하단 3개 보조 로드까지 노출 */
@media (min-width: 700px) and (max-width: 999px) {
  .center-frame {
    min-height: 0;
    max-height: none;
  }

  .amount-btn span {
    font-size: 25px;
  }
}

/* 좁은 PC/태블릿: 세 영역을 한 열로 표시 */
@media (max-width: 699px) {
  .top-layout {
    grid-template-columns: 1fr;
  }

  .center-frame,
  .side-panel,
  .chat-panel {
    grid-column: 1;
  }

  .center-frame {
    grid-row: 1;
  }

  .side-panel {
    grid-row: 2;
  }

  .chat-panel {
    grid-row: 3;
  }

  .side-panel,
  .chat-panel {
    height: 480px;
  }

  .chat-box {
    height: 326px;
  }

  .amount-top {
    grid-template-columns: 82px minmax(140px, 1fr) minmax(135px, 170px);
  }

  .timer {
    gap: 5px;
    font-size: 17px;
  }

  .timer strong {
    font-size: 23px;
  }

  .balance {
    padding: 0 8px;
    font-size: 16px;
  }

  .bet-input {
    height: 46px;
    padding: 0 18px;
    font-size: 20px;
  }

  .amount-btn span {
    font-size: 18px;
  }

  .bet-button-panel {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    min-height: 210px;
    gap: 8px;
  }

  .pc-settings-dialog {
    width: min(430px, calc(100% - 24px));
  }
}
