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

:root {
  --font: 'Google Sans', Roboto, sans-serif;
  --radius-card: 20px;
  --radius-modal: 24px;
  --transition: .22s cubic-bezier(.4, 0, .2, 1);
  --glass-bg: rgba(255,255,255,.12);
  --glass-border: rgba(255,255,255,.22);
  --glass-shadow: 0 8px 32px rgba(0,0,0,.18);
  --text-light: rgba(255,255,255,.92);
  --text-muted: rgba(255,255,255,.6);
}

html, body {
  min-height: 100%;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  color: var(--text-light);
}

body {
  background: #0f1117;
  background-image:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(66,133,244,.35) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(52,168,83,.25) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 60% 30%, rgba(234,67,53,.18) 0%, transparent 50%),
    radial-gradient(ellipse 70% 50% at 10% 80%, rgba(251,188,5,.2) 0%, transparent 55%);
  background-attachment: fixed;
}

/* Noise texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: .5;
}

/* ===== HEADER ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(15,17,23,.6);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.topbar-logo svg { height: 22px; }

.topbar-title {
  font-size: 15px;
  font-weight: 500;
  color: rgba(255,255,255,.85);
  letter-spacing: .2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: .2px;
}

/* Sync button */
.sync-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 5px 12px 5px 8px;
  cursor: pointer;
  color: rgba(255,255,255,.55);
  font-family: var(--font);
  font-size: 12px;
  transition: background var(--transition), color var(--transition);
}
.sync-btn svg { width: 14px; height: 14px; }
/* DEV mode button */
.dev-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 5px 12px 5px 10px;
  cursor: pointer;
  color: rgba(255,255,255,.45);
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.dev-btn:hover {
  background: rgba(52,168,83,.15);
  color: rgba(52,168,83,.9);
  border-color: rgba(52,168,83,.3);
}
.dev-btn.active {
  background: rgba(52,168,83,.18);
  color: #34a853;
  border-color: rgba(52,168,83,.5);
  box-shadow: 0 0 10px rgba(52,168,83,.25);
}
.dev-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  flex-shrink: 0;
  transition: background .3s;
}
.dev-btn.active .dev-dot {
  background: #34a853;
  box-shadow: 0 0 6px rgba(52,168,83,.8);
  animation: pulse 1.6s infinite;
}

/* DEV mode active — page indicator */
body.dev-mode-on .topbar {
  border-bottom-color: rgba(52,168,83,.25);
}
body.dev-mode-on .topbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(52,168,83,.5), transparent);
}

/* Card DEV badge */
.card-dev-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-family: 'Space Mono', monospace;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .06em;
  color: #34a853;
  background: rgba(52,168,83,.15);
  border: 1px solid rgba(52,168,83,.3);
  border-radius: 4px;
  padding: 1px 4px;
  line-height: 1.4;
  opacity: 0;
  transition: opacity var(--transition);
}
body.dev-mode-on .card-wrapper .card-dev-badge,
.card-wrapper:hover .card-dev-badge {
  opacity: 1;
}

/* Modal check group */
.form-group-check {
  margin-top: 4px;
  margin-bottom: 0;
}
.check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.check-label input[type="checkbox"] {
  display: none;
}
.check-box {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.06);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
}
.check-box::after {
  content: '✓';
  font-size: 11px;
  color: #34a853;
  opacity: 0;
  transition: opacity .15s;
}
.check-label input:checked ~ .check-box {
  background: rgba(52,168,83,.2);
  border-color: rgba(52,168,83,.6);
}
.check-label input:checked ~ .check-box::after { opacity: 1; }
.check-text {
  font-size: 13.5px;
  color: rgba(255,255,255,.7);
  display: flex;
  align-items: center;
  gap: 7px;
}
.check-badge {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: #34a853;
  background: rgba(52,168,83,.15);
  border: 1px solid rgba(52,168,83,.3);
  border-radius: 4px;
  padding: 1px 5px;
}

.sync-btn:hover { background: rgba(255,255,255,.13); color: rgba(255,255,255,.85); }

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background .4s;
}
.sync-dot[data-status="off"]        { background: rgba(255,255,255,.2); }
.sync-dot[data-status="connecting"] { background: #fbbc05; animation: pulse 1s infinite; }
.sync-dot[data-status="ok"]         { background: #34a853; }
.sync-dot[data-status="error"]      { background: #ea4335; }

@keyframes pulse {
  0%, 100% { opacity: 1; } 50% { opacity: .4; }
}

/* Sync modal extras */
.sync-description {
  font-size: 13.5px;
  color: rgba(255,255,255,.5);
  line-height: 1.6;
  margin-top: -8px;
}
.sync-status-msg {
  font-size: 13px;
  color: rgba(255,255,255,.45);
  min-height: 20px;
  margin-top: 8px;
}

/* ===== HERO ===== */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 52px 24px 36px;
}

.hero-greeting {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 500;
  letter-spacing: -.5px;
  background: linear-gradient(135deg, #fff 30%, rgba(255,255,255,.65));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.hero-date {
  font-size: 15px;
  color: var(--text-muted);
  letter-spacing: .3px;
}

/* ===== SEARCH BAR ===== */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 580px;
  margin: 28px auto 0;
}

.search-icon {
  position: absolute;
  left: 18px;
  display: flex;
  align-items: center;
  color: rgba(255,255,255,.4);
  pointer-events: none;
  z-index: 1;
}

.search-icon svg {
  width: 18px;
  height: 18px;
}

.search-input {
  width: 100%;
  padding: 14px 90px 14px 50px;
  border-radius: 50px;
  border: 1.5px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.08);
  backdrop-filter: blur(16px);
  color: rgba(255,255,255,.92);
  font-family: var(--font);
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.search-input::placeholder { color: rgba(255,255,255,.35); }

.search-input:focus {
  border-color: rgba(66,133,244,.7);
  background: rgba(255,255,255,.12);
  box-shadow: 0 0 0 4px rgba(66,133,244,.15), 0 8px 32px rgba(0,0,0,.2);
}

.search-kbd {
  position: absolute;
  right: 16px;
  font-family: var(--font);
  font-size: 11px;
  color: rgba(255,255,255,.3);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  padding: 3px 7px;
  pointer-events: none;
  transition: opacity var(--transition);
  white-space: nowrap;
}

/* ===== CONTENT LAYOUT ===== */
.content-layout {
  position: relative;
  z-index: 1;
  max-width: 1360px;
  margin: 0 auto;
  padding: 8px 28px 80px;
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

/* ===== MAIN & GRID ===== */
main {
  flex: 1;
  min-width: 0;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-left: 2px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 14px;
}

/* ===== CARD ===== */
.card-wrapper {
  position: relative;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 22px 14px 18px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  text-decoration: none;
  color: var(--text-light);
  min-height: 126px;
  cursor: pointer;
  user-select: none;
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    background var(--transition),
    border-color var(--transition);
  position: relative;
  overflow: hidden;
}

/* Shine sweep on hover */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.08) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
  border-radius: inherit;
  pointer-events: none;
}

.card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 20px 48px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.12);
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.3);
}

.card:hover::after { opacity: 1; }

.card:active {
  transform: translateY(-2px) scale(1.005);
}

/* Colored glow per card — applied via JS data-color */
.card-wrapper[data-color="blue"]   .card:hover { box-shadow: 0 20px 48px rgba(66,133,244,.35),  0 0 0 1px rgba(66,133,244,.25); }
.card-wrapper[data-color="red"]    .card:hover { box-shadow: 0 20px 48px rgba(234,67,53,.3),    0 0 0 1px rgba(234,67,53,.2); }
.card-wrapper[data-color="green"]  .card:hover { box-shadow: 0 20px 48px rgba(52,168,83,.3),    0 0 0 1px rgba(52,168,83,.2); }
.card-wrapper[data-color="yellow"] .card:hover { box-shadow: 0 20px 48px rgba(251,188,5,.3),    0 0 0 1px rgba(251,188,5,.2); }
.card-wrapper[data-color="purple"] .card:hover { box-shadow: 0 20px 48px rgba(164,105,230,.3),  0 0 0 1px rgba(164,105,230,.2); }
.card-wrapper[data-color="teal"]   .card:hover { box-shadow: 0 20px 48px rgba(0,172,193,.3),    0 0 0 1px rgba(0,172,193,.2); }

.card-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform var(--transition);
  flex-shrink: 0;
}

.card:hover .card-icon-wrap {
  transform: scale(1.08);
}

.card-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.card-emoji {
  font-size: 28px;
  line-height: 1;
}

.card-name {
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255,255,255,.85);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  letter-spacing: .1px;
}

/* ===== FAVORITES SECTION ===== */
.section-label-star {
  color: #fbbf24;
  margin-right: 4px;
  font-size: 12px;
}

.fav-grid {
  position: relative;
}

.fav-grid::before {
  content: '';
  position: absolute;
  inset: -12px -16px;
  border-radius: 20px;
  background: rgba(251,191,36,.04);
  border: 1px solid rgba(251,191,36,.12);
  pointer-events: none;
  z-index: 0;
}

/* Star button */
.fav-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(8px);
  color: rgba(255,255,255,.45);
  font-size: 13px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition), background var(--transition), transform var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  line-height: 1;
}

.card-wrapper:hover .fav-btn {
  opacity: 1;
}

.fav-btn:hover {
  color: #fbbf24;
  background: rgba(251,191,36,.2);
  border-color: rgba(251,191,36,.4);
  transform: scale(1.15);
}

.fav-btn.active {
  opacity: 1;
  color: #fbbf24;
  background: rgba(251,191,36,.15);
  border-color: rgba(251,191,36,.35);
  text-shadow: 0 0 8px rgba(251,191,36,.7);
}

/* Gold glow on fav cards */
.fav-grid .card:hover {
  box-shadow: 0 20px 48px rgba(251,191,36,.2), 0 0 0 1px rgba(251,191,36,.2);
}

/* ===== DRAG & DROP ===== */
.card-wrapper[draggable="true"] { cursor: grab; }
.card-wrapper[draggable="true"]:active { cursor: grabbing; }

.card-wrapper.dragging {
  opacity: .35;
  transform: scale(.95);
  transition: opacity .15s, transform .15s;
}

.card-wrapper.drag-over-before::before,
.card-wrapper.drag-over-after::after {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: rgba(66,133,244,.9);
  box-shadow: 0 0 10px rgba(66,133,244,.7);
  pointer-events: none;
  z-index: 20;
}

.card-wrapper.drag-over-before::before { left: -8px; }
.card-wrapper.drag-over-after::after  { right: -8px; }

/* Remove button */
.remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(8px);
  color: rgba(255,255,255,.8);
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition), transform var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  line-height: 1;
}

.card-wrapper:hover .remove-btn {
  opacity: 1;
}

.remove-btn:hover {
  background: rgba(234,67,53,.85);
  border-color: rgba(234,67,53,.6);
  transform: scale(1.1);
}

/* ===== ADD CARD ===== */
.add-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 126px;
  padding: 22px 14px 18px;
  background: rgba(255,255,255,.05);
  border: 2px dashed rgba(255,255,255,.2);
  border-radius: var(--radius-card);
  cursor: pointer;
  transition:
    border-color var(--transition),
    background var(--transition),
    transform var(--transition);
  color: rgba(255,255,255,.5);
  font-family: var(--font);
}

.add-card:hover {
  border-color: rgba(255,255,255,.5);
  background: rgba(255,255,255,.1);
  transform: translateY(-4px);
  color: rgba(255,255,255,.85);
}

.add-icon {
  font-size: 26px;
  font-weight: 300;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.add-card:hover .add-icon {
  background: rgba(255,255,255,.15);
}

.add-label {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .1px;
}

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fade-in .18s ease;
}

.modal-backdrop.hidden { display: none; }

.modal {
  background: rgba(25,28,38,.92);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-modal);
  padding: 30px 28px 24px;
  width: 100%;
  max-width: 430px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06);
  animation: slide-up .22s cubic-bezier(.4,0,.2,1);
  backdrop-filter: blur(20px);
}

.modal-title {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 22px;
  color: rgba(255,255,255,.95);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4285f4, #34a853);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

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

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,.45);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 7px;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid rgba(255,255,255,.12);
  border-radius: 10px;
  font-size: 14px;
  font-family: var(--font);
  color: rgba(255,255,255,.9);
  background: rgba(255,255,255,.06);
  transition: border-color var(--transition), background var(--transition);
  outline: none;
}

.form-group input[type="text"]::placeholder {
  color: rgba(255,255,255,.3);
}

.form-group input[type="text"]:focus {
  border-color: rgba(66,133,244,.7);
  background: rgba(255,255,255,.09);
  box-shadow: 0 0 0 3px rgba(66,133,244,.15);
}

/* Icon tabs */
.icon-tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 14px;
  background: rgba(255,255,255,.05);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid rgba(255,255,255,.07);
}

.icon-tab {
  flex: 1;
  padding: 7px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 12px;
  font-family: var(--font);
  font-weight: 500;
  color: rgba(255,255,255,.45);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.icon-tab.active {
  background: rgba(66,133,244,.25);
  color: #74b0ff;
  box-shadow: 0 0 0 1px rgba(66,133,244,.3);
}

.tab-content {
  display: none;
  animation: fade-in .12s ease;
}

.tab-content.active { display: block; }

.favicon-preview {
  width: 52px;
  height: 52px;
  margin: 4px 0 8px;
  border-radius: 12px;
  background: rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
}

.favicon-preview img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.emoji-fallback { font-size: 26px; }

.tab-hint {
  font-size: 12px;
  color: rgba(255,255,255,.35);
}

.emoji-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.emoji-input {
  width: 100px !important;
  font-size: 24px !important;
  text-align: center;
  padding: 8px !important;
}

.emoji-preview {
  font-size: 34px;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.07);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.1);
}

.icon-url-preview {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(255,255,255,.07);
  overflow: hidden;
  margin-top: 8px;
  border: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-url-preview img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

/* Modal actions */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.btn-primary {
  padding: 10px 24px;
  background: linear-gradient(135deg, #4285f4 0%, #1a5fb4 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: filter var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 16px rgba(66,133,244,.35);
}

.btn-primary:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(66,133,244,.5);
}

.btn-primary:active { transform: translateY(0); filter: brightness(.96); }

.btn-secondary {
  padding: 10px 20px;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.btn-secondary:hover {
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.9);
}

/* ===== EDIT BUTTON ===== */
.edit-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(8px);
  color: rgba(255,255,255,.5);
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition), transform var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  line-height: 1;
}

.card-wrapper:hover .edit-btn { opacity: 1; }

.edit-btn:hover {
  background: rgba(66,133,244,.7);
  border-color: rgba(66,133,244,.6);
  color: #fff;
  transform: scale(1.1);
}

/* ===== NOTES WIDGET ===== */
.notes-section {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  align-self: flex-start;
}

.notes-card {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  backdrop-filter: blur(14px);
  padding: 20px 22px 18px;
  transition: border-color var(--transition);
}

.notes-card:focus-within {
  border-color: rgba(255,255,255,.22);
  background: rgba(255,255,255,.1);
}

.notes-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.notes-icon { font-size: 16px; }

.notes-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: rgba(255,255,255,.4);
}

.notes-saved {
  margin-left: auto;
  font-size: 11px;
  color: rgba(52,168,83,.8);
  font-weight: 500;
  transition: opacity .3s;
}

.notes-textarea {
  width: 100%;
  min-height: 240px;
  background: transparent;
  border: none;
  outline: none;
  resize: vertical;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.65;
  color: rgba(255,255,255,.82);
  caret-color: rgba(66,133,244,.9);
}

.notes-textarea::placeholder { color: rgba(255,255,255,.25); }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,34,46,.95);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.9);
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  backdrop-filter: blur(12px);
  z-index: 2000;
  animation: slide-up .2s ease;
  white-space: nowrap;
}

.toast.hidden { display: none; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.25); }

/* ===== ANIMATIONS ===== */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(20px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.card-wrapper {
  animation: card-in .3s cubic-bezier(.4,0,.2,1) both;
}

/* Stagger delay for initial load */
.card-wrapper:nth-child(1)  { animation-delay: .02s; }
.card-wrapper:nth-child(2)  { animation-delay: .04s; }
.card-wrapper:nth-child(3)  { animation-delay: .06s; }
.card-wrapper:nth-child(4)  { animation-delay: .08s; }
.card-wrapper:nth-child(5)  { animation-delay: .10s; }
.card-wrapper:nth-child(6)  { animation-delay: .12s; }
.card-wrapper:nth-child(7)  { animation-delay: .14s; }
.card-wrapper:nth-child(8)  { animation-delay: .16s; }
.card-wrapper:nth-child(9)  { animation-delay: .18s; }
.card-wrapper:nth-child(10) { animation-delay: .20s; }
.card-wrapper:nth-child(11) { animation-delay: .22s; }
.card-wrapper:nth-child(12) { animation-delay: .24s; }

/* ===== FOOTER ===== */
.site-footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 52px 24px 48px;
  margin-top: 16px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.footer-logo {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 28px 40px 22px;
  opacity: .5;
  transition: opacity .35s ease, filter .35s ease;
}

.site-footer:hover .footer-logo {
  opacity: .9;
  filter: drop-shadow(0 0 24px rgba(62,207,110,.18));
}

/* Corner marks */
.fl-corners { position: absolute; inset: 0; pointer-events: none; }
.fl-c {
  position: absolute;
  width: 14px; height: 14px;
  border-color: rgba(62,207,110,.4);
  border-style: solid;
}
.fl-tl { top: 0; left: 0;  border-width: 1px 0 0 1px; }
.fl-tr { top: 0; right: 0; border-width: 1px 1px 0 0; }
.fl-bl { bottom: 0; left: 0;  border-width: 0 0 1px 1px; }
.fl-br { bottom: 0; right: 0; border-width: 0 1px 1px 0; }

/* Logotype row */
.fl-logotype {
  display: flex;
  align-items: baseline;
  gap: 12px;
  line-height: 1;
}

.fl-bracket {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: clamp(36px, 6vw, 58px);
  color: #3ecf6e;
  line-height: 1;
}

.fl-carlos {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(30px, 5vw, 48px);
  color: #f0f4f0;
  letter-spacing: -1px;
}

.fl-sep {
  font-family: 'Space Mono', monospace;
  font-size: clamp(20px, 3vw, 32px);
  color: #3ecf6e;
  opacity: .55;
  margin: 0 2px;
}

.fl-code {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(30px, 5vw, 48px);
  color: #3ecf6e;
  letter-spacing: -1px;
}

.fl-cursor {
  display: inline-block;
  width: 3px;
  height: clamp(26px, 4vw, 40px);
  background: #3ecf6e;
  border-radius: 1px;
  margin-left: -4px;
  animation: blink 1.1s step-start infinite;
}

@keyframes blink {
  0%, 100% { opacity: .9; }
  50%       { opacity: 0; }
}

/* Divider */
.fl-divider {
  width: 100%;
  height: 1px;
  background: rgba(62,207,110,.2);
  margin: 12px 0 10px;
}

/* Tagline */
.fl-tagline {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 3.5px;
  color: #4a6b52;
  text-align: center;
  margin: 0;
}

/* Accent dots */
.fl-dots {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.fl-dots span {
  width: 3.5px; height: 3.5px;
  border-radius: 50%;
  background: #3ecf6e;
  opacity: .25;
}

.fl-dots span.hi { opacity: .55; }

/* ===== NOTES COLLAPSE (mobile toggle) ===== */
.notes-toggle {
  display: none; /* hidden on desktop */
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font);
  text-align: left;
}


/* ===== RESPONSIVE ===== */

/* ── Dispositivos táctiles: mostrar botones siempre (no hay hover) ── */
@media (hover: none) {
  .remove-btn,
  .fav-btn,
  .edit-btn { opacity: 1; }

  .remove-btn { width: 22px; height: 22px; font-size: 10px; top: 6px; right: 6px; }
  .fav-btn    { width: 22px; height: 22px; font-size: 11px; top: 6px; left: 6px;  }
  .edit-btn   { width: 22px; height: 22px; font-size: 12px; bottom: 6px; right: 6px; }

  .card-wrapper[draggable="true"] { cursor: default; }
  .search-kbd { display: none; }
}

/* ── Tablet / móvil: columna (notas debajo) ── */
@media (max-width: 900px) {
  .content-layout {
    flex-direction: column;
    align-items: stretch; /* main ocupa el ancho completo */
  }
  .notes-section { width: 100%; position: static; }
}

/* ── iPhone y móviles ── */
@media (max-width: 640px) {
  /* Topbar */
  .topbar {
    padding: 0 16px;
    padding-top: env(safe-area-inset-top);
    height: calc(52px + env(safe-area-inset-top));
  }
  .topbar-title { display: none; }

  /* Hero */
  .hero { padding: 24px 16px 18px; }
  .hero-greeting { font-size: clamp(22px, 7vw, 30px); }
  .hero-date { font-size: 13px; }

  /* Search */
  .search-bar { margin-top: 18px; }
  .search-input { font-size: 16px; padding: 13px 16px 13px 46px; }
  .search-icon { left: 14px; }

  /* Layout */
  .content-layout {
    padding: 12px 12px calc(24px + env(safe-area-inset-bottom));
    gap: 12px;
  }

  /* Grid: siempre 3 columnas en móvil */
  .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  /* Cards compactas */
  .card { padding: 16px 8px 12px; min-height: 100px; border-radius: 16px; gap: 9px; }
  .card-icon-wrap { width: 42px; height: 42px; border-radius: 11px; }
  .card-icon { width: 26px; height: 26px; }
  .card-emoji { font-size: 22px; }
  .card-name { font-size: 11px; }
  .add-card { min-height: 100px; border-radius: 16px; }
  .add-icon { width: 42px; height: 42px; font-size: 22px; border-radius: 11px; }
  .add-label { font-size: 11px; }

  /* Modal → bottom sheet */
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: 24px 24px 0 0;
    max-width: 100%;
    width: 100%;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
    animation: slide-up-sheet .25s cubic-bezier(.4,0,.2,1);
    max-height: 92dvh;
    overflow-y: auto;
  }

  /* ── Notas colapsables en móvil ── */
  .notes-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: var(--font);
  }

  /* Ocultar el header estático cuando el toggle está activo */
  .notes-card .notes-header { display: none; }

  .notes-toggle-icon { font-size: 15px; }
  .notes-toggle-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .9px;
    color: rgba(255,255,255,.45);
    flex: 1;
  }
  .notes-toggle-arrow {
    font-size: 12px;
    color: rgba(255,255,255,.35);
    transition: transform var(--transition);
  }
  .notes-section.open .notes-toggle-arrow { transform: rotate(180deg); }

  /* Body colapsado por defecto */
  .notes-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height .3s cubic-bezier(.4,0,.2,1);
  }
  .notes-section.open .notes-body {
    max-height: 300px;
  }

  .notes-card {
    padding: 14px 16px;
  }

  .notes-textarea { min-height: 120px; font-size: 15px; resize: none; }
}

/* ── iPhone SE / pantallas muy pequeñas ── */
@media (max-width: 360px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .card { padding: 14px 6px 10px; min-height: 92px; }
  .card-icon-wrap { width: 36px; height: 36px; }
  .card-icon { width: 20px; height: 20px; }
  .card-name { font-size: 10.5px; }
}

@keyframes slide-up-sheet {
  from { transform: translateY(100%); opacity: .6; }
  to   { transform: translateY(0);    opacity: 1;  }
}
