.container {
  width: 100vw;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-image: linear-gradient(to bottom, var(--rules-bg), var(--white));
}

.banner {
  /* display: flex; */
  justify-content: center;
  align-items: center;
}
.banner img {
  padding: 4vw 4vw 0 6vw;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 100%;
  display: block;
}

.time-text {
  font-size: 1rem;
  color: var(--black);
  text-align: center;
  font-weight: 700;
  margin: 8px 0 0;
}

.wrapper {
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
  box-sizing: border-box;
}

.player-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 24px 0 16px 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logout-link {
  color: var(--light-gray);
  font-size: 1.2rem;
  font-weight: bold;
  transition: color 0.2s;
}

.username,
.balance {
  margin: 0 0 4px 0;
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.game-container .bell {
  margin: 20px 0;
  padding: 20px;
  cursor: default;
}

.game-container .bell img {
  width: 60vw;
  height: 60vw;
  max-width: 500px;
  max-height: 500px;
}

@keyframes shake-bell {
  0% {
    transform: rotate(0) scale(1);
    filter: brightness(1);
  }
  5% {
    transform: rotate(-5deg) scale(1.12);
    filter: brightness(1.08);
  }
  10% {
    transform: rotate(5deg) scale(1.25);
    filter: brightness(1.12);
  }
  15% {
    transform: rotate(-4deg) scale(1.32);
    filter: brightness(1.15);
  }
  20% {
    transform: rotate(4deg) scale(1.4);
    filter: brightness(1.18);
  }
  25% {
    transform: rotate(-3deg) scale(1.32);
    filter: brightness(1.15);
  }
  30% {
    transform: rotate(3deg) scale(1.25);
    filter: brightness(1.12);
  }
  35% {
    transform: rotate(-2deg) scale(1.18);
    filter: brightness(1.09);
  }
  40% {
    transform: rotate(2deg) scale(1.12);
    filter: brightness(1.06);
  }
  45% {
    transform: rotate(-1deg) scale(1.06);
    filter: brightness(1.03);
  }
  50% {
    transform: rotate(1deg) scale(1.02);
    filter: brightness(1.01);
  }
  55% {
    transform: rotate(-1deg) scale(1.01);
    filter: brightness(1);
  }
  60% {
    transform: rotate(1deg) scale(1.01);
    filter: brightness(1);
  }
  65% {
    transform: rotate(-0.5deg) scale(1);
    filter: brightness(1);
  }
  70% {
    transform: rotate(0.5deg) scale(1);
    filter: brightness(1);
  }
  75% {
    transform: rotate(-0.3deg) scale(1);
    filter: brightness(1);
  }
  80% {
    transform: rotate(0.3deg) scale(1);
    filter: brightness(1);
  }
  85% {
    transform: rotate(-0.1deg) scale(1);
    filter: brightness(1);
  }
  90% {
    transform: rotate(0.1deg) scale(1);
    filter: brightness(1);
  }
  95% {
    transform: rotate(0deg) scale(1);
    filter: brightness(1);
  }
  100% {
    transform: rotate(0) scale(1);
    filter: brightness(1);
  }
}
.bell.shake {
  animation: shake-bell 3s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
  transition: all 0.3s ease-in-out;
}

.progress-title {
  margin: 18px 0 6px 0;
  text-align: center;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto 4px auto;
  font-weight: bold;
  font-size: 1.1rem;
}

.progress-labels .current {
  color: var(--primary-gold);
}

.progress-labels .target {
  color: var(--orange);
}

.progress-bar {
  width: 100%;
  max-width: var(--max-width);
  height: 30px;
  background: var(--light-gray);
  border-radius: 10px;
  overflow: hidden;
  margin: 0 auto 16px auto;
}

.progress-bar .progress {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-gold), var(--orange));
  border-radius: 10px 0 0 10px;
  transition: width 0.4s;
}

.code-input-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 24px 0 20px 0;
  width: 100%;  
  max-width: var(--max-width);
}

.code-label {
  font-weight: bold;
  margin-bottom: 8px;
  letter-spacing: 1px;
  display: block;
}

.code-input-row {
  display: flex;
  gap: 8px;
  width: 100%;
  flex-direction: row; /* Mặc định là hàng ngang */
}

.code-input {
  flex: 1;
  padding: 6px 12px;
  border: 2px solid var(--light-gray);
  border-radius: 20px;
  font-size: 1rem;
  background: #fff;
  color: #222;
  outline: none;
  transition: border-color 0.2s;
}

.code-input::placeholder {
  color: var(--muted-gray);
  opacity: 0.7;
  font-style: italic;
}

.code-input:focus {
  border-color: var(--primary-gold);
}

.history-section {
  max-width: var(--max-width);
  margin: 24px auto 0;
}

/* Table header cố định, body scroll */
.history-section {
  max-width: var(--max-width);
  margin:24px auto 0;
}
.history-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.history-table thead th:first-child {
  border-top-left-radius: 8px;
}

.history-table thead th:last-child {
  border-top-right-radius: 8px;
}

.history-table thead th {
  background: #faf3e3;
  padding: 8px 6px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: var(--light-gray) solid 1px;
}

.history-table-wrapper {
  max-height: 210px;
  overflow-y: auto;
  border-radius: 0 0 8px 8px;
  border: 1px solid #eee;
  border-top: none;
  background: var(--rules-bg);
  scrollbar-width: thin;
  scrollbar-color: var(--primary-gold) var(--rules-bg);
}

.history-table-wrapper::-webkit-scrollbar {
  width: 8px;
  background: var(--rules-bg);
  border-radius: 8px;
}
.history-table-wrapper::-webkit-scrollbar-thumb {
  background: var(--primary-gold);
  border-radius: 8px;
}

.history-table th,
.history-table td {
  color: var(--black);
  font-size: 1rem;
  word-break: break-word;
  border-bottom: 1px solid #f3e9d7;
}

.history-table tr:hover {
  background: var(--rules-bg);
}

.rules-section {
  background: var(--rules-bg);
  border-radius: 18px;
  padding: 24px 18px 18px 18px;
  margin: 32px auto 0 auto;
  max-width: var(--max-width);
  box-shadow: 0 2px 8px var(--rules-shadow);
}

.rules-title {
  color: var(--rules-title);
  text-align: center;
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 12px;
}

.rules-tabs {
  display: flex;
  gap: 24px;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 12px;
}

.tab-btn {
  background: none;
  border: none;
  outline: none;
  font-size: 1.15rem;
  font-weight: bold;
  color: var(--tab-inactive);
  padding: 0 8px 6px 8px;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: color 0.2s, border-bottom 0.2s;
}

.tab-btn.active {
  color: var(--tab-active);
  border-bottom: 3px solid var(--tab-active);
}

.rules-content {
  margin-top: 8px;
}

.accordion {
  background: none;
  border-radius: 14px;
}

.accordion-item {
  border-bottom: 1px solid var(--accordion-border);
}

.accordion-header {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  text-align: left;
  font-size: 1.08rem;
  font-weight: bold;
  color: var(--accordion-header);
  padding: 16px 0;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
}

.accordion-header::after {
  content: "▼";
  float: right;
  font-size: 0.9em;
  color: var(--accordion-arrow);
  transition: transform 0.2s;
}

.accordion-header.active::after {
  transform: rotate(-180deg);
}

.accordion-body {
  display: none;
  padding: 0 0 14px 0;
  color: var(--accordion-body);
  font-size: 1rem;
  background: none;
}

.accordion-header.active + .accordion-body {
  display: block;
}

footer {
  border-top: var(--light-gray) solid 1px;
  background: var(--rules-shadow);
  /* color: var(--light-gray); */
  padding: 16px;
  text-align: center;
  width: 100%;
  margin-top: 40px;
}

footer p {
  font-style: italic;
  font-size: 1rem;
}



/* Responsive: chuyển sang 2 dòng khi màn hình nhỏ hơn 600px */
@media (max-width: 600px) {
  .code-input-row {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  .code-input {
    line-height: 40px;
  }
  .code-submit-btn {
    width: 50vw;
  }
}