:root {
  --bg: #ffffff;
  --fg: #111111;
  --sub: #666666;
  --border: #e5e5e5;
  --accent: #111111;
  --accent-soft: #f5f5f5;
  --font: -apple-system, BlinkMacSystemFont, system-ui, -system-ui, "Segoe UI", sans-serif;
  --radius: 14px;
  --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.04);
}

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

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  line-height: 1.8;
}

/* ===== 共通レイアウト ===== */
.nw-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}

.nw-header {
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.nw-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 16px 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.nw-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 600;
}
.nw-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--sub);
}
.nw-label {
  padding: 4px 8px;
  font-size: 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--sub);
  align-self: flex-start;
}

/* ===== 共通広告枠 ===== */
.ad-slot {
  margin: 12px 0 16px;
  padding: 8px;
  border: 1px dashed #d4d4d4;
  font-size: 11px;
  color: #9ca3af;
  text-align: center;
  min-height: 60px;
  border-radius: var(--radius);
}
.ad-top { margin-top: 4px; }
.ad-bottom { margin-bottom: 8px; }
.ad-inline { margin: 24px 0; }

/* ===== パネル ===== */
.panel {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  margin-bottom: 14px;
}
.panel-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
}
.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.count {
  font-size: 11px;
  color: var(--sub);
}

/* ===== 操作UI ===== */
.controls {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1.1fr);
  gap: 10px 14px;
  align-items: flex-end;
}
.control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
}
.control-group label,
.label-inline { color: var(--sub); }

input[type="text"], select {
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type="text"]:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(0,0,0,.04);
}

.quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.quick-buttons button {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  font-size: 10px;
  cursor: pointer;
  color: var(--sub);
}
.quick-buttons button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.helper-text {
  margin: 8px 0 0;
  font-size: 10px;
  color: var(--sub);
}

/* ===== カード表示 ===== */
.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}
.card {
  border-radius: 10px;
  padding: 9px 9px 8px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
}

/* app.js が使うタイトル用 */
.card-title {
  font-weight: 600;
  font-size: 12px;
}

/* 旧構成互換（使っていなくてもOK） */
.card-header {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  align-items: baseline;
}
.card-brand {
  font-weight: 600;
  font-size: 12px;
}

.card-category,
.card-country {
  font-size: 9px;
  color: var(--sub);
}

.card-note {
  font-size: 10px;
  color: var(--sub);
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.card-links a {
  font-size: 9px;
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--accent);
  background: #fafafa;
}
.card-links a:hover {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
}
.tag-official {
  font-size: 8px;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--sub);
}

.empty-message {
  margin-top: 4px;
  font-size: 10px;
  color: var(--sub);
}

.panel-note { font-size: 10px; }
.note-list {
  padding-left: 16px;
  margin: 4px 0 0;
}

/* ===== 寄付導線（共通仕様 6章） ===== */
.nw-donate {
  text-align: center;
  margin: 16px 0 8px;
  padding: 8px 0;
  font-size: 12px;
  color: #6b7280;
}
.nw-donate-text {
  margin: 4px 0;
  font-size: 12px;
}
.nw-donate-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.nw-donate-links a {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  font-size: 13px;
  color: #111827;
  text-decoration: none;
  transition: all 0.2s ease;
}
.nw-donate-links a:hover {
  background: #f9fafb;
  transform: translateY(-1px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ===== 言語切替UI（共通仕様 7章） ===== */
.nw-lang-switch {
  text-align: center;
  margin: 4px 0 8px;
  font-size: 11px;
  color: #6b7280;
}
.nw-lang-switch button {
  border: none;
  background: transparent;
  padding: 0 2px;
  cursor: pointer;
  font-size: 11px;
  color: #4b5563;
}
.nw-lang-switch button.active {
  font-weight: 600;
  text-decoration: underline;
}

/* ===== 関連リンクブロック ===== */
.nw-links {
  margin: 12px 0 4px;
  text-align: center;
  font-size: 11px;
  color: #6b7280;
}
.nw-links a {
  color: #4b5563;
  text-decoration: underline;
  margin: 0 4px;
}

/* ===== フッター（共通仕様） ===== */
.nw-footer {
  margin-top: 24px;
  padding: 16px 8px 12px;
  border-top: 1px solid #e5e7eb;
  font-size: 11px;
  color: #6b7280;
  text-align: center;
  line-height: 1.6;
}
.nw-footer-line { margin: 2px 0; }
.nw-footer a { color: #6b7280; text-decoration: underline; }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .nw-header-inner { flex-direction: column; gap: 6px; }
  .controls { grid-template-columns: 1fr; }
}
