/* ===================================================
   写真補正ツール - style.css
   ライト/ダークモード対応・レスポンシブ
=================================================== */

/* ---------- フォント ---------- */
@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@400;500;700&family=Outfit:wght@400;600;700&display=swap');

/* ---------- カラートークン ---------- */
:root {
  --bg: #f4f1ea;
  --bg-grad-1: #f7f4ed;
  --bg-grad-2: #e9e3d6;
  --surface: #ffffff;
  --surface-2: #f0ece2;
  --text: #2b2622;
  --text-soft: #6f675d;
  --border: #e0d8c8;
  --primary: #c0683a;
  --primary-hover: #a9572d;
  --accent: #2f7d6b;
  --accent-hover: #266655;
  --shadow: 0 10px 30px rgba(60, 50, 35, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
}

[data-theme="dark"] {
  --bg: #16140f;
  --bg-grad-1: #1c1913;
  --bg-grad-2: #100e0a;
  --surface: #221f18;
  --surface-2: #2c281f;
  --text: #f0ebe0;
  --text-soft: #a89e8d;
  --border: #38332a;
  --primary: #e08a55;
  --primary-hover: #ec9866;
  --accent: #46a890;
  --accent-hover: #54bca2;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
}

/* ---------- ベース ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Zen Maru Gothic', 'Outfit', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, var(--bg-grad-1), transparent 55%),
    radial-gradient(circle at 88% 92%, var(--bg-grad-2), transparent 55%),
    var(--bg);
  min-height: 100vh;
  line-height: 1.6;
  transition: background 0.4s ease, color 0.4s ease;
}

/* ---------- ヘッダー ---------- */
.app-header {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 8px;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-mark { color: var(--primary); font-size: 1.5rem; }
.tagline {
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--text-soft);
}

/* テーマ切替 */
.theme-toggle {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  transition: transform 0.2s, background 0.3s;
}
.theme-toggle:hover { transform: rotate(20deg) scale(1.05); }
.theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-sun { display: none; }
[data-theme="dark"] .theme-icon-moon { display: inline; }

/* ---------- レイアウト ---------- */
.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hidden { display: none !important; }

/* ---------- ドロップゾーン ---------- */
.drop-zone {
  margin-top: 14px;
  padding: 56px 24px;
  text-align: center;
  border: 2px dashed var(--border);
  transition: border-color 0.25s, background 0.25s, transform 0.2s;
  cursor: pointer;
}
.drop-zone.dragover {
  border-color: var(--primary);
  background: var(--surface-2);
  transform: scale(1.01);
}
.drop-icon {
  font-size: 2.6rem;
  color: var(--primary);
  margin-bottom: 12px;
}
.drop-title { font-size: 1.2rem; font-weight: 700; }
.drop-sub { color: var(--text-soft); margin: 8px 0; }
.drop-formats { margin-top: 16px; font-size: 0.82rem; color: var(--text-soft); }

/* ---------- ボタン ---------- */
.btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-toggle {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-toggle[aria-pressed="true"] {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ---------- エディタ ---------- */
.editor { margin-top: 14px; display: grid; gap: 16px; }

.preview-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.preview-card { padding: 14px; overflow: hidden; }
.preview-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-soft);
  margin-bottom: 10px;
  text-align: center;
}
.preview-wrap {
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  min-height: 180px;
  overflow: hidden;
}
.preview-wrap img,
.preview-wrap canvas {
  max-width: 100%;
  max-height: 60vh;
  height: auto;
  display: block;
  border-radius: 8px;
}

/* ---------- コントロール ---------- */
.controls { padding: 20px; display: grid; gap: 18px; }
.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.controls-actions { justify-content: flex-start; }
.controls-save { justify-content: flex-end; }

.sliders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
}
.slider-group { display: grid; gap: 6px; }
.slider-group label {
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.val {
  font-family: 'Outfit', monospace;
  font-size: 0.8rem;
  color: var(--primary);
  background: var(--surface-2);
  padding: 1px 8px;
  border-radius: 8px;
  min-width: 38px;
  text-align: center;
}

/* レンジスライダー */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 6px;
  background: var(--surface-2);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 3px solid var(--surface);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  transition: transform 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 3px solid var(--surface);
}

/* ---------- ローディング ---------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 10, 0.55);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  z-index: 100;
}
.loading-overlay .loading-text { color: #fff; margin-top: 14px; font-weight: 700; }
.spinner {
  width: 48px; height: 48px;
  border: 5px solid rgba(255,255,255,0.25);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- フッター ---------- */
.app-footer {
  max-width: 1100px;
  margin: 24px auto 0;
  padding: 18px 20px 40px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-soft);
}

/* ===================================================
   レスポンシブ（スマホ・タブレット）
=================================================== */
@media (max-width: 760px) {
  .logo { font-size: 1.35rem; }
  .preview-area { grid-template-columns: 1fr; }  /* 縦並び */
  .sliders { grid-template-columns: 1fr; }
  .drop-zone { padding: 42px 18px; }
  .preview-wrap img,
  .preview-wrap canvas { max-height: 50vh; }
  .controls-save { justify-content: stretch; }
  .controls-save .btn { flex: 1; }
}

@media (max-width: 420px) {
  .controls-actions .btn { flex: 1; }
}


/* 追加情報・戻るリンク */
.gallery-link {
  margin-right: 12px;
  color: var(--text-soft);
  font-size: 0.85rem;
  text-decoration: underline;
  white-space: nowrap;
}
.gallery-link:hover { color: var(--primary); }
.info-section {
  width: calc(100% - 40px);
  max-width: 1100px;
  margin: 10px auto 24px;
  padding: 20px;
  color: var(--text);
}
.info-section h2 { font-size: 1.1rem; margin-bottom: 10px; }
.info-section p, .info-section li { color: var(--text-soft); line-height: 1.8; }
.info-section ul { margin: 8px 0 0 1.2em; }
@media (max-width: 680px) {
  .header-inner { gap: 10px; flex-wrap: wrap; }
  .gallery-link { order: 3; width: 100%; }
  .info-section {
    width: calc(100% - 28px);
    padding: 18px 16px;
  }
}
