 /* ============================================================
   RESET & BASE
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #4A90D9;
  --primary-dark: #357ABD;
  --secondary: #6c757d;
  --success: #28a745;
  --danger: #dc3545;
  --bg: #1a1a2e;
  --bg-card: #16213e;
  --bg-modal: #0f3460;
  --text: #e0e0e0;
  --text-muted: #888;
  --border: #2a2a4a;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --radius: 10px;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
}

/* ============================================================
   HEADER & NAV
   ============================================================ */

header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

/* ============================================================
   MAIN & FOOTER
   ============================================================ */

main {
  flex: 1;
  padding: 24px;
}

footer {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

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

.btn-primary   { background: var(--primary); color: white; }
.btn-secondary { background: var(--secondary); color: white; }
.btn-danger    { background: var(--danger); color: white; }
.btn-ghost     { background: transparent; color: var(--text-muted); }
.btn-full      { width: 100%; justify-content: center; }

/* ============================================================
   AUTH PAGE
   ============================================================ */

.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.auth-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.auth-box h1 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.auth-subtitle {
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ============================================================
   FORMS
   ============================================================ */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="color"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 1rem;
}

.form-group input[type="color"] {
  height: 44px;
  padding: 4px;
  cursor: pointer;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
}

.hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: normal;
}

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.alert-error   { background: rgba(220,53,69,0.15); border: 1px solid var(--danger); color: #ff6b6b; }
.alert-success { background: rgba(40,167,69,0.15); border: 1px solid var(--success); color: #6bff8e; }

/* ============================================================
   BOARD TOOLBAR
   ============================================================ */

.board-container {
  max-width: 1200px;
  margin: 0 auto;
}

.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.board-toolbar-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.board-name {
  font-size: 1.4rem;
}

/* ============================================================
   SOUND GRID
   ============================================================ */

.sound-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 768px) {
  .sound-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .sound-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================
   SOUND BUTTONS
   ============================================================ */

.sound-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sound-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

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

.sound-btn.playing {
  animation: pulse 0.5s ease infinite alternate;
}

.sound-btn.empty-btn {
  background: var(--bg-card);
  border: 2px dashed var(--border);
}

.sound-btn.edit-mode {
  border: 2px dashed rgba(255,255,255,0.4);
}

@keyframes pulse {
  from { filter: brightness(1); }
  to   { filter: brightness(1.3); }
}

.btn-label {
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  word-break: break-word;
}

.sound-indicator {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 0.75rem;
  opacity: 0.7;
}

.edit-icon {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 0.75rem;
}

/* ============================================================
   EDIT BANNER
   ============================================================ */

.edit-banner {
  margin-top: 16px;
  padding: 10px 16px;
  background: rgba(74,144,217,0.15);
  border: 1px solid var(--primary);
  border-radius: 6px;
  text-align: center;
  color: var(--primary);
  font-weight: 600;
}

/* ============================================================
   MODAL
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.modal-close:hover {
  background: var(--border);
  color: var(--text);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.sound-preview {
  margin-top: 10px;
}

.sound-preview audio {
  width: 100%;
}

/* ============================================================
   HOMEPAGE
   ============================================================ */

.hero {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

.hero-content {
  text-align: center;
  max-width: 900px;
  width: 100%;
}

.hero-content h1 {
  font-size: 3rem;
  margin-bottom: 12px;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 1.1rem;
}

.hero-actions {
  margin-bottom: 48px;
}

.tier-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  text-align: left;
}

@media (max-width: 640px) {
  .tier-grid {
    grid-template-columns: 1fr;
  }
}

.tier-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.tier-card.tier-featured {
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(74,144,217,0.2);
}

.tier-card h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.tier-price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
}

.tier-price span {
  font-size: 1rem;
  color: var(--text-muted);
}

.tier-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

/* ============================================================
   UPGRADE PAGE
   ============================================================ */

.upgrade-container {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.upgrade-container h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.upgrade-subtitle {
  color: var(--text-muted);
  margin-bottom: 40px;
}

.tier-badge {
  display: inline-block;
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.manage-subscription {
  margin-top: 32px;
}

/* ============================================================
   SUCCESS PAGE
   ============================================================ */

.success-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.success-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px;
  text-align: center;
  max-width: 480px;
  width: 100%;
}

.success-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.success-box h1 {
  font-size: 2rem;
  margin-bottom: 12px;
}

.success-box p {
  color: var(--text-muted);
  margin-bottom: 8px;
}

.success-subtitle {
  margin-bottom: 32px !important;
}

/* ============================================================
   CONTACT PAGE
   ============================================================ */

.contact-container {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

.contact-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow);
}

.contact-header {
  margin-bottom: 32px;
}

.contact-header h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.contact-subtitle {
  color: var(--text-muted);
}

.contact-form textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
}

.contact-form textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* ============================================================
   COMING SOON TIER CARD
   ============================================================ */

.tier-card.tier-coming-soon {
  border-color: var(--border);
  opacity: 0.9;
}

.tier-card.tier-coming-soon ul li {
  color: var(--text-muted);
}

/* ============================================================
   FOOTER
   ============================================================ */

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 1200px;
  margin: 0 auto;
}

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

.footer-credit a {
  color: var(--text-muted);
  text-decoration: underline;
}

.footer-credit a:hover {
  color: var(--text);
}

/* ============================================================
   UPDATED TIER GRID - 2 COLUMNS FOR HOMEPAGE
   ============================================================ */

.hero .tier-grid {
  grid-template-columns: repeat(2, 1fr);
  max-width: 700px;
  margin: 0 auto;
}

@media (max-width: 640px) {
  .hero .tier-grid {
    grid-template-columns: 1fr;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}