﻿body { padding: 0; margin: 0 }
html { background: #f4f6f8; }
body {
  padding: 0 0 56px;
  min-height: 100vh;
  background: #f4f6f8;
  color: #1f2937;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, sans-serif;
}
#unity-container { position: relative }
#unity-container.unity-desktop {
  width: max-content;
  max-width: 100vw;
  margin: 48px auto 0;
}
#unity-container.unity-mobile { position: fixed; inset: 0; margin: auto; width: 430px; max-width: 100vw; height: 92vh; max-height: 932px; border-radius: 20px; overflow: hidden; box-shadow: 0 16px 48px rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.15); background: #101010; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
@media (max-width: 768px) { #unity-container.unity-mobile { width: 100vw !important; height: 100vh !important; height: 100dvh !important; max-height: none !important; border-radius: 0 !important; border: none !important; inset: 0 !important; } }
#unity-canvas { background: #231F20 }
.unity-mobile #unity-canvas { width: 100% !important; height: 100% !important; display: block }
#unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -60%); display: none }
#unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }
#unity-progress-bar-empty { width: 141px; height: 18px; margin-top: 10px; margin-left: 6.5px; background: url('progress-bar-empty-dark.png') no-repeat center }
#unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
#unity-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 10px 0; position: relative }
.unity-mobile #unity-footer { position: fixed; bottom: 20px; right: 20px; z-index: 9999 }

.control-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px;
  padding: 0 16px; border-radius: 9px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; outline: none; user-select: none;
  -webkit-tap-highlight-color: transparent; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 2px 4px rgba(0,0,0,0.12); }
.control-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
.control-btn:active { transform: translateY(1px); box-shadow: 0 1px 2px rgba(0,0,0,0.15); }
.control-btn .btn-icon { display: block; flex-shrink: 0; transition: transform 0.2s ease; }
.control-btn:hover .btn-icon { transform: scale(1.1); }


#unity-fullscreen-button, .control-btn.fullscreen-btn { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #ffffff;
  border: none; box-shadow: 0 2px 8px rgba(37,99,235,0.35); }
#unity-fullscreen-button:hover, .control-btn.fullscreen-btn:hover { background: linear-gradient(135deg, #3b82f6, #2563eb); box-shadow: 0 4px 14px rgba(37,99,235,0.5); }
#unity-fullscreen-button:active, .control-btn.fullscreen-btn:active { transform: translateY(1px); }

#unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }

/* ---- Production patch notes under the game ---- */
.patch-notes {
  width: min(1080px, calc(100vw - 40px));
  margin: 26px auto 0;
  background: #ffffff;
  border: 1px solid #d8dee8;
  border-radius: 14px;
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}
.patch-notes-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px 15px;
  background: linear-gradient(135deg, #182238, #273653);
  color: #ffffff;
}
.patch-notes-kicker {
  color: #f6cf5c;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.4px;
}
.patch-notes h2 {
  margin: 2px 0 0;
  font-size: 22px;
  line-height: 1.2;
}
.patch-notes-meta {
  color: #cbd5e1;
  font-size: 12px;
  white-space: nowrap;
}
.patch-notes-body {
  padding: 18px 24px 20px;
  font-size: 14px;
  line-height: 1.65;
}
.patch-notes-body ul {
  margin: 0;
  padding-left: 21px;
}
.patch-notes-body li + li { margin-top: 8px; }
.patch-notes-body strong { color: #172554; }
.patch-notes-body code {
  padding: 2px 6px;
  border-radius: 5px;
  background: #eef2f7;
  color: #334155;
  font-size: 12px;
}
.patch-notes-note {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 3px solid #d4af37;
  background: #fffbeb;
  color: #6b5a18;
  font-size: 12px;
}
@media (max-width: 768px) {
  body { padding-bottom: 0; background: #101010; }
  .patch-notes { display: none; }
}

/* Install-app button (shown only when the browser offers beforeinstallprompt) */
.control-btn.install-btn { background: linear-gradient(135deg, #10b981, #059669); color: #ffffff; border: none; box-shadow: 0 2px 8px rgba(16,185,129,0.35); }
.control-btn.install-btn:hover { background: linear-gradient(135deg, #34d399, #10b981); box-shadow: 0 4px 14px rgba(16,185,129,0.5); }

/* Fullscreen is requested on the <html> ROOT (so body-level helpers like the mobile
   keyboard proxy input stay inside the fullscreen subtree = soft keyboard keeps working).
   The canvas must be told to fill it. Harmless when not fullscreen. */
html:fullscreen,
html:fullscreen body { width: 100vw; height: 100vh; height: 100dvh; margin: 0; overflow: hidden; }
html:fullscreen #unity-container {
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh;
  max-width: none; max-height: none; margin: 0; border-radius: 0; transform: none;
}
html:fullscreen #unity-container.unity-desktop {
  left: 0; top: 0; width: 100vw; height: 100vh; height: 100dvh; transform: none;
}
html:fullscreen #unity-canvas { width: 100vw !important; height: 100vh !important; height: 100dvh !important; display: block; }

/* ---- Install guide modal (optional PWA help, EN/TH) ---- */
.control-btn.guide-btn { background: #e9ecf0; color: #2b303b; border: 1px solid #d0d4da; }
.control-btn.guide-btn:hover { background: #dfe3e8; }
#install-guide { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
#install-guide .ig-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.72); }
#install-guide .ig-card { position: relative; width: min(440px, 94vw); max-height: 86vh; overflow-y: auto; -webkit-overflow-scrolling: touch; background: linear-gradient(160deg, #3d3d55, #2b2b3d); color: #f0e6d2; border: 2px solid #d4af37; border-radius: 14px; box-shadow: 0 18px 60px rgba(0,0,0,0.65); padding: 20px 22px 24px; font-family: Tahoma, "Segoe UI", sans-serif; }
#install-guide .ig-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
#install-guide .ig-title { font-size: 18px; font-weight: 700; color: #d4af37; }
#install-guide .ig-close { border: none; background: rgba(255,255,255,0.1); color: #f0e6d2; width: 32px; height: 32px; border-radius: 50%; font-size: 16px; cursor: pointer; touch-action: manipulation; }
#install-guide .ig-desc { font-size: 13px; line-height: 1.6; opacity: 0.9; margin: 6px 0 14px; }
#install-guide .ig-lang { display: flex; gap: 2px; background: rgba(255,255,255,0.08); border-radius: 999px; padding: 3px; font-size: 12px; font-weight: 700; }
#install-guide .ig-lang button { border: none; border-radius: 999px; padding: 5px 12px; cursor: pointer; background: transparent; color: #f0e6d2; font-weight: 700; touch-action: manipulation; }
#install-guide .ig-lang button.on { background: #d4af37; color: #231F20; }
#install-guide .ig-steps { margin: 0; padding-left: 0; list-style: none; counter-reset: step; }
#install-guide .ig-steps li { counter-increment: step; position: relative; padding: 10px 12px 10px 46px; margin: 8px 0; background: rgba(255,255,255,0.06); border-radius: 10px; font-size: 14px; line-height: 1.55; }
#install-guide .ig-steps li::before { content: counter(step); position: absolute; left: 12px; top: 10px; width: 24px; height: 24px; border-radius: 50%; background: #d4af37; color: #231F20; font-weight: 700; text-align: center; line-height: 24px; font-size: 13px; }
#install-guide .ig-steps li b { color: #8CD867; }
#install-guide .ig-actions { display: flex; gap: 8px; margin-top: 16px; }
#install-guide .ig-ok { flex: 1; padding: 12px; font-size: 15px; font-weight: 700; color: #231F20; background: #8CD867; border: none; border-radius: 10px; cursor: pointer; touch-action: manipulation; }
#install-guide .ig-never { padding: 12px 14px; font-size: 12px; background: transparent; color: #f0e6d2; border: 1px solid rgba(255,255,255,0.25); border-radius: 10px; cursor: pointer; opacity: 0.8; touch-action: manipulation; }
