/* =========================================
   SHARED THEME: CORE & UI COMPONENTS
   ========================================= */
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@700&family=Roboto+Mono:wght@500&family=Rubik:wght@400;700;900&display=swap");

:root {
  /* Colors */
  --felt-green: #0d5f38;
  --felt-dark: #062f1b;
  --tile-face: #fdf6e3;
  --tile-back: #2e8b57;

  --neon-blue: #00f3ff;
  --neon-pink: #ff0055;
  --neon-gold: #ffd700;
  --neon-orange: #ff4500;

  --shadow-light: #ccc;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  font-family: "Rubik", sans-serif;
  color: white;
  background: radial-gradient(
    circle at center,
    var(--felt-green),
    var(--felt-dark)
  );
  overflow: hidden;
  touch-action: none;
}

h1 {
  font-size: 1.2rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--neon-gold);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  margin: 0;
  font-weight: 900;
}

.hidden {
  display: none !important;
}

/* =========================================
   SHARED UI: MENU BUTTONS
   ========================================= */

/* Container for vertical button lists */
.menu-view {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  max-width: 320px;
  align-items: center;
  transition: opacity 0.3s ease;
}

/* 1. Big Yellow Start Button */
.start-screen-btn {
  width: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #ffd700, #ffc107);
  color: #4a3b00;
  box-shadow: 0 6px 0 #c69500, 0 10px 10px rgba(0, 0, 0, 0.3);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  font-family: "Rubik", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  text-decoration: none;
}
.start-screen-btn:active {
  transform: translateY(6px);
  box-shadow: 0 0 0 #c69500, inset 0 2px 5px rgba(0, 0, 0, 0.2);
}
.start-screen-btn:hover {
  transform: translateY(-2px);
  background: #ffe032;
}

/* 2. Secondary White/Grey Button */
.start-screen-btn.secondary {
  background: linear-gradient(145deg, #ffffff, #e6e6e6);
  color: var(--felt-dark);
  box-shadow: 0 6px 0 #bbb, 0 10px 10px rgba(0, 0, 0, 0.3);
  font-size: 1.2rem;
}
.start-screen-btn.secondary:active {
  box-shadow: 0 0 0 #bbb, inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.pink-btn {
  background: linear-gradient(145deg, var(--neon-pink), #d00045);
  color: white;
  box-shadow: 0 6px 0 #a60037, 0 10px 10px rgba(0, 0, 0, 0.3);
}
.pink-btn:active {
  box-shadow: 0 0 0 #a60037, inset 0 2px 5px rgba(0, 0, 0, 0.2);
}
.pink-btn:hover {
  background: #ff1a6b;
}

/* 4. Pill-Shaped Back Button */
.back-btn {
  margin-top: 15px;
  padding: 12px 40px;
  background: rgba(0, 0, 0, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50px;
  color: white;
  font-family: "Rubik", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  text-decoration: none;
  display: inline-block;
}
.back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}
.back-btn:active {
  transform: translateY(1px);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Round Icon Button (Pause) */
.icon-btn {
  background: transparent;
  border: transparent;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  color: white;
  font-family: "Roboto Mono", monospace;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  font-size: 1.2rem;
  letter-spacing: -2px; /* Tighten the || symbol */
  transition: transform 0.1s, background 0.1s;
  box-shadow: none !important;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.icon-btn:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.2);
}

/* =========================================
   SHARED UI: FORM ELEMENTS (Dropdowns)
   ========================================= */

select {
  width: 100%;
  padding: 12px 15px;
  margin-bottom: 10px;

  /* Glassmorphism Background */
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);

  /* Neon Borders */
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;

  /* Typography */
  color: white;
  font-family: "Rubik", sans-serif;
  font-size: 1rem;
  font-weight: 500;

  /* Remove default OS arrow */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;

  /* Custom Arrow Icon */
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 12px;
}

select:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background-color: rgba(0, 0, 0, 0.8);
}

select:focus {
  border-color: var(--neon-gold);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
}

/* THE DROPDOWN LIST (Fixes the ugly white box) */
option {
  background-color: #1a1a1a;
  color: white;
  padding: 10px;
  font-family: "Rubik", sans-serif;
}

/* ... (Existing code) ... */

/* =========================================
   SHARED UI: END SCREEN & RESULTS
   ========================================= */

#end-screen {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  z-index: 100;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.end-header {
  flex-shrink: 0;
  text-align: center;
  margin-bottom: 10px;
  width: 100%;
}

.end-stats-row {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.stat-badge {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 20px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}

.stat-label {
  font-size: 0.75rem;
  color: #aaa;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.stat-val {
  font-family: "Roboto Mono", monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--neon-gold);
}

/* Results List Container */
.results-container {
  display: flex;
  gap: 15px;
  width: 90%;
  max-width: 600px;
  height: 50vh; /* Scrollable area height */
  margin-bottom: 15px;
}

.result-col {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

/* Single column variant for games like Matchmaker */
.results-container.single-col .result-col {
  border-color: var(--neon-blue);
}

.result-col h3 {
  margin: 0;
  padding: 12px;
  text-align: center;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
}

.word-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Scrollbar Webkit */
.word-list::-webkit-scrollbar {
  width: 6px;
}
.word-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.word-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font-size: 0.95rem;
}

.word-item .ch {
  font-family: "Noto Sans SC", sans-serif;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--neon-gold);
}
.word-item .detail {
  font-family: "Rubik", sans-serif;
  opacity: 0.8;
  font-size: 0.9rem;
  text-align: right;
}

.win-actions {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}

/* 
   THE PINYIN PAUSE BUTTON STYLE:
   - No scaling/growing (transform: none)
   - Flat shadow (0 4px 0)
   - Physical press effect (translateY)
*/
.pause-menu-grid button {
  transform: none !important;
  transition: none !important;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.5) !important;
  border: none;
  border-radius: 12px;
  font-family: "Rubik", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  padding: 15px;
  font-size: 1.2rem;
  color: white;
  cursor: pointer;
  width: 100%;
}

.pause-menu-grid button:hover {
  transform: none !important;
  filter: brightness(1.1);
}

.pause-menu-grid button:active {
  box-shadow: none !important;
  transform: translateY(4px) !important;
}

#pause-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
}

.pause-menu-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  min-width: 260px;
}

/* Pause Button Colors */
.btn-blue {
  background: var(--neon-blue) !important;
  color: #00444d !important;
}
/* 2. Secondary White/Grey Button */
.btn-secondary {
  background: linear-gradient(
    145deg,
    #ffffff,
    #e6e6e6
  ) !important; /* Added !important */
  color: var(--felt-dark) !important;
  box-shadow: 0 4px 0 #999 !important; /* Added flat shadow */
}

.btn-secondary:active {
  box-shadow: none !important;
  background: #e6e6e6 !important;
  transform: translateY(4px) !important;
}

/* =========================================
   SHARED UI: TOP BAR (HUD)
   ========================================= */

#ui-bar {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none; /* Click through empty space */
  z-index: 20;
}

#ui-bar > * {
  pointer-events: auto; /* Re-enable clicks on buttons */
}

/* 3-Column Layout for Perfect Centering */
.ui-group {
  flex: 1;
  display: flex;
  align-items: center;
}
.ui-group.left {
  justify-content: flex-start;
}
.ui-group.center {
  justify-content: center;
}
.ui-group.right {
  justify-content: flex-end;
}

/* HUD Text Styling */
.stat-text {
  font-family: "Roboto Mono", monospace;
  font-size: 1.2rem;
  color: var(--neon-gold);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  white-space: nowrap; /* Prevents wrapping on mobile */
}

/* Mobile Responsive Adjustments */
@media (max-width: 600px) {
  #ui-bar {
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .stat-text {
    font-size: 0.9rem; /* Smaller font for phones */
  }

  /* Adjust icon button size slightly for small screens */
  .icon-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

/* Extra small screens (Fold/SE) */
@media (max-width: 360px) {
  .stat-text {
    font-size: 0.8rem;
  }
}
