/* ==========================================================================
   FS ZEN GARDEN - GAME DESIGN SYSTEM & STYLESHEET
   Offline-First / Zero External CDN (Fonts loaded locally via fonts.css)
   ========================================================================== */

/* Theme Definitions */
:root {
  --font-heading: 'Outfit', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Prompt', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Default Theme: Japanese Zen */
  --bg-dark: #07140f;
  --bg-card: rgba(16, 32, 25, 0.75);
  --bg-card-border: rgba(0, 229, 163, 0.25);
  --text-main: #e8f5e9;
  --text-muted: #81c784;

  --primary-glow: #00e5a3;
  --secondary-glow: #2ec4b6;
  --accent-glow: #ffb700;

  --shadow-color: rgba(0, 229, 163, 0.18);
  --blob-1: rgba(0, 229, 163, 0.15);
  --blob-2: rgba(46, 196, 182, 0.15);
  --blob-3: rgba(255, 183, 0, 0.10);
}

/* Theme 2: Deep Forest */
[data-theme="forest"] {
  --bg-dark: #091b1a;
  --bg-card: rgba(14, 38, 36, 0.75);
  --bg-card-border: rgba(46, 196, 182, 0.25);
  --text-main: #e0f2f1;
  --text-muted: #80cbd2;

  --primary-glow: #2ec4b6;
  --secondary-glow: #70e000;
  --accent-glow: #e9c46a;

  --shadow-color: rgba(46, 196, 182, 0.18);
  --blob-1: rgba(46, 196, 182, 0.15);
  --blob-2: rgba(112, 224, 0, 0.15);
  --blob-3: rgba(233, 196, 106, 0.10);
}

/* Theme 3: Sandy Beach */
[data-theme="beach"] {
  --bg-dark: #0c192c;
  --bg-card: rgba(18, 38, 62, 0.75);
  --bg-card-border: rgba(0, 180, 216, 0.25);
  --text-main: #e0f4fe;
  --text-muted: #7dd3fc;

  --primary-glow: #00b4d8;
  --secondary-glow: #0077b6;
  --accent-glow: #f4a261;

  --shadow-color: rgba(0, 180, 216, 0.18);
  --blob-1: rgba(0, 180, 216, 0.15);
  --blob-2: rgba(0, 119, 182, 0.15);
  --blob-3: rgba(244, 162, 97, 0.10);
}

/* Theme 4: Moonlight Garden */
[data-theme="night"] {
  --bg-dark: #100d23;
  --bg-card: rgba(28, 22, 54, 0.75);
  --bg-card-border: rgba(167, 139, 250, 0.25);
  --text-main: #f3e8ff;
  --text-muted: #c084fc;

  --primary-glow: #a78bfa;
  --secondary-glow: #818cf8;
  --accent-glow: #f472b6;

  --shadow-color: rgba(167, 139, 250, 0.18);
  --blob-1: rgba(167, 139, 250, 0.15);
  --blob-2: rgba(129, 140, 248, 0.15);
  --blob-3: rgba(244, 114, 182, 0.10);
}

/* Global Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  transition: background-color 0.5s ease, color 0.5s ease;
  position: relative;
}

/* Animated Background Ambient Blobs */
.background-ambient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.8;
  animation: floatBlob 20s infinite alternate ease-in-out;
  transition: background 0.5s ease;
}

.blob-1 {
  width: 450px;
  height: 450px;
  background: var(--blob-1);
  top: -10%;
  left: -10%;
}

.blob-2 {
  width: 500px;
  height: 500px;
  background: var(--blob-2);
  bottom: -15%;
  right: -10%;
  animation-delay: -7s;
}

.blob-3 {
  width: 350px;
  height: 350px;
  background: var(--blob-3);
  top: 40%;
  left: 30%;
  animation-delay: -14s;
}

@keyframes floatBlob {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -50px) scale(1.1); }
  100% { transform: translate(-30px, 30px) scale(0.95); }
}

/* App Container Layout */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 820px;
  min-height: 90vh;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-sizing: border-box;
}

/* Header Area */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0.75rem 1.25rem;
  border-radius: 16px;
  box-shadow: 0 4px 24px var(--shadow-color);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.back-btn {
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
}

.logo-icon {
  color: var(--primary-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.title-group h1 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.1;
  background: linear-gradient(135deg, #ffffff 30%, var(--primary-glow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.title-group .subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Stats Badges */
.game-stats {
  display: flex;
  gap: 0.75rem;
}

.stat-badge {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--bg-card-border);
  padding: 0.35rem 0.75rem;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 65px;
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.8px;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-glow);
}

/* Controls / Toolbar */
.game-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0.75rem 1.25rem;
  border-radius: 16px;
  box-shadow: 0 4px 24px var(--shadow-color);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.glass-select {
  height: 38px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-main);
  border: 1px solid var(--bg-card-border);
  padding: 0 0.75rem;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.glass-select:hover {
  border-color: var(--primary-glow);
}

.glass-select option {
  background: var(--bg-dark);
  color: var(--text-main);
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Glass & Icon Buttons - Height Standardized to 38px */
.glass-btn {
  height: 38px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  padding: 0 0.85rem;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--primary-glow);
  color: var(--primary-glow);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-color);
}

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

.btn-finish-glow {
  background: rgba(0, 229, 163, 0.15);
  border-color: rgba(0, 229, 163, 0.4);
  color: var(--primary-glow);
}

.btn-finish-glow:hover {
  background: var(--primary-glow);
  color: #070913;
  box-shadow: 0 0 16px var(--primary-glow);
}

.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-btn.active {
  color: var(--primary-glow);
  border-color: var(--primary-glow);
  background: rgba(0, 229, 163, 0.15);
}

.donate-btn {
  border-radius: 30px;
  color: #00e5a3;
  border-color: rgba(0, 229, 163, 0.4);
}

.donate-btn:hover {
  background: rgba(0, 229, 163, 0.2);
  border-color: #00e5a3;
  color: #ffffff;
}

/* Item Palette Ribbon */
.item-palette-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 820px;
  overflow-x: auto;
  padding: 0.35rem 0.25rem;
  scrollbar-width: thin;
}

.item-chip {
  height: 38px;
  padding: 0 0.8rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-sizing: border-box;
}

.item-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--primary-glow);
  transform: translateY(-2px);
}

.item-chip.active {
  background: rgba(0, 229, 163, 0.15);
  border-color: var(--primary-glow);
  color: var(--primary-glow);
  box-shadow: 0 0 12px var(--shadow-color);
}

.chip-icon {
  font-size: 1.1rem;
}

/* Game Stage & Canvas Wrapper */
.game-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  width: 100%;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 820px;
  height: 480px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 8px 32px var(--shadow-color);
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

/* Hint Banner */
.hint-banner {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--bg-card-border);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* Footer */
.game-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-bottom: 0.5rem;
}

/* Glass Modal Dialogs */
.glass-modal {
  border: none;
  background: transparent;
  padding: 0;
  margin: auto;
  max-width: 440px;
  width: 90%;
  outline: none;
}

.glass-modal::backdrop {
  background: rgba(5, 8, 15, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 24px;
  padding: 1.5rem;
  color: var(--text-main);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.text-center {
  text-align: center;
  align-items: center;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--primary-glow);
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 0.4rem;
}

.close-btn:hover {
  color: var(--text-main);
}

.win-icon {
  color: var(--primary-glow);
  margin-bottom: 0.25rem;
}

.win-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: var(--primary-glow);
}

.win-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.win-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.5rem;
}

.win-stat-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--bg-card-border);
  border-radius: 12px;
  padding: 0.6rem 0.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.win-stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.win-stat-val {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-glow);
}

.btn-primary {
  height: 42px;
  background: var(--primary-glow);
  color: #070913;
  border: none;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  box-shadow: 0 0 16px var(--primary-glow);
  transform: translateY(-2px);
}

/* Help Body */
.help-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.help-step {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.step-num {
  width: 24px;
  height: 24px;
  background: var(--primary-glow);
  color: #070913;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.step-desc strong {
  font-size: 0.85rem;
  color: var(--text-main);
}

.step-desc p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Share & Donate Modals */
#share-qr-container, #donate-qr-container {
  display: flex;
  justify-content: center;
  padding: 0.75rem 0;
}

.qr-code-wrapper svg, .qr-code-wrapper canvas {
  border-radius: 12px;
  border: 2px solid var(--primary-glow);
  background: #ffffff;
  padding: 8px;
}

.share-input-group {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.share-url-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--bg-card-border);
  color: var(--text-main);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  outline: none;
}

.btn-copy {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-main);
  padding: 0 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-copy:hover {
  background: var(--primary-glow);
  color: #070913;
}

.channel-tabs {
  display: flex;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.25rem;
  border-radius: 12px;
}

.channel-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

.channel-btn.active {
  background: var(--bg-card);
  color: var(--primary-glow);
  border: 1px solid var(--bg-card-border);
}

.tab-icon-img {
  width: 16px;
  height: 16px;
}

.donate-timeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 0.5rem 0;
}

.timeline-step {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.promptpay-badge {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #00e5a3;
  letter-spacing: 1px;
}

.amount-chips {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin: 0.5rem 0;
}

.chip-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.chip-btn.active {
  background: #00e5a3;
  color: #070913;
  border-color: #00e5a3;
  font-weight: 700;
}

.amount-display-badge {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.amount-display-badge span {
  color: var(--primary-glow);
  font-weight: 700;
}

.binance-qr-wrapper {
  background: #ffffff;
  padding: 10px;
  border-radius: 16px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin: 0.5rem 0 0.4rem;
  box-shadow: 0 0 25px rgba(240, 185, 11, 0.35);
  border: 1px solid rgba(240, 185, 11, 0.4);
  max-width: 100%;
}

.binance-qr-img {
  width: 180px;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  object-fit: contain;
}

.hidden {
  display: none !important;
}

/* Responsive adjustments for Mobile & Tablet */
@media (max-width: 650px) {
  .app-container {
    padding: 0.6rem;
    gap: 0.65rem;
  }
  .game-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    padding: 0.65rem 0.85rem;
  }
  .brand {
    justify-content: space-between;
    width: 100%;
  }
  .title-group h1 { font-size: 1.05rem; }
  .title-group .subtitle { font-size: 0.7rem; }
  .game-stats { width: 100%; gap: 0.4rem; }
  .stat-badge { flex: 1; min-width: 0; padding: 0.3rem 0.25rem; }
  .stat-value { font-size: 0.95rem; }
  .game-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
  }
  .control-group { width: 100%; justify-content: space-between; }
  .glass-select { flex: 1; min-width: 0; height: 38px; font-size: 0.8rem; }
  .action-buttons { width: 100%; justify-content: space-between; gap: 0.35rem; }
  .glass-btn { height: 38px; padding: 0 0.6rem; font-size: 0.8rem; }
  .icon-btn { width: 38px; height: 38px; flex-shrink: 0; }
  .item-palette-bar {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.25rem 0;
  }
  .item-chip { height: 38px; padding: 0 0.65rem; font-size: 0.8rem; }
  .canvas-wrapper { height: 380px; max-height: 55vh; border-radius: 18px; }
  .glass-modal { width: 94%; max-height: 90vh; }
  .modal-content { padding: 1.15rem; gap: 0.75rem; }
}

@media (min-width: 651px) and (max-width: 900px) {
  .app-container { max-width: 760px; padding: 1rem; }
  .canvas-wrapper { height: 420px; }
}
