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

:root {
  --bg: #0f1220;
  --bg-card: #1a1f3a;
  --bg-elev: #232a4d;
  --text: #f1f3ff;
  --text-dim: #9ba3c7;
  --accent: #5b8def;
  --accent-2: #8b5bef;
  --success: #4ade80;
  --warning: #fbbf24;
  --border: #2d3760;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  background: linear-gradient(135deg, #0f1220 0%, #1a1142 100%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

header {
  text-align: center;
  margin-bottom: 24px;
}
header h1 {
  font-size: 32px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}
.tagline {
  color: var(--text-dim);
  font-size: 14px;
}

.screen { display: none; }
.screen.active { display: block; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 16px;
}
.card h2 {
  font-size: 20px;
  margin-bottom: 16px;
}

/* 役割選択 */
.role-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
@media (max-width: 480px) {
  .role-buttons { grid-template-columns: 1fr; }
}
.btn-role {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.btn-role:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(91, 141, 239, 0.2);
}
.btn-role .emoji { font-size: 36px; }
.btn-role .label { font-weight: 600; font-size: 16px; }
.btn-role .hint { font-size: 12px; color: var(--text-dim); }

.howto {
  background: rgba(91, 141, 239, 0.08);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 16px;
}
.howto h3 { font-size: 14px; color: var(--accent); margin-bottom: 8px; }
.howto ol { padding-left: 20px; font-size: 14px; line-height: 1.8; color: var(--text-dim); }

/* ステータス */
.status {
  background: var(--bg-elev);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.status::before {
  content: "";
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--warning);
  animation: pulse 1.5s infinite;
}
.status.connected { background: rgba(74, 222, 128, 0.1); }
.status.connected::before { background: var(--success); animation: none; }
.status.error { background: rgba(248, 113, 113, 0.1); }
.status.error::before { background: #f87171; animation: none; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* QRコード */
#qr-container { text-align: center; }
#qrcode {
  background: white;
  padding: 16px;
  border-radius: 12px;
  display: inline-block;
  margin-bottom: 12px;
}
#qrcode canvas { display: block; }
.qr-hint { color: var(--text-dim); font-size: 13px; margin-bottom: 16px; }

.url-box {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.url-box input {
  flex: 1;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: ui-monospace, monospace;
  font-size: 13px;
}
.url-box button {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: white;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.url-box button:hover { background: #4778dc; }

/* ドロップゾーン */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-elev);
  margin-top: 16px;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(91, 141, 239, 0.08);
}
.drop-icon { font-size: 48px; margin-bottom: 12px; }
.drop-zone .sub { font-size: 13px; color: var(--text-dim); margin-top: 4px; }

/* プログレス */
.progress-area { margin-top: 16px; }
.file-info {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 8px;
}
.file-info span:first-child {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}
.file-info span:last-child { color: var(--text-dim); }
.progress-bar {
  height: 12px;
  background: var(--bg-elev);
  border-radius: 6px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0%;
  transition: width 0.2s;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* 完了 */
#receive-done {
  text-align: center;
  padding: 16px;
}
.done-icon { font-size: 64px; margin-bottom: 12px; }
.btn-primary {
  display: inline-block;
  background: var(--success);
  color: #000;
  font-weight: 700;
  padding: 14px 28px;
  border-radius: 10px;
  text-decoration: none;
  margin: 16px 0 8px;
  font-size: 16px;
}
.btn-primary:hover { background: #22c55e; }

#receive-done .sub {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 8px;
}

.btn-back {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.btn-back:hover { color: var(--text); border-color: var(--text-dim); }

footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 32px;
  padding: 16px;
}

.hidden { display: none !important; }
