:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e2e6ef;
  --text: #1f2733;
  --muted: #6b7587;
  --primary: #2f6df6;
  --primary-dark: #1f57d6;
  --danger: #d64545;
  --ok: #2faa6a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
    "Yu Gothic", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.header {
  background: linear-gradient(135deg, #2f6df6, #6b3df6);
  color: #fff;
  padding: 32px 20px;
  text-align: center;
}

.header h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.subtitle {
  margin: 0;
  opacity: 0.92;
  font-size: 14px;
}

/* 本文＋右サイド広告のレイアウト */
.layout {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: center;
  padding: 0 16px;
}

.container {
  flex: 1 1 820px;
  min-width: 0;
  max-width: 820px;
  padding: 24px 0 40px;
}

/* ヘッダーナビ */
.nav {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
}

.nav a {
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  opacity: 0.92;
  border-bottom: 1px solid transparent;
}

.nav a:hover {
  border-bottom-color: rgba(255, 255, 255, 0.7);
}

/* ランディングの紹介・独自コンテンツ */
.intro p {
  margin: 0;
  font-size: 14px;
}

.about h3 {
  margin: 16px 0 8px;
  font-size: 15px;
  color: var(--text);
}

.about ul {
  margin: 0 0 12px;
  padding-left: 20px;
}

.about li {
  margin-bottom: 6px;
}

/* 法務ページの本文リスト */
.legal .card ol {
  margin: 0;
  padding-left: 22px;
}

.legal .card ol li {
  margin-bottom: 10px;
}

.contact {
  background: #f0f5ff;
  border: 1px solid #d6e2ff;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
}

/* サイドバー広告（常時表示・PCのみ追従） */
.ad-rail {
  width: 300px;
  flex-shrink: 0;
  padding-top: 24px;
  position: sticky;
  top: 16px;
}

.ad-sidebar {
  min-height: 600px;
}

/* 下部バナー広告（常時表示・画面幅いっぱい） */
.ad-banner-wrap {
  display: block;
  padding: 12px 16px;
  background: #eef1f7;
  border-top: 1px solid var(--border);
}

.ad-banner {
  width: 100%;
  max-width: none;
  min-height: 90px;
}

/* 広告プレースホルダ共通 */
.ad-placeholder {
  height: 100%;
  min-height: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px dashed #b8c1d6;
  border-radius: 10px;
  background: repeating-linear-gradient(
    45deg,
    #f7f9fd,
    #f7f9fd 12px,
    #eef2f9 12px,
    #eef2f9 24px
  );
  color: #8a94a8;
  text-align: center;
  padding: 16px;
}

.ad-sidebar .ad-placeholder {
  min-height: 600px;
}

.ad-banner .ad-placeholder {
  min-height: 90px;
}

.ad-tag {
  font-size: 11px;
  letter-spacing: 0.04em;
  background: #d8deea;
  color: #5a647a;
  border-radius: 4px;
  padding: 2px 8px;
}

.ad-label {
  font-size: 13px;
  font-weight: 600;
}

.ad-size {
  font-size: 11px;
}

/* 入場時モーダル広告 */
.ad-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 26, 40, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.ad-modal {
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(15, 25, 50, 0.35);
}

.entry-ad-slot {
  min-height: 280px;
  margin-bottom: 12px;
}

.entry-ad-slot .ad-placeholder {
  min-height: 280px;
}

.ad-countdown {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.ad-close-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 14px;
  cursor: pointer;
}

.ad-close-btn:disabled {
  background: #b9c4d8;
  cursor: not-allowed;
}

/* レスポンシブ：狭い画面では右サイド広告を本文の下へ回す */
@media (max-width: 960px) {
  .layout {
    flex-direction: column;
    align-items: stretch;
  }

  .ad-rail {
    position: static;
    width: 100%;
    padding-top: 0;
  }

  .ad-sidebar,
  .ad-sidebar .ad-placeholder {
    min-height: 120px;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(20, 30, 60, 0.04);
}

.card h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.card h3 {
  margin: 16px 0 8px;
  font-size: 14px;
  color: var(--muted);
}

.hint {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
}

/* URL入力 */
.url-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.url-row {
  display: flex;
  gap: 8px;
}

.url-row input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.url-row input:focus {
  outline: none;
  border-color: var(--primary);
}

.url-name {
  max-width: 150px;
}

.remove-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--danger);
  border-radius: 8px;
  width: 40px;
  cursor: pointer;
  font-size: 16px;
}

.remove-btn:hover {
  background: #fff1f1;
}

/* デバイス */
.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}

.device-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.device-grid label:hover {
  border-color: var(--primary);
}

.custom-size-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.custom-size-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.custom-size-row input[type="number"] {
  width: 90px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.custom-size-row input[type="text"] {
  flex: 1;
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.custom-size-row .check {
  white-space: nowrap;
}

/* オプション */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

/* 免責事項 */
.disclaimer-box {
  background: #fff8f0;
  border: 1px solid #f0d8b8;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13px;
  color: #5a4a32;
}

.disclaimer-box p {
  margin: 0 0 10px;
}

.disclaimer-box p:last-child {
  margin-bottom: 0;
}

.agree {
  margin-top: 14px;
  font-weight: 600;
}

/* ボタン */
.action {
  text-align: center;
  margin: 28px 0;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px 36px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

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

.btn-primary:disabled {
  background: #b9c4d8;
  cursor: not-allowed;
}

.btn-secondary {
  background: #fff;
  color: var(--primary);
  border: 1px dashed var(--primary);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #f0f5ff;
}

/* 進捗 */
.progress-bar {
  height: 14px;
  background: #e6eaf2;
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2f6df6, #6b3df6);
  transition: width 0.3s;
}

.progress-text {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--muted);
}

.result-actions {
  text-align: center;
  margin-bottom: 14px;
}

.log {
  background: #1d2330;
  color: #c7d2e4;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12px;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.footer {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

/* 法務ページ */
.legal {
  margin: 0 auto;
  max-width: 820px;
}

.legal-note {
  background: #fff8f0;
  border: 1px solid #f0d8b8;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: #5a4a32;
  margin: 24px 0;
}

.legal .card ul {
  margin: 0;
  padding-left: 20px;
}

.legal .card li {
  margin-bottom: 6px;
}

.back-link {
  text-align: center;
  margin: 24px 0 60px;
}

/* Cookie同意バナー */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: 720px;
  margin: 0 auto;
  background: #1d2330;
  color: #e7ecf5;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  z-index: 90;
  box-shadow: 0 10px 30px rgba(10, 16, 30, 0.4);
}

.cookie-text {
  flex: 1;
  min-width: 220px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.cookie-text a {
  color: #8fb6ff;
}

.cookie-actions {
  display: flex;
  gap: 8px;
}

.cookie-actions .btn-secondary {
  background: transparent;
  color: #c7d2e4;
  border-color: #46506a;
}

.cookie-actions .btn-primary {
  padding: 8px 18px;
  font-size: 14px;
}
