:root {
  --bg-1: #fef9ff;
  --bg-2: #e9f2ff;
  --bg-3: #fff5e6;
  --ink: #2b2150;
  --ink-soft: #6a6595;
  --primary: #6c63ff;
  --primary-dark: #4f46d6;
  --accent: #ffb648;
  --accent-2: #ff7eb6;
  --good: #2bb673;
  --bad: #e0526b;
  --card: #ffffffd9;
  --shadow: 0 8px 24px rgba(80, 70, 200, 0.12);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1200px 600px at 10% 10%, var(--bg-3), transparent 60%),
    radial-gradient(900px 500px at 90% 30%, var(--bg-2), transparent 60%),
    radial-gradient(800px 600px at 50% 110%, #f4e9ff, transparent 60%),
    var(--bg-1);
}

body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before, body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
  font-size: 64px;
  opacity: 0.2;
}
body::before { content: "⭐"; top: 8%; left: 5%; transform: rotate(-12deg); }
body::after  { content: "🪐"; bottom: 6%; right: 4%; transform: rotate(8deg); font-size: 96px; opacity: 0.18; }

.page { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 24px 18px 60px; }

.brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.brand .logo {
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 14px; background: linear-gradient(135deg, var(--primary), var(--accent-2));
  box-shadow: var(--shadow); color: white; font-size: 22px;
}
.brand h1 { margin: 0; font-size: 22px; }
.brand small { color: var(--ink-soft); }

.tabs {
  display: inline-flex; padding: 4px; background: var(--card); border-radius: 999px;
  box-shadow: var(--shadow); margin: 14px 0 22px;
}
.tabs button {
  border: 0; background: transparent; padding: 10px 18px; border-radius: 999px;
  font-size: 15px; color: var(--ink-soft); cursor: pointer;
}
.tabs button.active { background: var(--primary); color: white; }

.card {
  background: var(--card); backdrop-filter: blur(6px);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 12px; font-size: 18px; display: flex; align-items: center; gap: 8px; }

.entry-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 30px;
}
@media (max-width: 640px) { .entry-grid { grid-template-columns: 1fr; } }

.entry-card {
  position: relative; padding: 32px 24px; border-radius: var(--radius); cursor: pointer;
  background: linear-gradient(135deg, #fff, #f6f0ff);
  box-shadow: var(--shadow); border: 1px solid #ffffff;
  transition: transform .15s ease, box-shadow .15s ease;
  text-align: center;
}
.entry-card:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(80,70,200,.18); }
.entry-card .icon { font-size: 64px; }
.entry-card h3 { margin: 12px 0 4px; font-size: 22px; }
.entry-card p { margin: 0; color: var(--ink-soft); font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--primary); color: white; font-size: 15px; font-weight: 600;
  box-shadow: 0 4px 10px rgba(108,99,255,.3);
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: none; border: 1px solid #d6d2ec; }
.btn.danger { background: var(--bad); box-shadow: 0 4px 10px rgba(224,82,107,.3); }
.btn.danger:hover { background: #b8425a; }
.btn.warn { background: var(--accent); color: #5a3a00; box-shadow: 0 4px 10px rgba(255,182,72,.3); }
.btn.big { font-size: 16px; padding: 14px 22px; border-radius: 14px; }

input[type=text], input[type=password], select {
  font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid #d6d2ec;
  background: white; color: var(--ink); min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

.field-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.field-row > * { flex: 0 0 auto; }
.field-row.grow > input, .field-row.grow > select { flex: 1 1 220px; }

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

.tile {
  background: white; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; cursor: pointer;
  border: 2px solid transparent; transition: border-color .1s, transform .1s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--primary); }
.tile .thumb {
  background: #f4f0ff; aspect-ratio: 4/3; display: grid; place-items: center;
  color: var(--ink-soft); font-size: 14px; overflow: hidden;
}
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .meta { padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; }
.tile .meta .name { font-weight: 600; }
.tile .meta .avg { color: var(--accent); font-weight: 700; }
.tile .meta .avg.muted { color: var(--ink-soft); font-weight: 500; }

.empty { color: var(--ink-soft); text-align: center; padding: 18px; }

.stars { display: inline-flex; gap: 6px; }
.stars .star {
  font-size: 34px; line-height: 1; cursor: pointer; user-select: none;
  color: #d8d2ec;
  text-shadow: 0 0 0 #b2a8d8;
  -webkit-text-stroke: 1.5px #b2a8d8;
  transition: transform .08s, color .08s, -webkit-text-stroke-color .08s;
}
.stars.readonly .star { cursor: default; }
.stars .star.active {
  color: #ffb648;
  -webkit-text-stroke: 1.5px #d98f1f;
  text-shadow: 0 2px 6px rgba(255, 182, 72, 0.35);
}
.stars .star:hover { transform: scale(1.15); }

.score-rows-vertical { display: flex; flex-direction: column; gap: 14px; }
.score-rows-vertical .score-row { grid-template-columns: 1fr; gap: 4px; }

.dim-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-soft);
}
.dim-row .dim-icon { font-size: 16px; }
.dim-row .dim-val { font-weight: 700; color: var(--accent); margin-left: auto; }
.dim-row .dim-val.muted { color: var(--ink-soft); font-weight: 500; }

.overview-meta-vertical {
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.overview-meta-vertical .top {
  display: flex; justify-content: space-between; align-items: center;
}

.tile.clickable { cursor: zoom-in !important; }

.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.88);
  display: grid; place-items: center; z-index: 100; padding: 24px;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 100%; max-height: 100%;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
}
.lightbox .close-hint {
  position: absolute; top: 16px; right: 20px;
  color: white; font-size: 14px; background: rgba(0,0,0,.4);
  padding: 6px 12px; border-radius: 999px;
}

.counter {
  display: inline-flex; align-items: center; gap: 12px;
  background: white; border-radius: 14px; padding: 4px;
  box-shadow: var(--shadow);
}
.counter button {
  width: 44px; height: 44px; border-radius: 12px; border: 0;
  font-size: 24px; font-weight: 700; cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--accent-2));
  color: white;
}
.counter button:disabled { opacity: .45; cursor: not-allowed; background: #c5c0e0; }
.counter .count {
  min-width: 56px; text-align: center; font-size: 20px; font-weight: 700; color: var(--ink);
}
.counter .count small { display: block; font-size: 11px; font-weight: 500; color: var(--ink-soft); }

.my-group-bar {
  display: inline-flex; align-items: center; gap: 10px;
  background: white; border-radius: 999px; padding: 6px 8px 6px 16px;
  box-shadow: var(--shadow); margin-bottom: 18px;
}
.my-group-bar strong { color: var(--primary); font-size: 15px; }
.my-group-bar .btn { padding: 6px 14px; font-size: 13px; }

.picker-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.picker-list .pick-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-radius: 12px;
  background: #faf8ff; border: 2px solid transparent;
  cursor: pointer; font-size: 15px; font-weight: 600;
  transition: border-color .1s, transform .08s;
}
.picker-list .pick-item:hover { border-color: var(--primary); transform: translateX(2px); }
.picker-list .pick-item.current { background: #eee7ff; border-color: var(--primary); }
.picker-list .pick-item .badge {
  font-size: 12px; font-weight: 500; color: var(--ink-soft);
  padding: 2px 8px; border-radius: 999px; background: white;
}
.picker-list .pick-item.current .badge { background: var(--primary); color: white; }

.score-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 8px 0; }
.score-row .label { font-weight: 600; }
.score-row .label small { display: block; color: var(--ink-soft); font-weight: 400; font-size: 12px; }

.banner {
  padding: 12px 14px; border-radius: 12px; margin: 0 0 14px;
  background: #fff8e6; border: 1px solid #ffd98a; color: #6b4900;
}
.banner.bad { background: #fde8ec; border-color: #f5b3bf; color: #7a1a2c; }
.banner.good { background: #e6f7ee; border-color: #a8e0c0; color: #155939; }

.small { font-size: 13px; color: var(--ink-soft); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

ul.bare { list-style: none; padding: 0; margin: 0; }
ul.bare li {
  padding: 10px 12px; border-radius: 12px; background: white; margin-bottom: 8px;
  display: flex; gap: 10px; align-items: center; box-shadow: 0 2px 6px rgba(80,70,200,0.06);
}
ul.bare li .name { flex: 1; font-weight: 600; }

.preview {
  width: 100%; max-height: 420px; object-fit: contain;
  border-radius: 14px; background: #f4f0ff;
}

.modal-mask {
  position: fixed; inset: 0; background: rgba(40, 30, 80, .42);
  display: grid; place-items: center; z-index: 50; padding: 20px;
}
.modal {
  background: white; border-radius: var(--radius); padding: 22px; max-width: 360px; width: 100%;
  box-shadow: 0 20px 50px rgba(20,10,60,.25);
}
.modal h3 { margin: 0 0 12px; }

.hidden { display: none !important; }
