:root {
  --bg-color: #0f172a;
  --panel-bg: rgba(30, 41, 59, 0.7);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --board-bg: #e2b36f;
  --board-line: #8b5a2b;
  --black-stone: #111;
  --white-stone: #eee;
  --danger: #ef4444;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  overflow: hidden;
  touch-action: none; /* Prevent zooming/scrolling on mobile */
}

#app {
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* For mobile safari */
  position: relative;
}

/* Views */
.view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.view.active {
  opacity: 1;
  pointer-events: auto;
}

/* Glassmorphism Panels */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Menu View */
#menu-view {
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.menu-panel {
  width: 100%;
  max-width: 400px;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

h1 {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setting-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.toggle-group {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  padding: 4px;
}

.toggle-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 12px 0;
  color: var(--text-main);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-transform: none !important;
  font-size: 1.1rem !important;
  color: var(--text-main) !important;
}

.checkbox-label input {
  display: none;
}

.custom-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid var(--text-muted);
  position: relative;
  transition: all 0.2s ease;
}

.checkbox-label input:checked + .custom-checkbox {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-label input:checked + .custom-checkbox::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 7px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.hint-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -5px;
  padding-left: 36px;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: white;
  border: none;
  padding: 16px;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
  margin-top: 10px;
}

.primary-btn:active {
  transform: scale(0.98);
}

/* Game View */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 10px 20px;
  height: 80px;
}

.icon-btn {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.status-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 8px 20px;
  border-radius: 20px;
}

.turn-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.stone-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: inset -2px -2px 4px rgba(0,0,0,0.5), 2px 2px 4px rgba(0,0,0,0.3);
}

.turn-indicator.black .stone-icon {
  background: radial-gradient(circle at 30% 30%, #666, #000);
}

.turn-indicator.white .stone-icon {
  background: radial-gradient(circle at 30% 30%, #fff, #ccc);
}

/* Board */
.board-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
}

#board-canvas {
  background: var(--board-bg);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Modal */
.modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  padding: 40px 30px;
  text-align: center;
  width: 100%;
  max-width: 340px;
  transform: scale(1);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.hidden .modal-content {
  transform: scale(0.9);
}

.modal-content h2 {
  font-size: 2rem;
  margin-bottom: 30px;
}

.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border: 1px solid var(--panel-border);
  padding: 16px;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
