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

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #ef4444;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --card-bg: #fff;
  --radius: 8px;
  --header-bg: #1a1a2e;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ヘッダー */
header {
  background: var(--header-bg);
  padding: 0 1.5rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}
.logo span { color: #60a5fa; }
.header-right { display: flex; align-items: center; gap: 1rem; }
.header-right a { color: #94a3b8; font-size: .875rem; }
.header-right a:hover { color: #fff; text-decoration: none; }

/* ボタン */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: .5; cursor: default; }

.btn-outline {
  display: inline-block;
  border: 2px solid var(--primary);
  color: var(--primary);
  padding: .5rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  text-align: center;
  background: none;
  cursor: pointer;
}
.btn-outline:hover { background: #eff6ff; text-decoration: none; }

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .875rem;
  padding: .25rem;
}
.btn-text:hover { color: var(--text); }

.btn-copy {
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: .3rem .75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .8rem;
  color: var(--text);
}
.btn-copy:hover { background: #e2e8f0; }

.btn-delete {
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: .3rem .75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .8rem;
}
.btn-delete:hover { background: #fee2e2; color: var(--danger); border-color: #fecaca; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
}
.btn-danger:hover { background: #dc2626; }

/* 認証ページ */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.auth-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,.06);
}
.auth-box .logo {
  display: block;
  text-align: center;
  font-size: 2rem;
  margin-bottom: .5rem;
  color: var(--header-bg);
}
.auth-box .logo span { color: var(--primary); }
.tagline { text-align: center; color: var(--text-muted); font-size: .875rem; margin-bottom: 2rem; }

.auth-box form { display: flex; flex-direction: column; gap: .75rem; }
.auth-box input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .625rem .875rem;
  font-size: 1rem;
  outline: none;
  transition: border-color .15s;
}
.auth-box input:focus { border-color: var(--primary); }
.auth-box .btn-primary { margin-top: .25rem; padding: .75rem; font-size: 1rem; width: 100%; }

.switch-link { text-align: center; font-size: .875rem; color: var(--text-muted); margin-top: 1.25rem; }

.error-msg {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: var(--radius);
  padding: .75rem;
  font-size: .875rem;
  margin-bottom: 1rem;
}
.success-msg {
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  color: #166534;
  border-radius: var(--radius);
  padding: .75rem;
  font-size: .875rem;
  margin-bottom: 1rem;
}

/* バッジ */
.badge-free { font-size: .75rem; background: #f1f5f9; color: var(--text-muted); padding: .25rem .625rem; border-radius: 999px; }
.badge-paid { font-size: .75rem; background: #dbeafe; color: var(--primary); padding: .25rem .625rem; border-radius: 999px; }

/* ダッシュボード */
.dashboard { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

.upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  margin-bottom: 1.5rem;
  background: #fff;
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--primary);
  background: #eff6ff;
}
.upload-inner { display: flex; flex-direction: column; align-items: center; gap: .75rem; color: var(--text-muted); }
.upload-inner svg { color: var(--primary); opacity: .7; }
.upload-note { font-size: .8rem; }

.upload-progress { margin-bottom: 1rem; display: flex; align-items: center; gap: 1rem; }
.progress-bar { flex: 1; height: 6px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress-bar > div { height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s; }

.limit-warn {
  background: #fefce8;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: var(--radius);
  padding: .875rem 1rem;
  font-size: .875rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* APIトークンセクション */
.api-token-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.api-token-section h3 { font-size: .95rem; font-weight: 600; margin-bottom: .75rem; }
.token-row { display: flex; gap: .5rem; align-items: center; }
.token-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .75rem;
  font-size: .8rem;
  font-family: monospace;
  background: #f8fafc;
  color: var(--text-muted);
  outline: none;
}

/* shotsグリッド */
.shots-section h2 { font-size: 1rem; color: var(--text-muted); margin-bottom: 1rem; }

.shots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }

.shot-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow .15s;
}
.shot-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }

.card-thumb { display: block; aspect-ratio: 4/3; overflow: hidden; background: #f8fafc; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }

.card-info { padding: .875rem; }
.card-name { font-weight: 500; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { font-size: .75rem; color: var(--text-muted); margin: .3rem 0 .75rem; }
.card-actions { display: flex; gap: .5rem; }

/* 料金ページ */
.pricing-page {
  max-width: 800px;
  margin: 3rem auto;
  padding: 0 1.5rem;
  text-align: center;
}
.pricing-page h1 { font-size: 2rem; margin-bottom: .75rem; }
.pricing-subtitle { color: var(--text-muted); margin-bottom: 3rem; }

.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  text-align: left;
}

.plan-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  background: #fff;
  position: relative;
}
.plan-card.featured { border-color: var(--primary); border-width: 2px; }

.plan-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: .75rem;
  padding: .25rem .75rem;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.plan-card h2 { font-size: 1.25rem; margin-bottom: .75rem; }
.price { font-size: 2.5rem; font-weight: 700; color: var(--text); margin-bottom: 1.5rem; }
.price span { font-size: 1rem; color: var(--text-muted); font-weight: 400; }

.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .625rem;
  margin-bottom: 1.75rem;
  font-size: .95rem;
  color: var(--text);
}
.plan-features li::before { content: '✓ '; color: var(--primary); font-weight: 700; }

.plan-card .btn-primary,
.plan-card .btn-outline { display: block; width: 100%; text-align: center; padding: .75rem; font-size: 1rem; }

/* アカウントページ */
.account-page {
  max-width: 640px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}
.account-page h1 { font-size: 1.5rem; margin-bottom: 2rem; }

.account-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}
.account-card h2 { font-size: 1rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; font-size: .8rem; margin-bottom: 1.25rem; }
.account-row { display: flex; justify-content: space-between; align-items: center; padding: .625rem 0; border-bottom: 1px solid var(--border); font-size: .95rem; }
.account-row:last-of-type { border-bottom: none; }
.account-row .label { color: var(--text-muted); }

.danger-zone { border-color: #fecaca; }
.danger-zone h2 { color: #991b1b; }

/* viewページ */
.view-page { max-width: 900px; margin: 2rem auto; padding: 0 1.5rem; }
.view-page h1 { font-size: 1.25rem; margin-bottom: 1rem; }
.view-image-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.view-image-wrap img { max-width: 100%; width: auto; height: auto; display: block; margin: 0 auto; }
.view-meta { font-size: .875rem; color: var(--text-muted); display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }
.share-url-row { display: flex; gap: .5rem; margin-top: 1rem; }
.share-url-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .75rem;
  font-size: .875rem;
  background: #f8fafc;
  outline: none;
}

/* トースト通知 */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(2rem);
  background: #1e293b;
  color: #fff;
  padding: .75rem 1.5rem;
  border-radius: 999px;
  font-size: .875rem;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* セクションヘッダー */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.section-header h2 { font-size: 1rem; color: var(--text-muted); margin-bottom: 0; }

/* 空状態 */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}
.empty-state p { margin-bottom: .5rem; }

@media (max-width: 640px) {
  .pricing-grid { grid-template-columns: 1fr; }
  .shots-grid { grid-template-columns: 1fr 1fr; }
  .limit-warn { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .shots-grid { grid-template-columns: 1fr; }
}
