/* ==========================================================================
   WePlay Spyfall - Mobile-First Gaming Theme
   Matching WePlay Game Screen UI
   ========================================================================== */

:root {
  --bg-primary: #123e8e;
  --bg-gradient: linear-gradient(180deg, #1b52b5 0%, #133f8f 45%, #0b255c 100%);
  --weplay-cyan: #30b0f7;
  --weplay-cyan-dark: #1b89d3;
  --weplay-cyan-light: #70cbf9;
  --weplay-yellow: #ffd000;
  --weplay-yellow-dark: #e6a800;
  --weplay-orange: #ff7a18;
  --weplay-green: #2ecc71;
  --weplay-red: #ff4757;
  
  --card-bg: #ffffff;
  --card-shadow: 0 12px 30px rgba(7, 24, 66, 0.45);
  
  --text-dark: #1a2744;
  --text-muted: #64748b;
  --text-light: #f8fafc;
  
  --pill-bg: #f0f7ff;
  --pill-border: #9bd2f9;
  
  --font-family: 'Prompt', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Bootstrap Icons Baseline */
i.bi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  vertical-align: -0.1em;
}

body {
  font-family: var(--font-family);
  background-color: #0b255c;
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-light);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  overflow-x: hidden;
}

/* App Container (Mobile First Wrapper) */
.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: var(--bg-gradient);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
  padding-bottom: 75px; /* space for bottom bar */
}

/* Background Game Ornaments */
.bg-decorations {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.bg-gear {
  position: absolute;
  opacity: 0.08;
  filter: invert(1);
}

.bg-gear-1 {
  width: 260px;
  top: -40px;
  right: -50px;
  transform: rotate(20deg);
}

.bg-gear-2 {
  width: 180px;
  top: 320px;
  left: -50px;
}

/* Header Section */
.app-header {
  position: relative;
  z-index: 10;
  padding: 12px 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.header-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.header-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.3);
}

/* Room Pill Style (Screenshot Inspired) */
.room-badge-pill {
  flex: 1;
  background: linear-gradient(180deg, #3aa2e6 0%, #1e80ce 100%);
  border: 2px solid #63bbf4;
  border-radius: var(--radius-md);
  padding: 6px 12px;
  text-align: center;
  color: white;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.4), 0 4px 10px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.room-badge-pill .room-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.room-badge-pill .room-subtitle {
  font-size: 11px;
  opacity: 0.9;
  font-weight: 400;
}

/* Main Content Area */
.app-main {
  position: relative;
  z-index: 5;
  flex: 1;
  padding: 10px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* View Sections */
.tab-view {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.25s ease-out;
}

.tab-view.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Spy Character Header on Card */
.spy-mascot-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: -32px;
  position: relative;
  z-index: 10;
}

.spy-mascot-container {
  position: relative;
  width: 90px;
  height: 90px;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
  animation: floatMascot 4s ease-in-out infinite;
}

@keyframes floatMascot {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Game White Card (Screenshot Exact Styling) */
.game-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 42px 20px 24px;
  box-shadow: var(--card-shadow);
  color: var(--text-dark);
  text-align: center;
  position: relative;
  border: 3px solid rgba(255, 255, 255, 0.95);
}

.game-card-title {
  font-size: 19px;
  font-weight: 700;
  color: #3b4b66;
  margin-bottom: 14px;
  letter-spacing: -0.2px;
}

/* Word Input Pill Box */
.word-input-container {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  margin-bottom: 16px;
}

.word-input-inner {
  position: relative;
  flex: 1;
}

.word-input-pill {
  width: 100%;
  background: var(--pill-bg);
  border: 2px solid var(--pill-border);
  border-radius: var(--radius-full);
  padding: 12px 42px 12px 16px;
  font-size: 19px;
  font-weight: 700;
  color: #0c366e;
  text-align: center;
  font-family: var(--font-family);
  outline: none;
  transition: all 0.25s ease;
  box-shadow: inset 0 2px 4px rgba(0, 48, 120, 0.08);
}

.btn-scan-screenshot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  border: 2px solid #bae6fd;
  border-radius: var(--radius-full);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.35);
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-scan-screenshot:hover {
  background: linear-gradient(135deg, #0369a1, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(2, 132, 199, 0.45);
}

.btn-scan-screenshot:active {
  transform: translateY(0);
}

.btn-scan-icon {
  font-size: 14px;
}

.btn-scan-text {
  font-size: 12px;
  letter-spacing: 0.2px;
}

.word-input-pill:focus {
  border-color: #2196f3;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.word-input-pill::placeholder {
  color: #94a3b8;
  font-size: 16px;
  font-weight: 500;
}

.input-clear-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: #cbd5e1;
  border: none;
  color: #475569;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
}

.input-clear-btn.visible {
  display: flex;
}

/* Quick Suggestion Chips */
.quick-tags-wrapper {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 14px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  justify-content: center;
  flex-wrap: wrap;
}

.quick-tags-wrapper::-webkit-scrollbar {
  display: none;
}

.chip-tag {
  background: #eef5ff;
  color: #1e6ec7;
  border: 1px solid #c7e0fc;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.chip-tag:hover, .chip-tag:active {
  background: #1e6ec7;
  color: white;
  border-color: #1e6ec7;
  transform: scale(0.96);
}

/* Primary Game Action Button (3D tactile feel) */
.btn-game-primary {
  width: 100%;
  background: linear-gradient(180deg, #38befa 0%, #1582d8 100%);
  color: white;
  border: none;
  border-bottom: 4px solid #0d5ca0;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-family);
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow: 0 6px 16px rgba(18, 120, 206, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.1s ease;
}

.btn-game-primary:hover {
  filter: brightness(1.05);
}

.btn-game-primary:active {
  transform: translateY(3px);
  border-bottom-width: 1px;
  box-shadow: 0 2px 6px rgba(18, 120, 206, 0.3);
}

/* Quick Action Save Pair Button */
.btn-save-trigger {
  background: linear-gradient(180deg, #ffc800 0%, #f39c12 100%);
  border-bottom: 4px solid #b76e05;
  color: #3e2600;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
  box-shadow: 0 6px 16px rgba(243, 156, 18, 0.35);
}

.btn-save-trigger:hover {
  filter: brightness(1.06);
}

.btn-save-trigger:active {
  transform: translateY(3px);
  border-bottom-width: 1px;
}

/* Result Section Container */
.search-results-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.result-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  color: var(--text-dark);
  box-shadow: 0 8px 24px rgba(5, 21, 61, 0.35);
  position: relative;
  overflow: hidden;
  border-left: 6px solid #2ecc71;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-card.multiple {
  border-left-color: #3498db;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.result-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: #e6f9ed;
  color: #1a9e52;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.result-category {
  font-size: 12px;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.result-pair-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px dashed #cbd5e1;
  margin-bottom: 8px;
}

.result-word-item {
  flex: 1;
  text-align: center;
}

.result-word-label {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 2px;
  font-weight: 500;
}

.result-word-value {
  font-size: 18px;
  font-weight: 700;
  color: #0f274a;
  word-break: break-word;
}

.result-word-value.highlight-counterpart {
  color: #0d82d4;
  background: #e5f4fd;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid #bae3fb;
}

.result-vs-icon {
  width: 28px;
  height: 28px;
  background: #ff7a18;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 2px 6px rgba(255, 122, 24, 0.35);
  flex-shrink: 0;
}

.result-hint {
  font-size: 12px;
  color: #475569;
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  padding: 6px 10px;
  border-radius: 4px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Not Found Card */
.not-found-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-md);
  padding: 22px 18px;
  text-align: center;
  color: var(--text-dark);
  box-shadow: var(--card-shadow);
  animation: slideUp 0.3s ease-out;
}

.not-found-icon {
  font-size: 38px;
  margin-bottom: 8px;
}

.not-found-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}

.not-found-desc {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 14px;
}

/* Room Notification Feed (Screenshot Inspired) */
.room-feed {
  background: rgba(8, 28, 72, 0.65);
  border: 1px solid rgba(80, 150, 240, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  backdrop-filter: blur(8px);
  font-size: 12.5px;
  color: #cfe2fe;
}

.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.4;
}

.feed-item-icon {
  font-size: 13px;
  flex-shrink: 0;
}

.feed-item-speaker {
  font-weight: 700;
  color: #ffd000;
}

.feed-item-judge {
  color: #70d2ff;
  font-weight: 700;
}

/* Bottom WePlay Banner & Branding */
.bottom-branding-banner {
  margin-top: auto;
  padding: 10px 14px;
  background: rgba(3, 16, 44, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-md);
}

.brand-spyfall {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spyfall-title-badge {
  display: flex;
  flex-direction: column;
}

.spyfall-title-badge .sub {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #cbd5e1;
  font-weight: 700;
}

.spyfall-title-badge .main {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: white;
}

.spyfall-title-badge .main span {
  color: #ff9f1c;
}

.brand-weplay {
  display: flex;
  align-items: center;
  gap: 8px;
}

.weplay-logo-img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  object-fit: cover;
}

.weplay-brand-text {
  font-size: 19px;
  font-weight: 900;
  color: white;
  letter-spacing: -0.5px;
}

/* Mobile Bottom Navigation Bar (5-item layout) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #081d45;
  border-top: 1px solid rgba(80, 160, 255, 0.25);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px 8px;
  z-index: 100;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.4);
}

.nav-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: #8da4ce;
  font-family: var(--font-family);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 1px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  position: relative;
}

.nav-item span:last-child {
  white-space: nowrap;
  letter-spacing: -0.3px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.nav-item.active {
  color: #ffd000;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: -6px;
  width: 20px;
  height: 3px;
  background: #ffd000;
  border-radius: 2px;
  box-shadow: 0 0 8px #ffd000;
}

.nav-item-icon {
  font-size: 18px;
  line-height: 1;
}

.nav-item:active {
  transform: scale(0.92);
}

/* Center Highlighted Nav Action (Save Button) */
.nav-item-highlight {
  flex: 0 0 46px;
  background: linear-gradient(135deg, #ffc800 0%, #ff8c00 100%);
  color: #3b2200;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  margin-top: -18px;
  box-shadow: 0 4px 12px rgba(255, 140, 0, 0.5), inset 0 2px 2px rgba(255, 255, 255, 0.6);
  border: 3px solid #081d45;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  padding: 0;
  cursor: pointer;
  z-index: 105;
}

.nav-item-highlight:active {
  transform: scale(0.92);
}

/* Guide View (ทริคสายลับ) */
.guide-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 10px;
}

.guide-hero-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  text-align: center;
  box-shadow: var(--card-shadow);
  color: var(--text-dark);
}

.guide-section-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 16px 16px;
  box-shadow: var(--card-shadow);
  color: var(--text-dark);
}

.guide-card-header {
  font-size: 15px;
  font-weight: 800;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px dashed #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guide-card-header.civilian {
  color: #0284c7;
}

.guide-card-header.spy {
  color: #dc2626;
}

.guide-card-header.master {
  color: #6d28d9;
}

.guide-card-header.categories {
  color: #d97706;
}

.guide-trick-box {
  background: #f8fafc;
  border-left: 3.5px solid #7c3aed;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  text-align: left;
}

.guide-trick-title {
  font-weight: 700;
  font-size: 13px;
  color: #5b21b6;
  margin-bottom: 4px;
}

.guide-trick-desc {
  font-size: 12px;
  color: #334155;
  line-height: 1.45;
}

.guide-trick-example {
  background: rgba(124, 58, 237, 0.08);
  border: 1px dashed rgba(124, 58, 237, 0.35);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 6px;
  font-size: 12px;
  color: #4c1d95;
  line-height: 1.5;
}

.guide-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #334155;
  text-align: left;
}

.guide-list li {
  position: relative;
  padding-left: 18px;
}

.guide-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: #0284c7;
  font-weight: bold;
}

.guide-section-card:nth-child(3) .guide-list li::before {
  color: #dc2626;
}

.category-grid-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.cat-pill {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
}

/* Database View (คลังคำ) */
.db-header-card {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.db-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.db-count-badge {
  background: #ffd000;
  color: #3a2200;
  font-weight: 800;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

/* Category Filters Scrollable Bar */
.category-filters-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 1px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.category-filters-scroll::-webkit-scrollbar {
  display: none;
}

.cat-filter-btn {
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
}

.cat-filter-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.cat-filter-btn:active {
  transform: scale(0.94);
}

.cat-filter-btn.active {
  background: linear-gradient(135deg, #ffd000 0%, #ff9f1c 100%);
  color: #382000;
  border-color: #ffd000;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(255, 208, 0, 0.4);
}

.db-search-box {
  position: relative;
}

.db-search-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(120, 180, 255, 0.4);
  border-radius: var(--radius-md);
  padding: 10px 36px 10px 14px;
  font-size: 14px;
  color: white;
  font-family: var(--font-family);
  outline: none;
}

.db-search-input:focus {
  border-color: #38befa;
  background: rgba(0, 0, 0, 0.45);
}

.db-search-input::placeholder {
  color: #8fa7cf;
}

.db-actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-sm-action {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-family);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.btn-sm-action:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Word Pairs List */
.word-pairs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  padding-right: 2px;
}

.word-pair-item {
  background: #ffffff;
  color: var(--text-dark);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease;
}

.word-pair-item:active {
  transform: scale(0.99);
}

.pair-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pair-names {
  font-size: 16px;
  font-weight: 700;
  color: #102a54;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pair-separator {
  color: #94a3b8;
  font-weight: 400;
  font-size: 12px;
}

.pair-meta {
  font-size: 11px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pair-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon-action {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s ease;
}

.btn-icon-action:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-icon-action.delete:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Practice View (สุ่มซ้อมเล่น) */
.practice-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.practice-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  color: var(--text-dark);
  text-align: center;
  box-shadow: var(--card-shadow);
}

.practice-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 14px;
}

.practice-secret-box {
  background: #f8fafc;
  border: 2px dashed #94a3b8;
  border-radius: var(--radius-md);
  padding: 24px 12px;
  margin-bottom: 16px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.practice-secret-box.revealed {
  background: #f0fdf4;
  border-color: #22c55e;
  border-style: solid;
}

.practice-word-reveal {
  font-size: 26px;
  font-weight: 800;
  color: #0c366e;
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 10, 28, 0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  color: var(--text-dark);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  background: linear-gradient(135deg, #184ea0 0%, #0d3674 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.form-input {
  width: 100%;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 15px;
  font-family: var(--font-family);
  color: #0f172a;
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus {
  border-color: #0284c7;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.modal-footer {
  padding: 12px 20px 20px;
  display: flex;
  gap: 10px;
}

.btn-secondary {
  flex: 1;
  background: #e2e8f0;
  border: none;
  color: #475569;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 380px;
}

.toast-msg {
  background: #1e293b;
  color: white;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 5px solid #38befa;
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-msg.success {
  border-left-color: #22c55e;
}

.toast-msg.error {
  border-left-color: #ef4444;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar Tweaks */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
}

/* =========================================================
   AI Suggestion UI Styles
   ========================================================= */
.not-found-actions-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 14px;
}

.btn-ai-suggest {
  width: 100%;
  padding: 13px 18px;
  background: linear-gradient(135deg, #7c3aed 0%, #ec4899 50%, #f59e0b 100%);
  background-size: 200% 200%;
  animation: aiGradientShift 4s ease infinite;
  color: white;
  border: none;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 18px rgba(236, 72, 153, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.15s ease, filter 0.2s ease;
}

.btn-ai-suggest:active {
  transform: scale(0.97);
}

.btn-ai-suggest:disabled {
  opacity: 0.8;
  cursor: wait;
}

@keyframes aiGradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.btn-manual-add-trigger {
  width: 100%;
  padding: 12px 18px;
  background: #f0f7ff;
  border: 1.5px solid #0284c7;
  color: #0284c7;
  border-radius: 99px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.15);
  transition: all 0.2s ease;
}

.btn-manual-add-trigger:hover {
  background: #0284c7;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}

.btn-manual-add-trigger:active {
  transform: scale(0.98);
}

.ai-suggestions-container {
  width: 100%;
  margin-top: 18px;
  text-align: left;
}

.ai-results-wrapper {
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid #a855f7;
  border-radius: 18px;
  padding: 16px 14px;
  box-shadow: 0 12px 30px rgba(168, 85, 247, 0.25);
}

.ai-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(168, 85, 247, 0.25);
}

.ai-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-chip {
  background: linear-gradient(135deg, #a855f7, #ec4899);
  color: white;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 99px;
  letter-spacing: 0.5px;
}

.ai-chip.gemini {
  background: linear-gradient(135deg, #0284c7, #22c55e);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.4);
}

.ai-key-status {
  font-size: 11px;
  color: #64748b;
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.2s;
  display: inline-block;
  margin-top: 4px;
}

.ai-key-status:hover {
  color: #0284c7;
}

.ai-key-status.active {
  color: #10b981;
  font-weight: 700;
  text-decoration: none;
}

.ai-setup-hint {
  font-size: 11px;
  color: #fbbf24;
  cursor: pointer;
  text-decoration: underline;
  display: block;
  margin-top: 6px;
  text-align: center;
}

.ai-header-title {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
}

.ai-header-tip {
  font-size: 11px;
  color: #c084fc;
}

.ai-candidates-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-candidate-card {
  background: white;
  border-radius: 14px;
  padding: 12px 14px;
  color: #1e293b;
  position: relative;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  border: 1.5px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.ai-candidate-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.ai-candidate-card.rank-1 {
  border-color: #fbbf24;
  background: linear-gradient(to bottom, #fffbeb, #ffffff);
}

.ai-candidate-card.rank-2 {
  border-color: #94a3b8;
}

.ai-candidate-card.rank-3 {
  border-color: #f97316;
}

.ai-candidate-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.ai-rank-badge {
  background: #0f172a;
  color: #ffd000;
  font-size: 12px;
  font-weight: 900;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-candidate-card.rank-1 .ai-rank-badge {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: white;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4);
}

.ai-counterpart-name {
  font-size: 17px;
  font-weight: 800;
  color: #0c366e;
  flex-grow: 1;
}

.ai-match-tag {
  font-size: 10px;
  background: #f1f5f9;
  color: #475569;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 700;
}

.ai-reason-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: #334155;
  line-height: 1.45;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.ai-reason-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.ai-candidate-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-ai-save-direct {
  background: #10b981;
  color: white;
  border: none;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 99px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  transition: all 0.15s ease;
}

.btn-ai-save-direct:hover {
  background: #059669;
  transform: translateY(-1px);
}

.btn-ai-save-direct:active {
  transform: scale(0.95);
}

.spinner-small {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Game Assistant HUD & AI Vision Scanner Styling
   ========================================================================== */

.game-assistant-area {
  margin-top: 14px;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}

.game-assistant-card {
  background: linear-gradient(145deg, #0f172a, #1e293b);
  border: 2px solid #38bdf8;
  border-radius: var(--radius-lg);
  padding: 16px;
  color: #f8fafc;
  box-shadow: 0 10px 25px rgba(2, 132, 199, 0.25), 0 0 15px rgba(56, 189, 248, 0.15);
  position: relative;
  overflow: hidden;
}

.game-assistant-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #f43f5e);
}

.assistant-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.assistant-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.assistant-main-title {
  font-size: 15px;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: -0.2px;
}

.assistant-engine-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.btn-assistant-dismiss {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s;
}

.btn-assistant-dismiss:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.1);
}

/* My Player Number Banner */
.my-player-banner {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(16, 185, 129, 0.1));
  border: 1.5px solid #22c55e;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.15);
}

.my-player-header-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.my-player-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.my-player-icon-badge {
  font-size: 16px;
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px #22c55e); }
  50% { transform: scale(1.15); filter: drop-shadow(0 0 8px #4ade80); }
}

.my-player-text {
  font-size: 13px;
  color: #e2e8f0;
}

.my-player-num {
  font-size: 16px;
  font-weight: 900;
  color: #4ade80;
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}

.my-player-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
}

.my-player-status.status-alive {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.my-player-status.status-dead {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Seat Picker Bar */
.seat-picker-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(34, 197, 94, 0.3);
  flex-wrap: wrap;
}

.seat-picker-label {
  font-size: 11px;
  color: #cbd5e1;
  font-weight: 500;
}

.seat-picker-buttons {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.btn-seat-num {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-seat-num:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.btn-seat-num.active {
  background: #16a34a;
  border-color: #86efac;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

/* Vote Alert Banner */
.vote-alert-banner {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(185, 28, 28, 0.15));
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #fecaca;
  margin-bottom: 10px;
  line-height: 1.4;
}

.vote-alert-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* Scanned My Word Banner */
.scanned-word-banner {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(59, 130, 246, 0.15));
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.scanned-word-label {
  font-size: 12px;
  color: #cbd5e1;
}

.scanned-word-val {
  font-size: 19px;
  font-weight: 900;
  color: #38bdf8;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
  letter-spacing: 0.5px;
}

.scanned-word-room {
  font-size: 11px;
  color: #94a3b8;
}

/* Game HUD Grid */
.game-hud-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.hud-card {
  background: rgba(15, 23, 42, 0.8);
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s;
}

.hud-card.stat-alive {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.08);
}

.hud-card.stat-villager-dead {
  border-color: rgba(249, 115, 22, 0.3);
  background: rgba(249, 115, 22, 0.08);
}

.hud-card.stat-spy-dead {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
}

.hud-card.stat-spy-left {
  border-color: rgba(168, 85, 247, 0.3);
  background: rgba(168, 85, 247, 0.08);
}

.hud-icon {
  font-size: 16px;
  margin-bottom: 2px;
}

.hud-value {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.1;
  color: #ffffff;
}

.hud-label {
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  margin-top: 2px;
}

/* Role Selector Tabs */
.role-selector-section {
  margin-bottom: 12px;
}

.role-selector-title {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.role-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-role-toggle {
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  padding: 9px 8px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  font-family: var(--font-family);
}

.btn-role-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.btn-role-toggle.active.role-villager {
  background: linear-gradient(135deg, #16a34a, #15803d);
  border-color: #86efac;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4);
}

.btn-role-toggle.active.role-spy {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  border-color: #fca5a5;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

/* Strategy Advice Box */
.strategy-advice-box {
  background: rgba(30, 41, 59, 0.7);
  border-radius: 10px;
  padding: 12px;
  border-left: 4px solid #38bdf8;
  font-size: 13px;
  line-height: 1.55;
  color: #e2e8f0;
}

.strategy-advice-box.role-villager {
  border-left-color: #22c55e;
  background: rgba(34, 197, 94, 0.08);
}

.strategy-advice-box.role-spy {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.strategy-header {
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
}

.strategy-header.villager { color: #86efac; }
.strategy-header.spy { color: #fca5a5; }

.strategy-body {
  font-size: 12px;
  color: #f1f5f9;
}

/* Scanning / Loading Card */
.scan-loading-card {
  background: linear-gradient(145deg, #0f172a, #1e293b);
  border: 2px dashed #38bdf8;
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  text-align: center;
  color: #f8fafc;
}

.scan-radar {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border: 3px solid rgba(56, 189, 248, 0.2);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
}

.scan-loading-title {
  font-size: 15px;
  font-weight: 800;
  color: #38bdf8;
  margin-bottom: 4px;
}

.scan-loading-subtitle {
  font-size: 12px;
  color: #94a3b8;
}

@media (max-width: 420px) {
  .btn-scan-text {
    display: none;
  }
  .btn-scan-screenshot {
    padding: 10px 12px;
  }
  .game-hud-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}


