:root {
    --primary: #ff0033;
    --primary-dark: #cc0029;
    --bg: #f5f5f7;
    --card: #ffffff;
    --text: #1d1d1f;
    --text-muted: #6e6e73;
    --border: #e5e5ea;
    --success: #34c759;
    --warning: #ff9500;
    --danger: #ff3b30;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo",
                 "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Hero */
.hero {
    background: linear-gradient(135deg, #1a1a1a 0%, #2c2c2e 100%);
    color: white;
    padding: 60px 24px 80px;
    text-align: center;
}

.hero-inner {
    max-width: 720px;
    margin: 0 auto;
}

.badge {
    display: inline-block;
    padding: 6px 14px;
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: 20px;
    margin-bottom: 16px;
}

.hero h1 {
    font-size: 44px;
    font-weight: 800;
    margin: 0 auto 12px;
    letter-spacing: -0.02em;
    cursor: pointer;
    width: fit-content;
    transition: opacity 0.15s;
}

.hero h1:hover {
    opacity: 0.85;
}

.subtitle {
    font-size: 17px;
    color: rgba(255, 255, 255, 0.7);
}

/* Container */
.container {
    max-width: 720px;
    margin: -40px auto 60px;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background: var(--card);
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
}

.section-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 14px;
    margin-top: 24px;
}

.section-title:first-child {
    margin-top: 0;
}

/* Upload */
.upload-area {
    display: block;
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 20px;
    overflow: hidden;
    position: relative;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(255, 0, 51, 0.02);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(255, 0, 51, 0.05);
}

.upload-icon {
    font-size: 36px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 300;
}

.upload-placeholder p {
    color: var(--text);
    margin: 4px 0;
}

.hint {
    font-size: 13px;
    color: var(--text-muted) !important;
}

#preview {
    max-width: 100%;
    max-height: 280px;
    border-radius: 8px;
    object-fit: contain;
}

/* Form fields */
.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.required {
    color: var(--primary);
}

.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #fafafa;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.field textarea {
    resize: vertical;
    min-height: 80px;
}

.field select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3e%3cpath fill='%236e6e73' d='M6 8L0 0h12z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 36px;
}

/* Radio pill toggle (국내 / 글로벌) */
.radio-group {
    display: flex;
    gap: 8px;
}

.radio-pill {
    flex: 1;
    cursor: pointer;
    position: relative;
}

.radio-pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.radio-pill span {
    display: block;
    text-align: center;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    background: #fafafa;
    color: var(--text-muted);
    transition: all 0.15s;
}

.radio-pill:hover span { color: var(--text); }

.radio-pill input:checked + span {
    background: white;
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 0, 51, 0.08);
}

/* Submit button */
.btn-score {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin-top: 8px;
}

.btn-score:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-score:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-score:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.limit-info {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
}

/* Loading */
.result-card {
    text-align: center;
    padding: 60px 24px;
}

.loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error */
.error-card {
    background: #fff5f5;
    border: 1px solid #ffcccc;
    color: #c00;
    text-align: center;
}

/* Result section - 카드 간 간격 */
#result-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* hidden 속성이 display: flex 보다 우선하도록 */
#result-section[hidden] { display: none; }

/* 입력 요약 카드 — 채점한 썸네일·제목·태그 표시 */
.input-summary {
    display: flex;
    gap: 18px;
    align-items: center;
    padding: 18px;
}

.input-summary-thumb {
    flex-shrink: 0;
    width: 180px;
    height: 102px;
    border-radius: 8px;
    overflow: hidden;
    background: #eee;
    position: relative;
}

.input-summary-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.input-summary-meta {
    flex: 1;
    min-width: 0;
}

.input-summary-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 10px;
    color: var(--text);
    word-break: keep-all;
}

.input-summary-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.input-summary-tag {
    background: #f5f5f7;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

@media (max-width: 600px) {
    .input-summary {
        flex-direction: column;
        align-items: stretch;
    }
    .input-summary-thumb {
        width: 100%;
    }
}

/* 다시 채점하기 버튼 */
.btn-back {
    align-self: flex-start;
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.btn-back:hover {
    background: var(--bg);
    border-color: var(--text-muted);
}

.results-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ─────────────────────────────────────────
   피드백 카드 (👍/👎)
   ───────────────────────────────────────── */
.feedback-card { text-align: center; }

.feedback-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 8px;
}

.btn-feedback {
    flex: 1;
    max-width: 200px;
    padding: 14px 20px;
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.btn-feedback:hover:not(:disabled) {
    background: white;
    border-color: var(--text-muted);
    transform: translateY(-1px);
}

.btn-feedback:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f0f0f3;
    color: var(--text-muted);
}

.feedback-negative {
    text-align: left;
    margin-top: 16px;
}

.feedback-prompt {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.feedback-hint {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 12px;
}

.feedback-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.feedback-checkboxes label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #fafafa;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    border: 1px solid transparent;
    transition: all 0.15s;
    user-select: none;
}

.feedback-checkboxes label:hover {
    background: white;
    border-color: var(--border);
}

.feedback-checkboxes label:has(input:checked) {
    background: rgba(255, 0, 51, 0.04);
    border-color: var(--primary);
}

.feedback-checkboxes input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    flex-shrink: 0;
    cursor: pointer;
}

.feedback-checkboxes label.other-row {
    border-top: 1px dashed var(--border);
    border-radius: 8px;
    padding-top: 12px;
    margin-top: 4px;
}

#feedback-other-text {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    background: #fafafa;
    margin-bottom: 12px;
    resize: vertical;
    min-height: 70px;
}

#feedback-other-text:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.btn-feedback-submit {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.btn-feedback-submit:hover {
    background: var(--primary-dark);
}

.feedback-thanks {
    padding: 16px;
    color: var(--success);
    font-weight: 600;
    font-size: 14px;
}


/* Score result */
.total-score {
    text-align: center;
    padding: 20px 0 30px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

/* 총평 라벨 (숫자 대신) */
.total-rating {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 14px;
    padding: 16px 32px;
    border-radius: 16px;
    background: #fafafa;
    border: 2px solid var(--border);
}

.total-emoji {
    font-size: 44px;
    line-height: 1;
}

.total-label {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

/* 등급 색상 (총평·아이템·바 공통) */
.tier-best       { border-color: #ffb000; background: #fff8e0; color: #b56f00; }
.tier-great      { border-color: #34c759; background: #e8faec; color: #1d8b3a; }
.tier-good       { border-color: #007aff; background: #e8f1ff; color: #0055bb; }
.tier-soso       { border-color: #ff9500; background: #fff2dc; color: #b56f00; }
.tier-needswork  { border-color: #ff3b30; background: #ffe8e6; color: #c00; }

.score-bar-fill.tier-best       { background: #ffb000; }
.score-bar-fill.tier-great      { background: #34c759; }
.score-bar-fill.tier-good       { background: #007aff; }
.score-bar-fill.tier-soso       { background: #ff9500; }
.score-bar-fill.tier-needswork  { background: #ff3b30; }

/* 항목별 라벨 뱃지 */
.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid;
    white-space: nowrap;
}

/* 그룹 (A. 후킹력 / B. 시너지 / C. 완성도) */
.score-groups {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.score-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.score-group-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--border);
}

.score-group-header h4 {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
}

.score-group-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.summary {
    font-size: 15px;
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto;
}

/* Context block - AI가 추정한 채널 맥락 */
.context-block {
    background: linear-gradient(135deg, #f0f4ff 0%, #faf0ff 100%);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 24px;
    border: 1px solid #e0e4f0;
}

.context-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    margin-bottom: 10px;
}

.context-icon {
    font-size: 16px;
}

.context-hint {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 400;
}

.context-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.context-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: white;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border);
}

.context-tag em {
    font-style: normal;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 400;
}

.context-pattern {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
    margin: 0;
    padding-top: 4px;
}

/* 시청자 페르소나 블록 */
.persona-block {
    background: linear-gradient(135deg, #fff5f0 0%, #fffaf0 100%);
    border: 1px solid #ffd8c4;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 24px;
}

.persona-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    margin-bottom: 12px;
}

.persona-hint {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

.persona-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 13px;
    line-height: 1.5;
}

.persona-row strong {
    font-weight: 700;
    color: #d2691e;
    min-width: 70px;
    flex-shrink: 0;
}

.persona-row span:last-child {
    flex: 1;
    color: var(--text);
}

.persona-icon {
    font-size: 14px;
}

.persona-appeal {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
    margin: 8px 0 0;
    padding: 8px 12px;
    background: rgba(255, 165, 0, 0.08);
    border-radius: 8px;
}

.persona-appeal span {
    margin-right: 4px;
}

/* Score breakdown */
.score-breakdown {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.score-item {
    padding: 14px 16px;
    background: #fafafa;
    border-radius: 10px;
}

.score-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.score-item-name {
    font-weight: 600;
    font-size: 15px;
}

.score-item-reason {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.score-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.score-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.6s ease;
}

/* Improvements */
.improvements {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.improvements li {
    padding: 12px 14px 12px 40px;
    background: #fffbf0;
    border-radius: 8px;
    position: relative;
    font-size: 14px;
    line-height: 1.5;
}

.improvements li::before {
    content: "💡";
    position: absolute;
    left: 12px;
    top: 12px;
}

/* Similar thumbnails */
.similar-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

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

.similar-item {
    text-decoration: none;
    color: inherit;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.2s;
}

.similar-item:hover {
    transform: translateY(-3px);
}

.similar-item img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    background: #eee;
}

.similar-item-info {
    padding: 10px 4px 0;
}

.similar-item-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.similar-item-channel {
    font-size: 12px;
    color: var(--text-muted);
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    font-size: 12px;
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .hero h1 { font-size: 32px; }
    .subtitle { font-size: 15px; }
    .card { padding: 20px; }
    .score-circle span { font-size: 52px; }
}
