* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: #f4f5f7; color: #1f2937; line-height: 1.5; }
header { background: #111827; color: #fff; padding: 20px 24px; }
header h1 { margin: 0 0 4px; font-size: 22px; }
header p { margin: 0; color: #d1d5db; font-size: 14px; }
main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }
#controls { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
#controls label { font-size: 12px; color: #6b7280; display: block; margin-bottom: 2px; }
#controls input[type="text"], #controls select { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; background: #fff; min-width: 150px; }
#searchBox { flex: 1 1 260px; }
#searchBox input { width: 100%; }
.field { display: flex; flex-direction: column; }
.check { display: flex; align-items: center; gap: 6px; font-size: 14px; padding-bottom: 8px; }
button { padding: 8px 14px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; cursor: pointer; font-size: 14px; }
button:hover { background: #f3f4f6; }
#count { margin: 16px 4px 8px; color: #4b5563; font-size: 14px; }
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; cursor: pointer; }
.card:hover { border-color: #9ca3af; }
.card .top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card .code { font-weight: 700; font-size: 16px; }
.card .meta { color: #6b7280; font-size: 13px; }
.chip { display: inline-block; background: #eef2ff; color: #3730a3; border-radius: 999px; padding: 1px 9px; font-size: 12px; margin-right: 4px; }
.tag { display: inline-block; background: #ecfdf5; color: #065f46; border-radius: 999px; padding: 1px 9px; font-size: 12px; margin-right: 4px; }
.badges { font-size: 13px; color: #4b5563; margin-top: 6px; }
.desc { margin-top: 6px; font-size: 14px; color: #374151; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 10; }
#modal.hidden { display: none; }
#modalBox { background: #fff; border-radius: 12px; max-width: 860px; width: 100%; padding: 22px; }
#modalBox h2 { margin-top: 0; }
#modalBox table { border-collapse: collapse; width: 100%; font-size: 14px; }
#dupcheck { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
#dupcheck h2 { margin: 0 0 6px; font-size: 18px; }
.dup-hint { margin: 0 0 12px; font-size: 14px; color: #4b5563; line-height: 1.55; }
#dupText { width: 100%; min-height: 110px; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 15px; font-family: inherit; line-height: 1.55; resize: vertical; }
#dupText:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
#dupcheck .row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.btn-primary { background: #111827; color: #fff; border-color: #111827; font-weight: 600; }
.btn-primary:hover { background: #1f2937; }
.btn-secondary { background: #fff; color: #374151; }
#dupResult { margin-top: 14px; }
#dupResult:empty { display: none; }
.dup-verdict-box { border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; border-left: 4px solid #9ca3af; background: #f9fafb; }
.dup-verdict-box .dup-verdict { font-weight: 700; font-size: 17px; line-height: 1.4; }
.dup-verdict-box .dup-confidence { font-size: 13px; font-weight: 400; opacity: .75; margin-left: 6px; }
.dup-explain { margin: 6px 0 0; font-size: 14px; color: #374151; line-height: 1.55; }
.dup-verdict-duplicate { background: #fef2f2; border-left-color: #dc2626; color: #991b1b; }
.dup-verdict-root { background: #fff7ed; border-left-color: #ea580c; color: #9a3412; }
.dup-verdict-related { background: #fefce8; border-left-color: #ca8a04; color: #854d0e; }
.dup-verdict-ok { background: #f0fdf4; border-left-color: #16a34a; color: #166534; }
.dup-verdict-unknown { background: #f9fafb; border-left-color: #9ca3af; color: #374151; }
.dup-loading, .dup-error, .dup-empty, .dup-ok { border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 0; }
.dup-loading { background: #f9fafb; color: #4b5563; }
.dup-loading::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 2px solid #d1d5db; border-top-color: #6366f1; border-radius: 50%; animation: dup-spin 0.8s linear infinite; }
@keyframes dup-spin { to { transform: rotate(360deg); } }
.dup-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.dup-empty { background: #f9fafb; color: #6b7280; }
.dup-ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.dup-note { font-size: 13px; color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 8px 10px; margin: 0 0 10px; }
.dup-matches-title { font-size: 13px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; margin: 14px 0 2px; }
.dup-match { border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; margin-top: 8px; cursor: pointer; background: #fff; }
.dup-match:hover { border-color: #6366f1; box-shadow: 0 2px 8px rgba(99,102,241,.12); }
.dup-match .top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dup-match .code { font-weight: 700; font-size: 16px; }
.dup-match .meta { color: #6b7280; font-size: 13px; }
.dup-open { margin-left: auto; font-size: 13px; color: #6b7280; white-space: nowrap; }
.dup-match:hover .dup-open { color: #4f46e5; }
.dup-score { display: inline-block; border-radius: 999px; padding: 1px 10px; font-size: 12px; font-weight: 700; }
.dup-score-high { background: #dcfce7; color: #166534; }
.dup-score-mid { background: #fef9c3; color: #854d0e; }
.dup-score-low { background: #e5e7eb; color: #374151; }
.dup-reason { font-size: 13.5px; color: #4b5563; margin-top: 6px; line-height: 1.5; }
@media (max-width: 600px) {
  #dupcheck { padding: 16px; }
  #dupcheck .row { flex-direction: column; }
  #dupcheck .row button { width: 100%; }
}
#modalBox td { padding: 5px 8px; vertical-align: top; border-bottom: 1px solid #f3f4f6; }
#modalBox td:first-child { color: #6b7280; white-space: nowrap; width: 130px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.thumbs img { width: 180px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid #e5e7eb; }
.videobox { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 10px 12px; margin-top: 8px; font-size: 14px; }
.upd { border-left: 3px solid #d1d5db; padding: 6px 10px; margin-top: 8px; font-size: 14px; background: #f9fafb; }
.closebtn { float: right; }
.warn { position: relative; cursor: help; font-size: 15px; }
.warn:hover::after { content: attr(data-tip); position: absolute; left: 0; top: 135%; background: #111827; color: #fff; font-size: 13px; font-weight: 400; line-height: 1.45; padding: 8px 11px; border-radius: 8px; width: 300px; max-width: 80vw; z-index: 5; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.warnbox { background: #fffbeb; border: 1px solid #f59e0b; border-radius: 8px; padding: 10px 12px; margin: 12px 0; font-size: 14px; }
