@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700&family=Playfair+Display:ital,wght@0,600;1,600&display=swap");

:root {
  --bg0: #120810;
  --bg1: #1a0d16;
  --panel: rgba(36, 16, 28, 0.82);
  --stroke: rgba(255, 140, 180, 0.22);
  --text: #ffe8f1;
  --muted: #c9a0b3;
  --pink: #ff5c9a;
  --pink2: #ff8fb8;
  --danger: #ff5c6c;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html {
  height: 100%;
  overflow-x: hidden;
}
body {
  margin: 0;
  font-family: "Outfit", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(255, 70, 140, 0.22), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(180, 40, 100, 0.18), transparent 50%),
    linear-gradient(160deg, var(--bg0), var(--bg1) 55%, #0d0710);
  min-height: 100%;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 4rem;
}

#hearts-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}

.topbar, .layout, .login-wrap { position: relative; z-index: 1; }

.brand {
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  color: var(--pink2);
  letter-spacing: 0.02em;
}

.tag, .sub, .hint, .who { color: var(--muted); }
.hint { font-size: 0.92rem; }
.hint.tiny { font-size: 0.8rem; margin-top: 0.4rem; }
.error { color: #ff8a9a; margin-top: 0.75rem; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--stroke);
  backdrop-filter: blur(10px);
  background: rgba(12, 6, 10, 0.45);
}
.brand-row { display: flex; gap: 0.75rem; align-items: baseline; }
.brand-row .brand { font-size: 1.45rem; }
.top-actions { display: flex; gap: 0.75rem; align-items: center; }

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1rem 1.2rem 4rem;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

.sidebar, .panel, .login-card, .welcome {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.sidebar { padding: 1rem; height: fit-content; position: sticky; top: 1rem; }
.side-head, .panel-head, .profile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.side-head h2, .panel h3 { margin: 0; font-size: 1rem; }

.profile-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.profile-list li button {
  width: 100%;
  text-align: left;
  margin-bottom: 0.4rem;
}
.profile-list li button.active {
  background: rgba(255, 92, 154, 0.25);
  border-color: var(--pink);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  min-width: 0;
  overflow: visible;
}
.profile-view {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  min-width: 0;
}
.profile-head {
  margin-bottom: 0.15rem;
}
.welcome, .panel {
  padding: 1.25rem 1.35rem;
  overflow: visible;
}
.welcome h1, .profile-head h1 {
  font-family: "Playfair Display", Georgia, serif;
  margin: 0 0 0.4rem;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.hearts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}
.heart-card {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
  position: relative;
}
.heart-card img, .heart-card .ph {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 0.55rem;
  display: block;
  border: 3px solid var(--c, var(--pink));
  box-shadow: 0 0 0 3px rgba(0,0,0,0.25);
}
.heart-card .ph {
  display: grid;
  place-items: center;
  background: rgba(255, 92, 154, 0.15);
  font-size: 1.6rem;
}
.heart-card .name { font-weight: 600; }
.heart-card .pct {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--c, var(--pink2));
  margin-top: 0.25rem;
}
.heart-card .card-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 0.2rem;
}
.heart-card .card-actions .edit,
.heart-card .card-actions .del {
  padding: 0.2rem 0.45rem;
  font-size: 0.8rem;
  line-height: 1;
}
.heart-card .card-actions .edit {
  color: var(--pink2);
  border-color: rgba(255, 140, 180, 0.35);
}

.chart-wrap {
  position: relative;
  height: min(380px, 55vh);
  margin-top: 0.75rem;
  margin-bottom: 0.35rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  cursor: crosshair;
}
.chart-hint { margin: 0.55rem 0 0; }

.score-step { display: flex; flex-direction: column; gap: 0.55rem; }
.score-step-label { font-size: 0.88rem; color: var(--muted); }
.heart-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.55rem;
}
.heart-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 0.4rem;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  cursor: pointer;
  text-align: center;
}
.heart-pick img,
.heart-pick .ph {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--c, var(--pink));
}
.heart-pick .ph {
  display: grid;
  place-items: center;
  background: rgba(255, 92, 154, 0.15);
  font-size: 1rem;
}
.heart-pick .pick-name {
  font-size: 0.82rem;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.heart-pick.active {
  border-color: var(--pink);
  background: rgba(255, 92, 154, 0.2);
  box-shadow: 0 0 0 2px rgba(255, 92, 154, 0.2);
}
.score-fields {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.35rem;
}
.score-edit-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.score-edit-head img,
.score-edit-head .ph {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--c, var(--pink));
  flex-shrink: 0;
}
.score-edit-head .ph {
  display: grid;
  place-items: center;
  background: rgba(255, 92, 154, 0.15);
  font-size: 1.1rem;
}
.heart-card { cursor: pointer; }
.heart-card:hover { border-color: var(--pink2); }

.filters { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip {
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--muted);
}
.chip.active {
  background: rgba(255, 92, 154, 0.25);
  border-color: var(--pink);
  color: var(--text);
}

.score-form { display: flex; flex-direction: column; gap: 0.85rem; margin-top: 0.75rem; }
.score-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.65rem;
}
.score-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  background: rgba(0,0,0,0.18);
  min-width: 0;
  overflow: hidden;
}
.score-row > span:not(.ph) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.score-row img, .score-row .ph {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.score-row .ph {
  display: grid; place-items: center; background: rgba(255,92,154,0.2); font-size: 0.8rem;
}
.score-row input[type="number"] {
  width: 72px;
  min-width: 72px;
  margin-left: auto;
  flex: 0 0 72px;
  text-align: right;
  padding: 0.4rem 0.5rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--muted);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
textarea,
select {
  width: 100%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  color: var(--text);
  padding: 0.7rem 0.85rem;
  font: inherit;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder,
textarea::placeholder {
  color: rgba(201, 160, 179, 0.55);
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255, 92, 154, 0.18);
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px #1a0d16 inset;
  transition: background-color 9999s ease-in-out 0s;
  caret-color: var(--text);
}

input[type="number"] {
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="date"] {
  color-scheme: dark;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
  opacity: 1;
  width: 1.1rem;
  height: 1.1rem;
}

input[type="color"] {
  width: 100%;
  height: 44px;
  padding: 0.3rem;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.45);
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}

/* File picker — look custom, keep native input usable */
.file-field {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.file-field:focus-within {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255, 92, 154, 0.18);
}
.file-field input[type="file"] {
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  box-shadow: none;
}
.file-field input[type="file"]:focus {
  box-shadow: none;
}
.file-field input[type="file"]::file-selector-button,
.file-field input[type="file"]::-webkit-file-upload-button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  margin-right: 0.75rem;
  padding: 0.7rem 0.95rem;
  border: none;
  border-right: 1px solid var(--stroke);
  background: linear-gradient(135deg, rgba(255, 77, 141, 0.35), rgba(255, 126, 179, 0.22));
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.file-field input[type="file"]::file-selector-button:hover,
.file-field input[type="file"]::-webkit-file-upload-button:hover {
  background: linear-gradient(135deg, rgba(255, 77, 141, 0.5), rgba(255, 126, 179, 0.35));
}

/* fallback if used without .file-field */
input[type="file"] {
  padding: 0.35rem 0.4rem;
  cursor: pointer;
}
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  appearance: none;
  -webkit-appearance: none;
  margin-right: 0.75rem;
  padding: 0.55rem 0.85rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff4d8d, #ff7eb3);
  color: #2a0816;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button, .chip {
  cursor: pointer;
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 0.55rem 0.9rem;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
button:hover, .chip:hover { transform: translateY(-1px); border-color: var(--pink2); }
button.pink {
  background: linear-gradient(135deg, #ff4d8d, #ff7eb3);
  border-color: transparent;
  color: #2a0816;
  font-weight: 700;
}
button.ghost { background: transparent; }
button.danger { color: #ffb0b8; border-color: rgba(255,92,108,0.4); }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login-card {
  width: min(420px, 100%);
  padding: 2rem 1.6rem;
  text-align: center;
  animation: floatIn 0.6s ease;
}
.login-card .brand { font-size: 2rem; display: block; margin-bottom: 0.25rem; }
.login-card h1 {
  font-family: "Playfair Display", Georgia, serif;
  margin: 0 0 0.4rem;
  font-size: 1.55rem;
}
.login-card form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  text-align: left;
  margin-top: 1.4rem;
}
.login-card button[type="submit"] { margin-top: 0.4rem; width: 100%; }

dialog {
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: #1c0f18;
  color: var(--text);
  padding: 0;
  box-shadow: var(--shadow);
  width: min(420px, calc(100vw - 2rem));
}
dialog::backdrop { background: rgba(8, 2, 6, 0.72); backdrop-filter: blur(4px); }
.dlg { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.85rem; }
.dlg h3 { margin: 0; font-family: "Playfair Display", Georgia, serif; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.4rem; }

@keyframes floatIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}
