/* --- Global Styling --- */
body {
  font-family: 'Poppins', sans-serif;
  background: #ebf2fa;
  margin: 0;
  padding: 0;
  text-align: center;
}

/* Logo Used in All Pages Header Except Login */
#amja-logo {
  height: clamp(45px, 9vw, 100px);
  width: auto;
  max-width: 95vw;
  display: block;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  aspect-ratio: 1082 / 423;
}

.page-title {
  font-size: 3rem;
  font-weight: bold;
  font-family: 'League Spartan', 'Poppins', sans-serif;
  color: black;
  margin: 0.5rem;
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-box {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  position: relative;
  background: white;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  max-width: 350px;
  width: 100%;
}

.modal-container-multi-buttons {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  font-size: 1.25rem;
  font-weight: bold;
  color: #999;
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: #333;
}

.modal-box-text {
  font-size: 1rem;
  font-weight: bold;
}

.modal-box input {
  width: 80%;
  padding: 0.5rem;
  font-size: 1rem;
}

.modal-button {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  margin: 0 auto;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  color: #052f5f;
  background-color: #8ab59c;
  font-weight: bold;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: none;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
}

.modal-button:hover {
  color: white;
  background-color: #0a6a56;
}

/* Default Button Styling */
button {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  margin: 0 auto;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  color: #052f5f;
  background-color: #8ab59c;
  font-weight: bold;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: none;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
}

button.active {
  color: white;
  background-color: #0a6a56;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:hover:not(:disabled),
button:active:not(:disabled) {
  color: white;
  background-color: #0a6a56;
}

/* Prevent button hover styling from “sticking” on mobile */
@media (hover: none) and (pointer: coarse) {
  button:hover {
    color: #052f5f;
    background-color: #8ab59c;
  }
}

/* Default Select Styling */
select {
  margin: 0.25rem;
  padding: 0.5rem 1rem;
  font-size: 1.25rem;
  background-color: white;
  color: #333;
  border: 2px solid #007bff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  text-align: center;
  text-align-last: center;
}

select:hover {
  border-color: #0056b3;
}

/* Styling of Controls Above Tiles */
.above-tiles-controls-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 0.5rem auto;
  gap: 0.25rem;
}

.above-tiles-dropdown-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.above-tiles-button-section {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

/* Styling of Controls Below Tiles */
.below-tiles-controls-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 0.5rem 0 0;
}

.below-tiles-controls-section-button-row {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  justify-content: center;
  width: 100%;
}

.below-tiles-controls-section button {
  margin: 0;
}

/* Validate My Hand Button Styling */
.validate-button {
  background-color: #b98c28;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
  cursor: pointer;
  transition:
    box-shadow 0.2s,
    transform 0.2s;
}

button.validate-button:hover {
  background-color: #b98c28;
  color: #052f5f;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14);
  transform: translateY(-2px) scale(1.025);
}

/* 14-Tile Hand Styling */
.hand-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0.5rem;
  max-width: 100%;
}

.hand-wrapper {
  display: grid;
  grid-template-columns: repeat(14, minmax(15px, 100px));
  margin-bottom: 0.25rem;
  gap: 0.5rem;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

.hand-labels {
  display: grid;
  grid-template-columns: repeat(14, minmax(15px, 100px));
  font-size: 1rem;
  gap: 0.5rem;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

.hand-slot {
  aspect-ratio: 2 / 3;
  max-width: 100px;
  border: 1px dashed #aaa;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: white;
}

.hand-slot img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

@media (max-width: 480px) {
  .hand-wrapper,
  .hand-labels {
    gap: 0.25rem;
  }
}

.remove-tile-btn {
  position: absolute;
  top: -0.25rem;
  left: -0.25rem;
  background: red;
  color: white;
  font-weight: bold;
  font-size: 1.25rem;
  width: 1.5rem;
  height: 1.5rem;
  line-height: 1.5rem;
  text-align: center;
  cursor: pointer;
  z-index: 10;
  border: none;
  /* Start Hidden*/
  opacity: 0;
  transition: opacity 0.2s;
}

.hand-slot:hover .remove-tile-btn,
.hand-slot:focus-within .remove-tile-btn {
  opacity: 1;
}

/* Tile Selection Table */
.tile-table {
  display: grid;
  grid-template-columns: repeat(9, minmax(30px, 90px));
  grid-template-rows: repeat(4, auto);
  gap: 1rem 1rem;
  margin: 0.5rem 0.5rem 0.5rem 0.5rem;
  justify-content: center;
}

.tile-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  max-width: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.tile-counter {
  position: absolute;
  bottom: -0.75rem;
  font-size: 1rem;
  background-color: #333;
  color: white;
  border-radius: 8px;
  padding: 3px 6px;
  font-weight: bold;
  line-height: 1rem;
  left: 50%;
  transform: translateX(-50%);
}

/* Hand Instructions - Displays when 2 or more tiles are in 14-tile hand */
.hand-instructions {
  font-size: 1rem;
  font-weight: bold;
  margin: 0;
}

/* Instructions above Tile Selection Table */
.tile-instructions {
  font-size: 1rem;
  font-weight: bold;
  margin: 0 0 0.5rem;
}

/* Game Timer */
#timer {
  display: block;
  font-size: 1.25rem;
  font-weight: bold;
  margin: 0.5rem auto 0;
  line-height: 1.2;
}

/* Hand Validation Modal/Popup Text Styling */
.hand-validation-fail-title {
  text-align: center;
  font-size: 1rem;
  font-weight: bold;
}

.hand-validation-fail-text {
  text-align: center;
  font-size: 1rem;
}

.hand-validation-success-title {
  text-align: center;
  font-size: 1.2rem;
  font-weight: bold;
  color: #0a6a56;
}

.hand-validation-success-difficulty {
  text-align: center;
  font-size: 1rem;
  font-weight: bold;
}

.hand-validation-success-text {
  text-align: center;
  font-size: 1rem;
}

/* --- Login.html Header --- */
#login-header {
  width: 100%;
  box-sizing: border-box;
  padding: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f6f4ed;
  border-bottom: 1px solid #ddd;
}

/* Login Container */
#login-wrapper {
  max-width: 400px;
  width: 100%;
  margin: 1rem auto;
  text-align: center;
}

/* Login Title - League Spartan as Primary */
#login-title {
  font-size: 1.75rem;
  font-family: 'League Spartan', 'Poppins', sans-serif;
  font-weight: bold;
  color: black;
  margin: 1rem auto;
}

/* Login Email Input */
#login-email-input-container {
  width: 100%;
  margin: 1rem auto;
}

#login-email-input {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  display: block;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

/* Mailcheck Suggestion */
#login-email-suggestion {
  color: #1e90ff;
  font-size: 0.95rem;
  margin: 1rem;
}

/* Login Status Message */
#login-status {
  margin-top: 1rem;
  font-size: 0.95rem;
}

/* --- Header for All Pages Except Login --- */
#header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  background-color: #f6f4ed;
  border-bottom: 1px solid #ddd;
}

/* NEW: Make #header a 3-col layout with the center always centered */
#header > div {
  flex: 0 0 auto;
}

#logo-area {
  flex: 0 0 auto;
  padding: 0.75rem;
  z-index: 20;
}

#streak-area {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  display: none;
}

.streak-box {
  display: flex;
  align-items: center;
  background: #ebf2fa;
  border: 2px solid #a82b11;
  border-radius: 16px;
  padding: 0.5rem 0.5rem;
  max-width: 425px;
  box-shadow: 0 1px 4px 0 rgba(80, 60, 180, 0.04);
}

.streak-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.5rem;
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  position: relative;
  transition: transform 0.15s;
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .streak-badge {
    display: none;
  }
}

@media (max-width: 600px) {
  .streak-sub {
    display: none;
  }
  .streak-emoji {
    display: none;
  }
  .streak-box {
    width: 135px;
    padding: 0.25rem 0.25rem;
  }
}

.streak-badge:hover {
  transform: scale(1.06) rotate(-2deg);
}

.streak-badge-svg {
  width: clamp(28px, 6vw, 56px);
  height: clamp(28px, 6vw, 56px);
  display: block;
}

.streak-badge-circle {
  fill: #f6f4ed;
  stroke: #0a6a56;
  stroke-width: 4;
}

.streak-count {
  font-size: 1.75rem;
  font-family: inherit;
  fill: #a82b11;
  font-weight: bold;
  dominant-baseline: middle;
  text-anchor: middle;
  transition: font-size 0.15s;
}

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

.streak-main {
  font-size: 1rem;
  font-weight: 600;
  color: black;
  display: flex;
  align-items: center;
  gap: 0.25em;
}

.streak-emoji {
  font-size: 1.4em;
  margin-right: 0.25em;
}

.streak-sub {
  font-size: clamp(0.8rem, 2vw, 0.95rem);
  color: black;
  white-space: nowrap;
}

#user-menu-container {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  z-index: 20;
  margin-bottom: 0;
}

#user-area {
  display: flex;
  flex-direction: column;
  text-align: right;
  margin-right: 0.75rem;
  /* margin-bottom: 0.5rem; */
}

#menu-area {
  margin-right: 0.75rem;
  text-align: right;
}

#menu-toggle {
  cursor: pointer;
  font-size: 1.2rem;
  color: #0a6a56;
  font-weight: bold;
  user-select: none;
}

#menu-toggle:hover {
  font-weight: bold;
  color: #a82b11;
}

#dropdown-menu {
  position: absolute;
  top: 100%; /* Show directly below #menu-toggle */
  right: 0;
  background-color: #f6f4ed;
  border: 1px solid #ccc;
  border-radius: 0 0 8px 8px;
  padding: 0;
  margin: 0;
  list-style: none;
  display: none;
  z-index: 1000;
  min-width: 200px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

#dropdown-menu li {
  position: relative;
  padding: 0.5rem 0.75rem;
  text-align: right;
}

#dropdown-menu li::after {
  content: '•';
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: black;
  font-size: 1.2rem;
}

#dropdown-menu li a {
  display: inline-block;
  width: 100%;
  text-decoration: none;
  font-size: 1.2rem;
  color: #0a6a56;
  padding-right: 1rem; /* space for bullet */
  box-sizing: border-box;
}

#dropdown-menu li a:hover {
  color: #a82b11;
  font-weight: bold;
  text-decoration: underline;
}

.menu-divider {
  margin: 0 auto;
  width: 90%;
}

/* --- Footer for All Pages --- */
.site-footer {
  margin-top: 2rem;
  padding: 1rem 0;
  font-size: 0.9rem;
  color: #333;
  border: 1px solid #ddd;
  background-color: #f6f4ed;
}

.site-footer a {
  margin: 0 1rem;
  text-decoration: none;
  color: inherit;
  transition: color 0.2s ease;
}

.site-footer a:hover {
  color: #0a6a56;
}



/* --- Home.html Styling --- */
/* Game Grid Styling */
.game-grid {
  display: grid;
  grid-template-columns: repeat(2, 300px);
  grid-template-rows: repeat(2, 300px);
  gap: 1rem;
  justify-content: center;
  align-content: center;
}

.game-grid-item {
  width: 100%;
  height: 100%;
  padding: 0;
  background: none;
  box-shadow: none;
  border-radius: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  cursor: pointer;
  overflow: hidden;
  margin: 0;
  max-width: 300px;
  max-height: 300px;
}

.game-grid-item img {
  width: 100%;
  height: 100%;
  max-width: 300px;
  max-height: 300px;
  aspect-ratio: 1/1;
  display: block;
  object-fit: cover;
  border-radius: 0;
  margin: 0;
}

.game-grid-item:hover img {
  filter: brightness(0.94);
  transform: scale(1.025);
  transition:
    filter 0.2s,
    transform 0.2s;
}

/* Responsive: stack game-grid a single column on small screens */
@media (max-width: 650px) {
  .game-grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, 300px);
    min-height: auto;
    justify-items: center;
  }
}

/* Email Not Approved Error Styling */
#email-not-approved-error-message {
  color: red;
  font-weight: bold;
  margin-top: 2rem;
}

/* --- Hand-Builder.html Styling --- */
/* Flash Animation Applied to Section and Line Select */
.flash {
  animation: flashHighlight 0.6s ease-in-out;
}

@keyframes flashHighlight {
  0% {
    background-color: #ffff99;
  }
  50% {
    background-color: #ffffff;
  }
  100% {
    background-color: #ffff99;
  }
}

/* Spin Animation Applied to Random Hand Button */
.spin {
  animation: spin 0.5s linear;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.hand-builder-hand-color-info {
  font-weight: bold;
  font-size: 1.5rem;
}

.hand-builder-parenthetical-details-info {
  font-size: 1.25rem;
}

/* --- Finish-the-Hand.html Styling --- */
/* Locked Tile Slots in 14 Tile Hand */
.locked-slot {
  border: 2px solid #a82b11 !important;
  background-color: #f6f6f6;
}

.locked-slot img {
  opacity: 0.9;
  cursor: not-allowed;
}

.locked-slot .remove-tile-btn {
  display: none !important;
}

/* --- Scrambled-Hand.html Styling --- */
/* Locked Tile Slots in 14 Tile Hand */
.locked-slot-scrambled-hand {
  background-color: #f6f6f6;
}

.locked-slot-scrambled-hand img {
  cursor: grab;
}

.locked-slot-scrambled-hand .remove-tile-btn {
  display: none !important;
}

/* --- Charleston-Challenge.html Styling --- */
/* Modal/Popup Styling */
.charleston-summary-popup-title,
.charleston-stop-continue-popup-title {
  font-size: 1.2rem;
  color: #0a6a56;
  font-weight: bold;
  text-align: center;
}

.charleston-summary-popup-paragraph,
.charleston-stop-continue-popup-paragraph {
  font-size: 1rem;
  margin-bottom: 1rem;
	text-align: left;
}

.charleston-stop-continue-popup-matching-tiles {
  font-size: 1rem;
  font-weight: bold;
  text-align: center;
}

.charleston-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0.5rem auto 0 auto;
  max-width: 1100px;
  padding: 0 1rem;
}

#charleston-timer {
  font-size: 1.25rem;
  font-weight: bold;
}

#charleston-phase-indicator {
  font-size: 1.5rem;
  font-weight: bold;
  margin-top: 1rem;
}

#matching-window-container {
  margin: 1rem auto;
  max-width: 600px;
  text-align: left;
  border-radius: 8px;
  background: #f8f8f8;
  padding: 1rem 1.5rem;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.05);
}

#matching-window-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

#matching-header-title {
  flex: 1;
  text-align: center;
  font-weight: bold;
  margin-left: 0;
}

#matching-hands-table {
  width: 100%;
  border-collapse: collapse;
}

#matching-hands-table th,
#matching-hands-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #e0e0e0;
  text-align: left;
  font-size: 1rem;
}

#matching-hands-table th {
  color: #0a6a56;
}

#matching-hands-table thead th {
  position: sticky;
  top: 0;
  background: #f8f8f8;
  z-index: 1;
}

#matching-table-scroll-container {
  max-height: 425px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid #eee;
}

.selected-matching-row {
  background: #e0faee;
  font-weight: bold;
  cursor: pointer;
}

.matching-row {
  cursor: pointer;
}

.matching-row:hover {
  background: #e7f5ff;
}

.compare-checkbox {
  transform: scale(1.3);
  accent-color: #24b34a; /* Green if you want */
  cursor: pointer;
}

.sort-controls {
  margin: 1rem 0 0.5rem 0;
  display: inline-flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

.hand-titles {
  text-align: center;
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 0.75rem;
}

@keyframes pulse-border {
  0% {
    box-shadow: 0 0 0 0 #57bb5a99;
    border-color: #57bb5a;
  }
  70% {
    box-shadow: 0 0 8px 6px #57bb5a33;
    border-color: #37b53f;
  }
  100% {
    box-shadow: 0 0 0 0 #57bb5a99;
    border-color: #57bb5a;
  }
}

.hand-slot.matching {
  border: 3px solid #57bb5a;
  background: #e8fbe5; /* Subtle green tint */
  animation: pulse-border 1.4s infinite;
  opacity: 1;
  position: relative;
  z-index: 2;
}

.hand-slot.matching::after {
  content: '✔';
  color: #218838;
  font-size: 1.5rem;
  font-weight: bold;
  position: absolute;
  top: 2px;
  left: 4px;
  pointer-events: none;
  opacity: 0.9;
}

.hand-slot.not-matching-hand-row {
  border: 2px solid #e14c3a; /* Red border */
  opacity: 0.6;
}

.hand-slot.not-matching-player1-hand {
  border: 2px solid #e14c3a; /* Red border */
  opacity: 1;
  position: relative;
  z-index: 2;
}

.hand-slot.not-matching-player1-hand::after {
  content: '❌';
  font-size: 1rem;
  position: absolute;
  top: 2px;
  left: 4px;
  pointer-events: none;
  opacity: 0.9;
}

.pass-area-wrapper {
  background: #f8f8f8;
  display: grid;
  margin: 0 auto 0.25rem auto;
  grid-template-columns: repeat(3, 100px);
  gap: 0.5rem;
  padding: 0.5rem;
  justify-content: center;
  width: fit-content;
}

.pass-area-slot {
  aspect-ratio: 2 / 3;
  max-width: 100px;
  border: 1px dashed #aaa;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: white;
}

.pass-area-slot img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

#pass-direction-label {
  margin: 0.5rem 0;
  font-weight: bold;
  font-size: 1.1rem;
  text-align: center;
}

#pass-btn {
  margin: 1rem auto 0 auto;
  display: block;
}

#debug-area {
  margin: 2rem auto;
  background: #f2f2f2;
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.93rem;
  color: #444;
  text-align: left;
}
