@import url('https://fonts.googleapis.com/css2?family=Google+Sans+Flex:wght@400;500;600;700;800;900&display=swap');
@import url('https://fonts.cdnfonts.com/css/google-sans');

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --text-main: #111111;
  --text-muted: #666666;
  --accent-orange: #ff5500;
  --accent-lime: #b4ff00;
  --accent-lime-border: #92d600;
  --border-subtle: #eaeaea;
  --border-strong: #111111;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 8px 24px rgba(255, 85, 0, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-pill: 9999px;
  --font-sans: "Google Sans", "Google Sans Flex", "Product Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
}

/* Header */
.app-header {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  border-bottom: 1.5px solid var(--border-subtle);
  flex-shrink: 0;
  z-index: 20;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  gap: 16px;
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--accent-orange);
  box-shadow: 0 0 10px var(--accent-orange), 0 0 0 3px var(--accent-lime);
}

.logo-title {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--text-main);
  line-height: 1;
}

.by-author {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  background: var(--bg-secondary);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  margin-left: 2px;
  white-space: nowrap;
}

.brand-contact {
  padding-left: 22px;
  line-height: 1.2;
}

.contact-link {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
}

.contact-link:hover {
  color: var(--accent-orange);
  text-decoration: underline;
}

.accent-orange {
  color: var(--accent-orange);
}

.accent-lime {
  color: var(--accent-lime-border);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.meta-badges {
  display: flex;
  align-items: center;
  gap: 10px;
}

.harmony-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  letter-spacing: -0.01em;
}

.desktop-hint {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-main);
  padding: 9px 16px;
  font-size: 0.88rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  border-color: var(--text-main);
  background-color: var(--bg-secondary);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(1px);
}

.btn-primary {
  background-color: var(--text-main);
  color: #ffffff;
  padding: 9px 20px;
  font-size: 0.92rem;
  border-radius: var(--radius-pill);
  border: 2px solid var(--text-main);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn-primary:hover {
  background-color: var(--accent-orange);
  border-color: var(--accent-orange);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 85, 0, 0.3);
}

.btn-primary:active,
.btn-primary.btn-active {
  transform: translateY(2px) scale(0.97);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.icon-btn,
.icon-refresh {
  width: 16px;
  height: 16px;
  transition: transform 0.4s ease;
}

.btn-primary:hover .icon-refresh {
  transform: rotate(180deg);
}

/* Style & Count Toolbar */
.style-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 24px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-top: 1px solid #f2f2f2;
}

.style-toolbar::-webkit-scrollbar {
  display: none;
}

.style-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.style-label-group {
  display: flex;
  align-items: center;
}

.style-label {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-orange);
}

.style-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}

.style-pill {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 15px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-subtle);
  background-color: #ffffff;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.style-pill:hover {
  border-color: #cccccc;
  color: var(--text-main);
  background-color: var(--bg-secondary);
}

.style-pill.active {
  background-color: var(--text-main);
  color: #ffffff;
  border-color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  position: relative;
}

.style-pill.active::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-lime);
  margin-left: 8px;
  vertical-align: middle;
}

/* Count Section & Slider */
.count-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-subtle);
}

.count-label-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.count-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-orange);
}

.count-badge {
  background: var(--text-main);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  min-width: 26px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slider-limit {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

#color-count-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 6px;
  background: #e2e2e2;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

#color-count-slider:focus {
  background: #d0d0d0;
}

#color-count-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-orange);
  box-shadow: 0 0 0 2px var(--accent-lime), 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease;
}

#color-count-slider::-webkit-slider-thumb:hover {
  transform: scale(1.18);
}

#color-count-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-orange);
  border: 2px solid var(--accent-lime);
  cursor: pointer;
}

/* Palette Grid */
.palette-grid {
  display: flex;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Compact & Dense styles for large color counts */
.palette-grid.grid-compact .color-card {
  padding: 22px 8px;
}

.palette-grid.grid-compact .hex-btn {
  font-size: 1.05rem;
  padding: 9px 12px;
}

.palette-grid.grid-compact .btn-lock {
  width: 38px;
  height: 38px;
}

.palette-grid.grid-compact .role-badge {
  font-size: 0.65rem;
  padding: 4px 6px;
}

.palette-grid.grid-dense .color-card {
  padding: 16px 4px;
}

.palette-grid.grid-dense .hex-btn {
  font-size: 0.92rem;
  padding: 7px 8px;
  gap: 4px;
}

.palette-grid.grid-dense .hex-btn .copy-icon {
  width: 13px;
  height: 13px;
}

.palette-grid.grid-dense .btn-lock {
  width: 32px;
  height: 32px;
}

.palette-grid.grid-dense .btn-lock svg {
  width: 15px;
  height: 15px;
}

.palette-grid.grid-dense .role-badge {
  font-size: 0.58rem;
  padding: 3px 5px;
}

.palette-grid.grid-dense .copy-hint {
  display: none;
}

/* Color Card */
.color-card {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 30px 16px;
  transition: background-color 0.35s cubic-bezier(0.16, 1, 0.3, 1), flex 0.25s ease;
  min-width: 0;
}

/* Light / Dark text adaptations */
.color-card.is-dark {
  --card-fg: #ffffff;
  --card-fg-muted: rgba(255, 255, 255, 0.7);
  --card-badge-bg: rgba(0, 0, 0, 0.35);
  --card-btn-hover: rgba(255, 255, 255, 0.2);
  --card-pill-bg: rgba(255, 255, 255, 0.2);
}

.color-card.is-light {
  --card-fg: #111111;
  --card-fg-muted: rgba(0, 0, 0, 0.65);
  --card-badge-bg: rgba(255, 255, 255, 0.78);
  --card-btn-hover: rgba(0, 0, 0, 0.1);
  --card-pill-bg: rgba(0, 0, 0, 0.08);
}

/* Card Top: Lock & Role Badge */
.card-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}

.btn-lock {
  background: var(--card-badge-bg);
  color: var(--card-fg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

.btn-lock:hover {
  background: var(--card-btn-hover);
  transform: scale(1.08);
}

.btn-lock.locked {
  background-color: var(--accent-lime);
  color: #111111;
  border-color: #111111;
  box-shadow: 0 0 16px rgba(180, 255, 0, 0.6);
}

.btn-lock svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.2;
}

.role-badge {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--card-fg);
  background: var(--card-pill-bg);
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Card Center / Info */
.card-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.hex-btn {
  background: var(--card-badge-bg);
  color: var(--card-fg);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  padding: 11px 18px;
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 90%;
  justify-content: center;
}

.hex-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  border-color: var(--accent-orange);
}

.hex-btn:active {
  transform: translateY(0) scale(0.98);
}

.copy-icon {
  width: 16px;
  height: 16px;
  opacity: 0.75;
}

.hex-btn:hover .copy-icon {
  opacity: 1;
}

.copy-hint {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--card-fg-muted);
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.color-card:hover .copy-hint {
  opacity: 1;
}

/* Footer */
.app-footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-subtle);
  padding: 10px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.footer-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  flex-wrap: wrap;
  justify-content: center;
}

.dot-separator {
  color: var(--accent-orange);
}

.footer-contact-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 400;
  transition: color 0.2s ease;
}

.footer-contact-link:hover {
  color: var(--accent-orange);
  text-decoration: underline;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background-color: #111111;
  color: #ffffff;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  border: 2px solid var(--accent-lime);
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Mobile Responsive */
@media (max-width: 900px) {
  .header-top {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px 8px;
    gap: 12px;
  }

  .logo-area {
    justify-content: flex-start;
  }

  .header-actions {
    justify-content: space-between;
    width: 100%;
  }

  .style-toolbar {
    padding: 6px 16px 10px;
  }
}

@media (max-width: 768px) {
  .app-container {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
  }

  .desktop-hint {
    display: none;
  }

  .harmony-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
  }

  .btn-secondary,
  .btn-primary {
    padding: 8px 14px;
    font-size: 0.85rem;
  }

  .palette-grid {
    flex-direction: column;
    height: 100%;
    flex: 1;
    overflow-y: auto;
  }

  .color-card {
    flex: 1 0 auto;
    min-height: 68px;
    flex-direction: row;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .card-top {
    width: auto;
    order: 3;
    gap: 8px;
    padding: 0;
  }

  .role-badge {
    font-size: 0.65rem;
    padding: 4px 8px;
  }

  .btn-lock {
    width: 38px;
    height: 38px;
  }

  .card-bottom {
    width: auto;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    order: 1;
  }

  .hex-btn {
    font-size: 1.1rem;
    padding: 8px 14px;
  }

  .copy-hint {
    display: none;
  }

  .app-footer {
    display: flex;
    padding: 8px 14px;
    font-size: 0.72rem;
  }
}
