:root {
  color-scheme: dark;
  --bg: #101419;
  --panel: #171d24;
  --panel-2: #202832;
  --line: #34404d;
  --text: #f3f0e8;
  --muted: #aeb7c2;
  --red: #ff4655;
  --cyan: #5ee4d6;
  --gold: #f0c36a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.lock-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(255, 70, 85, 0.18), transparent 35%),
    radial-gradient(circle at 80% 20%, rgba(94, 228, 214, 0.12), transparent 24%),
    var(--bg);
}

.lock-panel {
  width: min(440px, 100%);
  padding: 32px;
  background: rgba(23, 29, 36, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.lock-panel h1,
.topbar h1 {
  margin-bottom: 10px;
  font-size: clamp(30px, 4vw, 46px);
}

.lock-copy,
.result-head p,
.card-meta,
.empty {
  color: var(--muted);
}

.pass-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 22px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #0d1116;
  padding: 11px 12px;
}

.pass-row button,
.ghost-button,
.segmented button,
.card-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--panel-2);
  padding: 10px 14px;
}

.pass-row button,
.card-button {
  border-color: var(--red);
  background: var(--red);
  color: white;
  font-weight: 700;
}

.error-text {
  min-height: 20px;
  color: #ff8c96;
  margin: 12px 0 0;
}

.app {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 24px;
}

.stats {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.hero-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 22px;
}

.filters {
  position: sticky;
  top: 20px;
  align-self: start;
  display: grid;
  gap: 16px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.check-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.check-row input {
  width: auto;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.segmented button.active {
  border-color: var(--cyan);
  color: #0e1a1d;
  background: var(--cyan);
  font-weight: 800;
}

.picker-button {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #0d1116;
  padding: 8px 10px;
  text-align: left;
}

.picker-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 6px;
  background: var(--panel-2);
  overflow: hidden;
}

.picker-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agent-quick-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.agent-quick {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #0d1116;
  padding: 3px;
  overflow: hidden;
}

.agent-quick:hover,
.agent-quick.active {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(94, 228, 214, 0.58);
}

.agent-quick.active {
  background: rgba(94, 228, 214, 0.1);
}

.agent-quick img {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  object-fit: cover;
}

.agent-quick span {
  font-size: 10px;
  font-weight: 900;
}

.content {
  min-width: 0;
}

.map-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.map-tile {
  position: relative;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  text-align: left;
  color: white;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.map-tile.active {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(94, 228, 214, 0.22), inset 0 0 0 1px rgba(94, 228, 214, 0.76);
  transform: translateY(-1px);
}

.map-tile.active img {
  opacity: 0.68;
}

.map-tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
}

.map-tile span {
  position: relative;
  display: block;
  padding: 54px 12px 10px;
  font-weight: 800;
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  margin: 18px 0;
}

.result-head h2 {
  margin-bottom: 4px;
}

.result-head select {
  width: 170px;
}

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

.card {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.card:hover,
.card:focus-visible {
  border-color: var(--cyan);
  outline: none;
  transform: translateY(-2px);
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0c1015;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  background: linear-gradient(135deg, #151b22, #202832);
}

.tiktok-thumb {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  gap: 8px;
  align-content: center;
  color: white;
  background:
    linear-gradient(135deg, rgba(0, 242, 234, 0.28), transparent 45%),
    linear-gradient(315deg, rgba(255, 0, 80, 0.32), transparent 46%),
    #08090c;
  font-weight: 900;
}

.tiktok-thumb span {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #111820;
  color: #00f2ea;
  font-size: 34px;
  text-shadow: 3px 2px 0 #ff0050;
}

.tiktok-thumb strong {
  font-size: 13px;
}

.platform {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 72px;
  min-height: 32px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: white;
  background: rgba(0, 0, 0, 0.7);
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 900;
}

.card-body {
  padding: 12px;
}

.card-title {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.35;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #111820;
  border: 1px solid var(--line);
  color: var(--muted);
}

.site-chip {
  color: #f4f7fb;
  font-weight: 800;
}

.site-chip.tone-attack,
.quick-chip.tone-attack {
  border-color: rgba(255, 70, 85, 0.7);
  background: rgba(255, 70, 85, 0.18);
}

.site-chip.tone-defense,
.quick-chip.tone-defense {
  border-color: rgba(80, 156, 255, 0.72);
  background: rgba(80, 156, 255, 0.18);
}

.site-chip.tone-any,
.quick-chip.tone-any {
  border-color: rgba(174, 183, 194, 0.42);
  background: rgba(174, 183, 194, 0.12);
}

.quick-chip.tone-purpose {
  border-color: rgba(94, 228, 214, 0.58);
  background: rgba(94, 228, 214, 0.12);
}

.chip img {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}

.verified {
  color: #0f2320;
  background: var(--cyan);
  border-color: var(--cyan);
  font-weight: 800;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.quick-filters {
  display: grid;
  gap: 8px;
  margin: -6px 0 16px;
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: #111820;
  padding: 6px 11px;
}

.quick-chip.active {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px var(--cyan);
}

.quick-chip small {
  color: var(--muted);
}

.detail-dialog {
  width: min(1240px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--text);
  background: var(--panel);
}

.agent-dialog {
  width: min(760px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--text);
  background: rgba(23, 29, 36, 0.98);
}

.agent-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.agent-dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.agent-dialog-head h2 {
  margin-bottom: 0;
}

.close-button.static {
  position: static;
}

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

.agent-option {
  min-height: 104px;
  display: grid;
  gap: 6px;
  justify-items: center;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #0d1116;
  padding: 8px;
}

.agent-option.active {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px var(--cyan);
}

.agent-option img,
.agent-option .agent-all {
  width: 54px;
  height: 54px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--panel-2);
}

.agent-option .agent-all {
  display: grid;
  place-items: center;
  color: var(--cyan);
  font-weight: 900;
}

.agent-option span {
  width: 100%;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.18;
  font-size: clamp(10px, 1.2vw, 12px);
  color: var(--muted);
}

.detail-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0d1116;
  color: var(--text);
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(300px, 0.85fr);
  gap: 22px;
  padding: 24px;
}

.video-frame {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #080b0f;
}

.video-frame iframe,
.video-frame img {
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}

.video-frame .tiktok-player {
  background: #000;
}

.detail-info {
  padding-top: 24px;
}

.detail-info .card-meta {
  margin: 12px 0;
}

.memo {
  white-space: pre-wrap;
  color: var(--muted);
  line-height: 1.7;
}

.player-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.player-controls button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #111820;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 800;
}

.player-controls button:hover {
  border-color: var(--cyan);
}

@media (max-width: 860px) {
  .app {
    padding: 18px;
  }

  .topbar,
  .result-head,
  .detail-layout {
    display: block;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
  }

  .result-head select {
    width: 100%;
    margin-top: 10px;
  }

  .detail-info {
    padding-top: 12px;
  }
}
