/* ============================================================
   GitHub Copilot VS Code セットアップキット - スタイル
   ============================================================ */

/* --- CSS Variables --- */
:root {
  --color-primary: #0969da;
  --color-primary-hover: #0550ae;
  --color-accent: #8250df;
  --color-accent-light: #c297ff;
  --color-bg: #f6f8fa;
  --color-bg-white: #ffffff;
  --color-text: #1f2328;
  --color-text-secondary: #656d76;
  --color-border: #d0d7de;
  --color-border-light: #e8ebef;
  --color-success: #1a7f37;
  --color-success-bg: #dafbe1;
  --color-warning: #9a6700;
  --color-warning-bg: #fff8c5;
  --color-error: #cf222e;
  --color-error-bg: #ffebe9;
  --color-code-bg: #1b1f24;
  --color-code-text: #e6edf3;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(31, 35, 40, 0.06);
  --shadow-md: 0 3px 6px rgba(31, 35, 40, 0.1);
  --shadow-lg: 0 8px 24px rgba(31, 35, 40, 0.12);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "Cascadia Code", "Noto Sans Mono", Menlo, Consolas, monospace;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* --- Container --- */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Header --- */
header {
  background: linear-gradient(135deg, var(--color-accent), var(--color-primary));
  color: white;
  padding: 48px 0 40px;
  text-align: center;
}

header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

header p {
  font-size: 16px;
  opacity: 0.9;
}

header .badge-version {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 13px;
  margin-top: 12px;
}

/* --- Prerequisites --- */
.prerequisites {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-top: -20px;
  position: relative;
  z-index: 1;
}

.prerequisites summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text-secondary);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.prerequisites summary::before {
  content: "▶";
  font-size: 10px;
  transition: transform 0.2s;
}

.prerequisites[open] summary::before {
  transform: rotate(90deg);
}

.prerequisites .prereq-content {
  padding: 0 20px 16px;
  border-top: 1px solid var(--color-border-light);
}

.prerequisites ul {
  list-style: none;
  padding: 12px 0 0;
}

.prerequisites li {
  padding: 6px 0;
  font-size: 14px;
  color: var(--color-text-secondary);
}

.prerequisites li::before {
  content: "✓ ";
  color: var(--color-success);
  font-weight: 600;
}

.prerequisites a {
  color: var(--color-primary);
  text-decoration: none;
}

.prerequisites a:hover {
  text-decoration: underline;
}

/* --- Sections --- */
main {
  padding: 32px 0 120px;
}

.section {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.section h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-desc {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}

/* --- Badges --- */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
}

.badge.required {
  background: #ddf4ff;
  color: #0550ae;
}

.badge.optional {
  background: #f0f0f0;
  color: #656d76;
}

/* --- MCP Category Toggle --- */
.mcp-category {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.mcp-category[open] {
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

/* Recommended category highlight */
.mcp-category--recommended {
  border-color: var(--color-primary);
  border-width: 1.5px;
}

.mcp-category--recommended > .mcp-category-summary {
  background: linear-gradient(135deg, #f0f7ff, #eef0ff);
}

.mcp-category--recommended > .mcp-category-summary:hover {
  background: linear-gradient(135deg, #e3eefa, #e2e6ff);
}

.mcp-category--recommended > .mcp-category-summary .mcp-category-name {
  color: var(--color-primary);
}

.mcp-category-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  -webkit-user-select: none;
  user-select: none;
  background: var(--color-bg);
  transition: background 0.15s;
}

.mcp-category-summary::-webkit-details-marker {
  display: none;
}

.mcp-category-summary::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 4l4 4-4 4' stroke='%23656d76' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.2s;
}

.mcp-category[open] > .mcp-category-summary::before {
  transform: rotate(90deg);
}

.mcp-category-summary:hover {
  background: #eef2f6;
}

.mcp-category-icon {
  font-size: 18px;
  line-height: 1;
  width: 24px;
  text-align: center;
}

.mcp-category-name {
  font-weight: 600;
  font-size: 15px;
}

.mcp-category-desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-left: auto;
}

.mcp-category-count {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--color-bg-white);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border-light);
  flex-shrink: 0;
  min-width: 56px;
  text-align: center;
  font-weight: 500;
  transition: all 0.2s;
}

.mcp-category-count.has-selection {
  background: #ddf4ff;
  color: var(--color-primary);
  border-color: #80ccff;
  font-weight: 600;
}

.mcp-category-content {
  padding: 16px;
  border-top: 1px solid var(--color-border-light);
  background: var(--color-bg-white);
}

/* --- Checkbox Cards --- */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.checkbox-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.checkbox-card:hover {
  border-color: var(--color-primary);
  background: #f8fafd;
}

.checkbox-card:has(input:checked) {
  border-color: var(--color-primary);
  background: #f0f7ff;
  box-shadow: 0 0 0 1px var(--color-primary);
}

.checkbox-card input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--color-primary);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.checkbox-card-content {
  flex: 1;
  min-width: 0;
}

.checkbox-card-content strong {
  font-size: 14px;
  display: inline;
  margin-right: 6px;
}

.checkbox-card-content p {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.checkbox-card-content .filepath {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 4px;
  display: inline-block;
}

/* --- Select / Dropdown --- */
.instruction-select-wrapper {
  margin-bottom: 12px;
}

.instruction-select-wrapper select,
.setting-select {
  width: 100%;
  max-width: 400px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 14px;
  background: var(--color-bg-white);
  color: var(--color-text);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23656d76' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.instruction-select-wrapper select:focus,
.setting-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.15);
}

/* --- Instruction Preview --- */
.instruction-preview {
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

/* --- Custom Instructions Textarea --- */
.custom-instructions-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
  display: block;
}

.custom-instructions {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  color: var(--color-text);
}

.custom-instructions:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.15);
}

.custom-instructions::placeholder {
  color: var(--color-text-secondary);
  opacity: 0.6;
}

/* --- Settings Rows --- */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border-light);
  gap: 16px;
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-info {
  flex: 1;
}

.setting-info strong {
  font-size: 14px;
  display: block;
}

.setting-info p {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 1px;
}

.setting-select {
  max-width: 200px;
  flex-shrink: 0;
}

/* --- Toggle Switch --- */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--color-border);
  border-radius: 24px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
  background: var(--color-primary);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.3);
}

/* --- Preview Panel --- */
.file-tree {
  margin-bottom: 16px;
}

.file-tree h4 {
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--color-text-secondary);
}

.file-tree ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.file-tree li code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--color-bg);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--color-border-light);
  color: var(--color-text-secondary);
}

.preview-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0;
}

.preview-tab {
  padding: 8px 16px;
  border: none;
  background: none;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.preview-tab:hover {
  color: var(--color-text);
}

.preview-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 500;
}

.preview-content {
  display: none;
}

.preview-content.active {
  display: block;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #2d333b;
  border-radius: var(--radius) var(--radius) 0 0;
  margin-top: 0;
}

.preview-filepath {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #8b949e;
}

.copy-btn {
  background: none;
  border: 1px solid #444c56;
  border-radius: 4px;
  color: #8b949e;
  cursor: pointer;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  transition: color 0.15s, border-color 0.15s;
}

.copy-btn:hover {
  color: #e6edf3;
  border-color: #768390;
}

.copy-btn.copied {
  color: var(--color-success);
  border-color: var(--color-success);
}

.preview-code {
  background: var(--color-code-bg);
  color: var(--color-code-text);
  padding: 16px;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
}

.preview-code code {
  font-family: inherit;
}

.empty-message {
  text-align: center;
  color: var(--color-text-secondary);
  padding: 40px 0;
  font-size: 14px;
}

/* --- Action Bar --- */
.action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--color-border);
  padding: 16px 0;
  z-index: 100;
  box-shadow: 0 -4px 12px rgba(31, 35, 40, 0.08);
}

.action-bar .container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.action-bar-hint {
  font-size: 13px;
  color: var(--color-text-secondary);
  text-align: center;
  width: 100%;
  margin-bottom: 4px;
}

.action-bar-hint strong {
  color: var(--color-text);
}

.action-bar-buttons {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-accent), var(--color-primary));
  color: white;
  border: none;
  padding: 12px 32px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.download-link {
  font-size: 13px;
  color: var(--color-text-secondary);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font-sans);
  padding: 0;
}

.download-link:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* --- Modal / Folder Guide --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  padding: 28px;
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

.modal-body p {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
  line-height: 1.6;
}

.modal-body p strong {
  color: var(--color-text);
}

.modal-example {
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
}

.modal-example-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}

.modal-example code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-text);
}

.modal-notes {
  list-style: none;
  padding: 0;
  margin-bottom: 20px;
}

.modal-notes li {
  font-size: 13px;
  color: var(--color-text-secondary);
  padding: 4px 0 4px 20px;
  position: relative;
}

.modal-notes li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--color-success);
  font-weight: 600;
}

.modal-notes li code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--color-bg);
  padding: 1px 5px;
  border-radius: 3px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-secondary {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover {
  background: var(--color-border-light);
}

/* --- Toast --- */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  max-width: 480px;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s, transform 0.3s;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid #aceebb;
}

.toast-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid #eed270;
}

.toast-error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid #ffcecb;
}

.toast-info {
  background: #ddf4ff;
  color: #0550ae;
  border: 1px solid #80ccff;
}

/* --- Footer --- */
footer {
  background: var(--color-bg-white);
  border-top: 1px solid var(--color-border);
  padding: 24px 0;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-secondary);
}

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

footer a:hover {
  text-decoration: underline;
}

/* --- Responsive --- */
/* --- Optional Group (collapsible) --- */
.optional-group {
  cursor: default;
}

.optional-group-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
}

.optional-group-summary::-webkit-details-marker {
  display: none;
}

.optional-group-summary::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 5l5 5-5 5' stroke='%23656d76' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.2s;
}

.optional-group[open] > .optional-group-summary::before {
  transform: rotate(90deg);
}

.optional-group-summary h2 {
  margin: 0;
  font-size: 18px;
}

.optional-group-hint {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-left: auto;
}

.optional-group-content {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.optional-item {
  padding-top: 20px;
  border-top: 1px solid var(--color-border-light);
}

.optional-item:first-child {
  padding-top: 0;
  border-top: none;
}

.optional-item h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

/* --- Screen Reader Only --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  header {
    padding: 32px 0 28px;
  }

  header h1 {
    font-size: 22px;
  }

  .container {
    padding: 0 16px;
  }

  .section {
    padding: 18px;
  }

  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .setting-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .setting-select {
    max-width: 100%;
    width: 100%;
  }

  .preview-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .action-bar .container {
    flex-direction: column;
    gap: 8px;
  }

  .btn-primary {
    width: 100%;
  }

  .toast {
    left: 16px;
    right: 16px;
    max-width: none;
  }
}
