/* =========================
   THEME TOKENS
   ========================= */
:root {
  --bg-gradient-start: #f0fdf4;
  --bg-gradient-end: #dcfce7;

  --card-bg: rgba(255, 255, 255, 0.9);
  --card-border: rgba(34, 197, 94, 0.2);
  --card-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);

  --text-main: #14532d;
  --text-sub: #166534;
  --text-muted: #86efac;

  --primary: #16a34a;
  --primary-hover: #15803d;
  --secondary: #4ade80;

  --accent-win: #3b82f6;
  --accent-lose: #ef4444;
  --accent-draw: #f59e0b;

  --font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  --radius: 24px;
  
  --nav-height: 60px;
}

[data-theme="dark"] {
  --bg-gradient-start: #052e16;
  --bg-gradient-end: #064e3b;
  --card-bg: rgba(20, 83, 45, 0.6);
  --card-border: rgba(74, 222, 128, 0.1);
  --text-main: #f0fdf4;
  --text-sub: #bbf7d0;
  --primary: #22c55e;
  --primary-hover: #4ade80;
}

/* =========================
   RESET & BASE
   ========================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-family);
  background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { text-decoration: none; color: inherit; }

/* =========================
   LAYOUT
   ========================= */
.navbar {
  width: 100%;
  height: var(--nav-height);
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-border);
  position: fixed;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
}

.nav-container {
  width: 100%;
  max-width: 800px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 800;
  font-size: 18px;
  color: var(--primary);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 20px;
}

.nav-links a {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sub);
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--primary); }

.main-layout {
  flex: 1;
  padding-top: calc(var(--nav-height) + 20px);
  padding-bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.container {
  width: 100%;
  max-width: 540px;
  padding: 0 20px;
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 32px 24px;
  text-align: center;
  transition: transform 0.2s ease;
}

/* =========================
   ADSENSE PLACEHOLDERS
   ========================= */
.ad-container {
  width: 100%;
  max-width: 728px;
  margin: 0 auto;
  padding: 0 20px;
  text-align: center;
}

.ad-placeholder {
  background: rgba(0,0,0,0.05);
  border: 1px dashed var(--text-sub);
  color: var(--text-sub);
  padding: 20px;
  border-radius: 12px;
  font-size: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 90px;
}

/* =========================
   GAME HEADER
   ========================= */
.header h1 {
  font-size: 26px;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.header p {
  color: var(--text-sub);
  font-size: 15px;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* =========================
   WEBCAM AREA
   ========================= */
.webcam-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1; 
  max-width: 360px;
  margin: 0 auto 24px;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid var(--card-border);
}

#webcam-container canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

.placeholder-text {
  color: var(--text-sub);
  font-weight: 500;
  opacity: 0.8;
  font-size: 14px;
  line-height: 1.6;
}
.placeholder-text .icon { font-size: 32px; display: block; margin-bottom: 8px; }

/* =========================
   GAME STATUS
   ========================= */
.status-area {
  min-height: 60px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.countdown {
  font-size: 48px;
  font-weight: 900;
  color: var(--primary);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-message {
  font-size: 24px;
  font-weight: 800;
  margin-top: 8px;
}
.result-message.win { color: var(--accent-win); }
.result-message.lose { color: var(--accent-lose); }
.result-message.draw { color: var(--accent-draw); }

.match-info {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-sub);
}

.vs-badge {
  background: var(--text-sub);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
}

/* =========================
   BUTTONS
   ========================= */
.btn-group {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn:hover {
  transform: translateY(-2px);
  background: var(--primary-hover);
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.4);
}

.btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* =========================
   SCORE BOARD
   ========================= */
.score-board {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px dashed var(--card-border);
  display: flex;
  justify-content: center;
  gap: 30px;
}

.score-item { text-align: center; }
.score-label {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 4px;
}
.score-val { font-size: 24px; font-weight: 900; }

.text-win { color: var(--accent-win); }
.text-lose { color: var(--accent-lose); }
.text-draw { color: var(--accent-draw); }

/* =========================
   CONTENT SECTIONS (INFO)
   ========================= */
.info-card {
  text-align: left;
}

.info-card h2 {
  font-size: 20px;
  color: var(--primary);
  margin-bottom: 20px;
  text-align: center;
}

.info-card h3 {
  font-size: 16px;
  margin-top: 20px;
  margin-bottom: 8px;
  color: var(--text-main);
}

.info-card p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 12px;
}

.info-card ul {
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
}

/* =========================
   CONTACT & COMMENT
   ========================= */
.contact-card h2, .comment-card h2 {
  font-size: 20px;
  color: var(--text-main);
  margin-bottom: 8px;
}

.contact-form {
  display: grid;
  gap: 16px;
  margin-top: 20px;
  text-align: left;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 700; color: var(--text-sub); }
.form-group input, .form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
}
.form-group textarea { min-height: 100px; resize: vertical; }

/* =========================
   FOOTER
   ========================= */
.footer {
  width: 100%;
  padding: 40px 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.4);
  margin-top: auto; /* Push to bottom */
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
  font-size: 13px;
  color: var(--text-sub);
}

.footer-links {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 16px 0;
  padding: 0;
}

.footer-links a { text-decoration: underline; opacity: 0.8; }
.footer-links a:hover { opacity: 1; }
.disclaimer { font-size: 11px; opacity: 0.6; }

/* =========================
   MOBILE OPTIMIZATIONS
   ========================= */
@media (max-width: 480px) {
  .card { padding: 24px 16px; }
  .header h1 { font-size: 22px; }
  .webcam-wrapper { max-width: 100%; }
  .nav-links { display: none; } /* Simplify nav on mobile */
}

@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}