/* clipboard.kr css/style.css 의 토큰·컴포넌트 값을 그대로 따른다. */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { overflow-x: hidden; width: 100%; max-width: 100vw; touch-action: manipulation; }
input, button, select, textarea { font-size: 16px; font-family: inherit; }

:root {
  --bg: #0a0a12;
  --card: #12121e;
  --border: #1e1e30;
  --inputBg: #0e0e1a;
  --text: #e0e0e8;
  --sub: #777;
  --accent1: #6c5ce7;
  --accent2: #00cec9;
  --gradient: linear-gradient(135deg, #6c5ce7, #00cec9);
  --danger: #ff6b6b;
  --success: #00b894;
  --warn: #f59e0b;
  --radius: 14px;
  color-scheme: dark;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
}
[hidden] { display: none !important; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible, .drop-zone:focus-within {
  outline: 2px solid var(--accent2); outline-offset: 2px;
}

.header h1, .header p, .status-code, .circle-percent, .footer-brand {
  background: var(--gradient); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.header { text-align: center; padding: 36px 20px 12px; }
.header h1 { font-size: 2.6rem; font-weight: 900; letter-spacing: -1px; }
.header p { margin-top: 6px; font-size: 0.9rem; font-weight: 600; }

.container { width: 100%; max-width: 540px; padding: 16px; overflow-x: hidden; word-break: break-word; }

.panel { display: none; }
.panel.active { display: block; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; overflow: hidden; }

/* 초기 선택 */
#modeSelect { display: flex; gap: 10px; width: 100%; }
.mode-card {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center;
  padding: 28px 12px; border: 2px solid var(--border); border-radius: 18px;
  background: var(--card); color: var(--text); cursor: pointer; transition: all 0.25s; text-align: center;
}
.mode-card:hover { border-color: var(--accent1); background: #1a1630; transform: translateY(-2px); }
.mode-icon { font-size: 3rem; margin-bottom: 12px; }
.mode-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 6px; }
.mode-desc { font-size: 0.8rem; color: var(--sub); }

.back-btn {
  background: var(--danger); border: none; color: #fff; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; padding: 6px 14px; margin-bottom: 14px; border-radius: 8px; transition: opacity 0.2s;
}
.back-btn:hover { opacity: 0.85; }

/* 드롭존 */
.drop-zone {
  display: block; border: 2px dashed #2a2a40; border-radius: 12px; padding: 40px 20px;
  text-align: center; cursor: pointer; transition: all 0.2s;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent1); background: #1a1630; }
.drop-zone .icon { font-size: 2.5rem; margin-bottom: 10px; }
.drop-zone p { color: var(--sub); font-size: 0.9rem; }
.drop-zone .sub-hint { color: #555; font-size: 0.8rem; margin-top: 6px; }
.drop-zone input { display: none; }

.add-more {
  display: block; width: 100%; margin-top: 10px; padding: 8px 16px; background: #1a1a2e;
  border: 1px dashed #333; border-radius: 8px; color: var(--sub); font-size: 0.85rem; cursor: pointer; text-align: center;
}
.add-more:hover { border-color: var(--accent1); color: var(--text); }

/* 아이템 리스트 */
.item-list { margin-top: 16px; max-height: 300px; overflow-y: auto; }
.item-list:empty { display: none; }
.item-block {
  display: flex; align-items: center; padding: 10px 12px; background: var(--inputBg);
  border-radius: 8px; margin-bottom: 6px; font-size: 0.85rem;
}
.badge {
  display: inline-block; padding: 2px 6px; border-radius: 4px;
  font-size: 0.65rem; font-weight: 700; flex-shrink: 0; margin-right: 8px;
}
.badge.file { background: #1a1630; color: var(--accent1); }
.badge.text { background: #0a2020; color: var(--accent2); }
.badge.image { background: #1a1a0a; color: var(--warn); }
.item-block .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.item-block .meta { color: var(--sub); white-space: nowrap; font-size: 0.8rem; margin-left: 8px; flex-shrink: 0; }
.item-block .remove {
  margin-left: 8px; color: var(--danger); cursor: pointer; font-size: 1.1rem;
  border: none; background: none; padding: 0 4px; flex-shrink: 0;
}
.file-summary { margin-top: 8px; font-size: 0.85rem; color: var(--sub); text-align: right; }
.file-summary:empty { display: none; }

/* 공유 모드 */
.share-mode { display: flex; gap: 8px; margin-top: 14px; justify-content: center; }
.share-toggle {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 8px 10px; background: var(--inputBg); border: 2px solid var(--border);
  border-radius: 10px; cursor: pointer; transition: all 0.2s; min-width: 0;
}
.share-toggle.active { border-color: var(--accent1); background: #1a1630; }
.share-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.share-toggle:has(input:focus-visible) { outline: 2px solid var(--accent2); outline-offset: 2px; }
.share-toggle-icon { font-size: 1.3rem; margin-bottom: 2px; }
.share-toggle-label { font-size: 0.75rem; font-weight: 700; color: var(--sub); }
.share-toggle.active .share-toggle-label { color: var(--text); }

.share-btn {
  width: 100%; padding: 14px; margin-top: 16px; background: var(--gradient);
  color: #fff; border: none; border-radius: 12px; font-size: 1rem; font-weight: 700; cursor: pointer; transition: opacity 0.2s;
}
.share-btn:hover { opacity: 0.9; }
.share-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* 상태 */
.status-modal {
  text-align: center; padding: 24px 16px; background: #0d0d1a;
  border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; word-break: break-word;
}
.circle-wrap { position: relative; width: 140px; height: 140px; margin: 0 auto 20px; }
.circle-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.circle-bg { fill: none; stroke: #1e1e30; stroke-width: 8; }
.circle-progress {
  fill: none; stroke: url(#progressGradient); stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 326.73; stroke-dashoffset: 326.73; transition: stroke-dashoffset 0.4s ease;
}
.circle-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; }
.circle-percent { font-size: 2rem; font-weight: 900; }
.circle-check { font-size: 3rem; font-weight: 900; color: var(--success); }

.waiting-spinner { text-align: center; margin-bottom: 20px; }
.spinner-large {
  width: 64px; height: 64px; border: 4px solid #1e1e30; border-top-color: var(--accent1);
  border-right-color: var(--accent2); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status-label { font-size: 0.85rem; color: var(--sub); margin-bottom: 8px; }
.peer-count { font-size: 0.8rem; color: var(--accent2); margin-top: 6px; margin-bottom: 4px; }
.peer-count:empty { display: none; }
.status-code {
  font-size: 2.4rem; font-weight: 900; letter-spacing: 6px; font-family: 'Courier New', monospace;
  margin-bottom: 4px; word-break: break-all;
}
.code-buttons { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.copy-btn { padding: 8px 20px; background: #1e1e30; color: #ccc; border: 1px solid #333; border-radius: 8px; cursor: pointer; font-size: 0.85rem; }
.copy-btn:hover { background: #2a2a40; }
.qr-wrap { display: block; margin: 16px auto 8px; padding: 12px; background: #fff; border-radius: 10px; width: fit-content; }
.qr-wrap img { display: block; width: 160px; height: 160px; }
.qr-wrap:has(img:not([src])) { display: none; }

.transfer-info { margin-top: 16px; }
.transfer-speed { font-size: 1.1rem; font-weight: 700; color: var(--accent2); }
.transfer-eta { font-size: 0.85rem; color: var(--sub); margin-top: 4px; }

/* 파일·소스 진행 목록 */
.file-progress-list { margin-top: 16px; text-align: left; }
.file-progress-list:empty { display: none; }
.send-file-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--inputBg);
  border-radius: 8px; margin-bottom: 6px; font-size: 0.85rem;
}
.sfr-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sfr-size { color: var(--sub); font-size: 0.8rem; white-space: nowrap; flex-shrink: 0; }
.sources-title { margin-top: 20px; font-size: 0.8rem; font-weight: 700; color: var(--sub); text-align: left; }
.sources-title span { font-weight: 400; color: #555; }
.sfr-id { font-family: 'Courier New', monospace; }
.path { font-size: 0.65rem; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: #1e1e30; color: var(--sub); flex-shrink: 0; }
.path.lan, .path.wan, .path.direct { background: #0a2020; color: var(--success); }
.path.relay { background: #1a1a0a; color: var(--warn); }

.stop-btn, .exit-btn {
  width: 100%; margin-top: 16px; padding: 12px; color: #fff; border: none; border-radius: 10px;
  font-size: 0.9rem; font-weight: 700; cursor: pointer; transition: opacity 0.2s;
}
.stop-btn { background: var(--gradient); }
.exit-btn { background: var(--danger); margin-top: 14px; }
.stop-btn:hover, .exit-btn:hover { opacity: 0.85; }

/* 받기 */
.code-input-wrap { display: flex; gap: 8px; }
.code-input {
  flex: 1; min-width: 0; padding: 14px 12px; background: var(--inputBg);
  border: 2px solid var(--border); border-radius: 12px; color: #fff;
  font-size: 1.1rem; font-weight: 700; letter-spacing: 3px; text-align: center; outline: none;
}
.code-input:focus { border-color: var(--accent1); }
.code-input::placeholder { letter-spacing: 2px; font-weight: 400; color: #444; }
.join-btn {
  padding: 14px 24px; background: var(--gradient); color: #fff; border: none;
  border-radius: 12px; font-size: 1rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.join-btn:hover { opacity: 0.9; }

.recv-complete { margin-top: 16px; }
.recv-complete:empty { display: none; }
.download-item {
  display: flex; align-items: center; padding: 10px 12px; background: var(--inputBg);
  border-radius: 8px; margin-bottom: 6px; font-size: 0.85rem;
}
.download-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 8px; }
.download-item .meta { color: var(--sub); font-size: 0.8rem; text-align: right; margin-right: 8px; white-space: nowrap; flex-shrink: 0; }
.dl-btn {
  padding: 8px 14px; background: var(--gradient); color: #fff; border: none; border-radius: 6px;
  font-size: 0.8rem; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
  width: 72px; text-align: center; flex-shrink: 0;
}
.dl-btn:hover { opacity: 0.9; }

.received-text { margin-bottom: 8px; background: var(--inputBg); border-radius: 12px; padding: 20px; }
.received-text .badge { font-size: 0.8rem; padding: 4px 12px; border-radius: 6px; margin-bottom: 12px; }
.received-text-content {
  background: var(--bg); border-radius: 8px; padding: 14px; white-space: pre-wrap;
  word-break: break-all; font-size: 0.95rem; line-height: 1.6; max-height: 300px; overflow-y: auto;
}
.received-text-content a { color: var(--accent2); }
.text-copy-btn {
  margin-top: 10px; width: 100%; padding: 10px; background: #1e1e30; color: #ccc;
  border: 1px solid #333; border-radius: 8px; cursor: pointer; font-size: 0.9rem;
}
.text-copy-btn:hover { background: #2a2a40; }

.seed-note {
  margin-top: 12px; padding: 12px; border-radius: 8px; font-size: 0.85rem; text-align: center;
  background: #0a2020; border: 1px solid #0f3a36; color: var(--accent2);
}

/* TACK 추가 기능 표시 — 원본 토큰만 쓴다 */
.feature-section { margin-top: 20px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.feature-title { font-size: 0.85rem; font-weight: 700; color: var(--sub); margin-bottom: 10px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.feature { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; padding: 10px 12px; background: var(--inputBg); border: 1px solid var(--border); border-radius: 10px; }
.feature span { grid-row: span 2; font-size: 1.3rem; }
.feature b { font-size: 0.8rem; }
.feature small { font-size: 0.7rem; color: var(--sub); }
.share-toggle-sub { margin-top: 2px; font-size: 0.65rem; color: var(--accent2); }
.hl { color: var(--accent2) !important; font-weight: 700 !important; }
.empty-row { padding: 10px 12px; font-size: 0.8rem; color: #555; text-align: center; background: var(--inputBg); border-radius: 8px; }
.send-file-row.left { opacity: 0.45; }
.share-bar { flex: 0 0 60px; height: 6px; background: #1a1a2e; border-radius: 6px; overflow: hidden; }
.share-bar i { display: block; height: 100%; background: var(--gradient); border-radius: 6px; transition: width 0.3s; }
.net-info { margin-top: 14px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 8px; font-size: 0.72rem; color: var(--sub); text-align: left; line-height: 1.8; }
.net-info:empty { display: none; }
.net-info b { color: var(--text); font-weight: 600; }
.net-info .ok { color: var(--success); }
.net-info .off { color: #555; }

/* 모달 공통 (<dialog>) */
dialog { margin: auto; color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); }
.modal {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; width: calc(100% - 32px); max-width: 440px;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--sub); font-size: 1.5rem; cursor: pointer; padding: 0 4px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-textarea {
  width: 100%; min-height: 150px; padding: 14px; background: var(--inputBg);
  border: 2px solid var(--border); border-radius: 12px; color: var(--text); font-size: 0.95rem;
  resize: vertical; outline: none; transition: border-color 0.2s;
}
.modal-textarea:focus { border-color: var(--accent1); }
.modal-textarea::placeholder { color: #444; }
.modal-hint { margin-top: 6px; font-size: 0.75rem; color: #444; text-align: right; }
.modal-submit {
  width: 100%; padding: 12px; margin-top: 14px; background: var(--gradient);
  color: #fff; border: none; border-radius: 12px; font-size: 1rem; font-weight: 700; cursor: pointer;
}

/* 보안 경고 */
.security-modal {
  width: min(420px, 90vw); background: var(--card); border-radius: 16px; overflow: hidden;
  border: 2px solid #e17055; box-shadow: 0 8px 40px rgba(225, 112, 85, 0.3);
}
.security-header {
  padding: 16px; text-align: center; font-size: 1.1rem; font-weight: 700;
  background: rgba(225, 112, 85, 0.15); border-bottom: 1px solid var(--border);
}
.security-list { padding: 4px 16px 12px; }
.security-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.82rem; }
.security-item:last-child { border-bottom: none; }
.security-item .file { color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.security-actions { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.security-btn { flex: 1; padding: 10px; border: none; border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer; color: #fff; }
.security-btn.cancel { background: #636e72; }
.security-btn.proceed { background: #e17055; }
.security-btn:hover { opacity: 0.9; }

/* AI 인라인 채팅 */
.ai-inline { margin-top: 16px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--card); text-align: left; }
.ai-inline-header {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 0.85rem; font-weight: 700;
  background: rgba(108, 92, 231, 0.1); border-bottom: 1px solid var(--border);
}
.ai-inline-file { flex: 1; font-size: 0.7rem; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.ai-inline-body { max-height: 250px; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.ai-inline-body:empty::after { content: 'PDF 에 대해 질문해 보세요!'; color: var(--sub); font-size: 0.8rem; text-align: center; padding: 16px 0; }
.ai-inline-input-wrap { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); }
.ai-inline-note { padding: 0 12px 10px; font-size: 0.7rem; color: #555; }
.ai-msg { max-width: 88%; padding: 10px 14px; border-radius: 12px; font-size: 0.85rem; line-height: 1.6; word-break: break-word; white-space: pre-wrap; }
.ai-msg.user { align-self: flex-end; background: var(--gradient); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.bot { align-self: flex-start; background: var(--inputBg); color: var(--text); border-bottom-left-radius: 4px; }
.ai-chat-input {
  flex: 1; min-width: 0; background: var(--inputBg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; color: var(--text); font-size: 0.85rem; outline: none;
}
.ai-chat-input:focus { border-color: var(--accent1); }
.ai-chat-send {
  background: var(--gradient); border: none; color: #fff; padding: 10px 18px;
  border-radius: 8px; font-weight: 600; font-size: 0.85rem; cursor: pointer; white-space: nowrap;
}
.ai-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

.footer { margin-top: auto; padding: 20px; text-align: center; color: #888; font-size: 0.8rem; }
.footer-brand { font-weight: 700; }

@media (max-width: 480px) {
  .header h1 { font-size: 1.8rem; }
  .header { padding: 24px 16px 8px; }
  .container { padding: 12px; }
  .card { padding: 18px 14px; }
  .status-modal { padding: 20px 12px; }
  .status-code { font-size: 1.8rem; letter-spacing: 4px; }
  .code-input { font-size: 1rem; letter-spacing: 2px; padding: 12px 10px; }
  .join-btn { padding: 12px 16px; font-size: 0.9rem; }
  .mode-card { padding: 24px 12px; }
  .mode-title { font-size: 1.1rem; }
  .mode-icon { font-size: 2.4rem; }
  .circle-wrap { width: 120px; height: 120px; }
  .circle-percent { font-size: 1.6rem; }
}
