:root {
  --brand1: #fd267a;
  --brand2: #ff7854;
  --grad: linear-gradient(45deg, var(--brand1), var(--brand2));
  --logo1: #fd267a;
  --logo2: #ff7854;
  --bg: #eef0f3;
  --surface: #fff;
  --text: #21262e;
  --muted: #7c8591;
  --line: #e4e7eb;
  --nope: #fd5068;
  --like: #1bd68f;
  --super: #1ea7ff;
  --rewind: #f5b748;
  --boost: #a85cf9;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ================= スワイプ画面 ================= */
.swipe-page { overflow: hidden; }
.swipe-page[data-bg="dark"] { background: #111418; }
.swipe-page[data-bg="green"] { background: #00ff00; }
.swipe-page[data-bg="transparent"] { background: transparent; }

.app {
  position: relative;
  margin: 0 auto;
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
@media (min-width: 600px) and (min-height: 700px) {
  .swipe-page { display: flex; align-items: center; justify-content: center; }
  .app {
    height: min(calc(100dvh - 40px), 900px);
    border-radius: 32px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .18);
  }
}

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  padding: 0 10px 0 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -1.2px;
  background: linear-gradient(45deg, var(--logo1), var(--logo2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand .logo { width: 34px; height: 34px; }
.top-actions { display: flex; }
.icon-btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: none;
  color: #b2b9c3;
  cursor: pointer;
}
.icon-btn svg { width: 26px; height: 26px; fill: currentColor; }
.icon-btn:hover { color: #8a93a0; }

/* ---------- カード ---------- */
.stage { position: relative; flex: 1; min-height: 0; margin: 0 8px; }
.deck { position: absolute; inset: 0; }
.card {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #2b2f36;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
  touch-action: none;
  will-change: transform;
  transform: scale(.95);
}
.card.top { transform: none; cursor: grab; }
.card.top:active { cursor: grabbing; }
.photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.shade {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.88) 0%, rgba(0,0,0,.45) 28%, rgba(0,0,0,0) 50%);
  pointer-events: none;
}
.info { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 64px 22px 18px; color: #fff; pointer-events: none; }
.active-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  margin-bottom: 6px;
  border-radius: 999px;
  background: rgba(30, 220, 140, .25);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.active-badge i { width: 8px; height: 8px; border-radius: 50%; background: #1ee38f; }
.name-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; text-shadow: 0 1px 6px rgba(0,0,0,.3); }
.name { font-size: 32px; font-weight: 800; line-height: 1.15; }
.age { font-size: 28px; font-weight: 400; }
.verified { width: 22px; height: 22px; align-self: center; }
.meta { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 15px; opacity: .92; }
.meta svg { width: 16px; height: 16px; fill: currentColor; }
.bio {
  margin: 6px 0 0;
  font-size: 15px;
  line-height: 1.45;
  opacity: .92;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}
.info-btn {
  position: absolute; right: 16px; bottom: 24px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #fff;
}
.info-btn svg { width: 20px; height: 20px; fill: #21262e; }
.hide-info .info, .hide-info .shade { display: none; }
.info [hidden] { display: none; }

/* 次のカードのぼかし: 表のカードになるまで中身をぼかす */
.veil {
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  -webkit-backdrop-filter: blur(var(--next-blur, 14px));
  backdrop-filter: blur(var(--next-blur, 14px));
  transition: opacity .35s ease-out;
}
.card:not(.top) .veil { opacity: 1; }

/* 広告カード */
.card.ad .active-badge { background: rgba(255, 255, 255, .25); }
.cta {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 18px;
  border-radius: 999px;
  background: #fff;
  color: #21262e;
  font-size: 14px;
  font-weight: 700;
}

.stamp {
  position: absolute;
  top: 46px;
  padding: 2px 12px;
  border: 5px solid;
  border-radius: 10px;
  font-size: 46px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
}
.stamp-like { left: 26px; color: var(--like); border-color: var(--like); transform: rotate(-22deg); }
.stamp-nope { right: 26px; color: var(--nope); border-color: var(--nope); transform: rotate(22deg); }
.stamp-super {
  top: auto; bottom: 34%;
  left: 50%;
  color: var(--super); border-color: var(--super);
  text-align: center;
  font-size: 40px;
  transform: translateX(-50%) rotate(-10deg);
}

.card.empty { background: #fff; box-shadow: none; display: grid; place-items: center; transform: none; cursor: default; }
.empty-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--muted); text-align: center; }
.empty-inner p { margin: 0; font-size: 16px; }
.radar {
  width: 96px; height: 96px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--logo1) 35%, transparent);
  animation: radar 1.8s infinite;
}
.radar svg { width: 48px; height: 48px; }
@keyframes radar {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--logo1) 35%, transparent); }
  100% { box-shadow: 0 0 0 40px color-mix(in srgb, var(--logo1) 0%, transparent); }
}

/* ---------- アクションボタン ---------- */
.actions { flex: none; display: flex; justify-content: center; align-items: center; gap: 16px; padding: 14px 0 12px; }
.act {
  --c: #999;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: #fff;
  color: var(--c);
  box-shadow: 0 2px 14px rgba(0, 0, 0, .13);
  cursor: pointer;
  transition: transform .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.act svg { fill: currentColor; transition: fill .15s; }
.act.sm { width: 50px; height: 50px; }
.act.lg { width: 64px; height: 64px; }
.act.sm svg { width: 24px; height: 24px; }
.act.lg svg { width: 32px; height: 32px; }
.act.rewind { --c: var(--rewind); }
.act.nope { --c: var(--nope); }
.act.super { --c: var(--super); }
.act.like { --c: var(--like); }
.act.boost { --c: var(--boost); }
.act:active { transform: scale(.88) !important; }
.act.hot { background: var(--c); }
.act.hot svg { fill: #fff; }
.act.flash { animation: flash .45s ease-out; }
@keyframes flash {
  0% { background: var(--c); color: #fff; transform: scale(1.15); }
  100% { background: #fff; color: var(--c); transform: scale(1); }
}
.app.boosting::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 0 rgba(168, 92, 249, .0);
  animation: boost 1.2s ease-out;
}
@keyframes boost {
  0% { box-shadow: inset 0 0 0 0 rgba(168, 92, 249, .0); }
  30% { box-shadow: inset 0 0 60px 10px rgba(168, 92, 249, .55); }
  100% { box-shadow: inset 0 0 0 0 rgba(168, 92, 249, 0); }
}

/* ---------- 下部ナビ ---------- */
.bottomnav {
  flex: none;
  display: flex;
  justify-content: space-around;
  padding: 6px 0 calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.bottomnav a { padding: 8px 12px; color: #c4c9d0; }
.bottomnav svg { width: 28px; height: 28px; fill: currentColor; display: block; }
.bottomnav a.active svg { fill: url(#g-brand); }

/* ---------- グリーンバック / ライブ映像 ---------- */
.card.chroma { box-shadow: none; }
.card.chroma .shade { display: none; }
.card.chroma .info { text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.card.chroma .active-badge { background: rgba(0, 0, 0, .45); }
video.feed { background: #000; }

.live-setup {
  position: absolute; inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: 14px;
  background: #1b1e24;
  color: #fff;
  text-align: center;
}
.live-setup[hidden] { display: none; }
.live-box { display: grid; gap: 12px; justify-items: center; max-width: 320px; }
.live-box h3 { margin: 0; font-size: 18px; }
.live-box p { margin: 0; font-size: 13px; line-height: 1.6; opacity: .8; }
.live-box .pill { min-width: 0; width: 100%; }
.cam-row { display: grid; gap: 8px; width: 100%; }
.cam-row[hidden] { display: none; }
.cam-row select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #3a3f48;
  border-radius: 10px;
  background: #262a31;
  color: #fff;
  font: inherit;
  font-size: 13px;
}
.live-error { color: #ff8a9b; opacity: 1 !important; }
.live-note kbd { padding: 1px 6px; border: 1px solid #555; border-radius: 4px; font-family: inherit; }

/* ---------- 共通ボタン ---------- */
.pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 240px;
  padding: 13px 28px;
  border-radius: 999px;
  border: 0;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
}
.pill.grad { background: var(--grad); color: #fff; }
.pill.outline { background: transparent; color: #fff; border: 2px solid rgba(255, 255, 255, .6); }

/* ================= 管理画面 ================= */
.admin-page { background: var(--bg); }
.admin-header { position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--line); }
.admin-header-inner { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand.small { font-size: 20px; letter-spacing: 0; }
.brand.small .logo { width: 26px; height: 26px; }
.admin-header .pill { min-width: 0; padding: 9px 18px; font-size: 14px; }

.admin { max-width: 1040px; margin: 0 auto; padding: 16px 16px 80px; display: grid; gap: 16px; }
.panel { background: #fff; border-radius: 16px; padding: 18px; box-shadow: 0 1px 4px rgba(0, 0, 0, .05); display: grid; gap: 12px; }
.panel h2 { margin: 0; font-size: 18px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.count { display: inline-block; min-width: 26px; padding: 1px 8px; margin-left: 4px; border-radius: 999px; background: var(--grad); color: #fff; font-size: 13px; text-align: center; vertical-align: middle; }
.hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.empty-msg { margin: 8px 0; color: var(--muted); text-align: center; }

.admin label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: #4a525d; }
.admin label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; cursor: pointer; }
.admin label.inline { display: flex; align-items: center; gap: 8px; }
.admin input:not([type]), .admin input[type="text"], .admin select, .admin textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  background: #fafbfc;
}
.admin label.inline select { width: auto; }
.admin textarea { resize: vertical; }
.admin input:focus, .admin select:focus, .admin textarea:focus { outline: 2px solid rgba(253, 38, 122, .35); border-color: var(--brand1); }
.admin input[type="range"] { width: 100%; accent-color: var(--brand1); }
.admin input[type="checkbox"] { accent-color: var(--brand1); width: 18px; height: 18px; }
.admin [hidden] { display: none !important; }
.field-label { font-size: 13px; font-weight: 600; color: #4a525d; }
.logo-colors { display: grid; gap: 8px; }
.logo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.logo-preview { font-size: 30px; padding: 6px 14px 6px 8px; border: 1px solid var(--line); border-radius: 12px; }
.logo-preview .logo { width: 30px; height: 30px; }
.admin label.color { display: flex; align-items: center; gap: 6px; }
.admin input[type="color"] { width: 44px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.presets .btn { gap: 6px; }
.hotkey-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.btn.hotkey { min-width: 120px; justify-content: center; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.btn.hotkey.recording { border-color: var(--brand1); color: var(--brand1) !important; background: #fff5f8; }
.btn.hotkey.unset { color: var(--muted) !important; }
.presets .btn i { width: 14px; height: 14px; border-radius: 50%; }
.sub { display: grid; gap: 12px; padding: 12px; border-radius: 12px; background: #f6f7f9; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .grid3 { grid-template-columns: 1fr 1fr; } .grid3 > :first-child { grid-column: 1 / -1; } }

.dropzone {
  display: grid !important;
  place-items: center;
  gap: 6px !important;
  padding: 30px 16px;
  border: 2px dashed #d3d8de;
  border-radius: 14px;
  text-align: center;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.dropzone strong { font-size: 15px; color: var(--text); }
.dropzone span { font-weight: 400; color: var(--muted); max-width: 520px; line-height: 1.6; }
.dropzone:hover, .dropzone.over { border-color: var(--brand1); background: #fff5f8; }

.field-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.usage { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.meter { width: 160px; height: 8px; border-radius: 999px; background: #e9ecef; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--grad); transition: width .3s; }
.meter span.warn { background: var(--nope); }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex !important;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 13px !important;
  font-weight: 600;
  color: var(--text) !important;
  cursor: pointer;
}
.btn:hover { background: #f5f6f8; }
.btn.danger { color: var(--nope) !important; border-color: #fdd0d7; }
.btn.danger:hover { background: #fff3f5; }
.btn.small { justify-self: start; padding: 6px 12px; }

.pic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.pic { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.pic.disabled .pic-thumb img { filter: grayscale(1) brightness(.7); }
.pic-thumb { position: relative; aspect-ratio: 2 / 3; background: #2b2f36; }
.pic-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter .2s; }
.pic-body { padding: 12px; display: grid; gap: 10px; }

.switch { position: absolute !important; top: 10px; right: 10px; display: block !important; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { display: block; width: 48px; height: 28px; border-radius: 999px; background: rgba(0, 0, 0, .45); box-shadow: 0 1px 4px rgba(0,0,0,.3); position: relative; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--like); }
.switch input:checked + span::after { transform: translateX(20px); }

.toast {
  position: fixed;
  left: 50%; bottom: 24px;
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: #21262e;
  color: #fff;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--nope); border-radius: 12px; }
