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

:root {
  --bg:       #f3f5f8;
  --surface:  #ffffff;
  --surface2: #eef1f6;
  --border:   #d8dde8;
  --accent:   #2563eb;
  --accent2:  #1d4ed8;
  --text:     #1e293b;
  --muted:    #64748b;
  --green:    #10b981;
  --yellow:   #f59e0b;
}

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Noto+Sans+JP:wght@400;600;700&display=swap');

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== PAGE SYSTEM ===== */
.page { display: none; }
.page.active { display: block; animation: fadein 0.25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== HOME PAGE ===== */
#page-home {
  padding: 56px 40px;
  max-width: 1100px;
  margin: 0 auto;
}

.home-header {
  margin-bottom: 48px;
}

.home-eyebrow {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-eyebrow::before {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  background: var(--accent);
}

.home-header h1 {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 10px;
}

.home-header h1 span {
  color: var(--accent);
}

.home-header p {
  color: var(--muted);
  font-size: 0.9rem;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 26px 20px 22px;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  position: relative;
  overflow: hidden;
}

.panel-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(37,99,235,0.05) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.2s;
}

.panel-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(37,99,235,0.12);
}

.panel-card:hover::before { opacity: 1; }

.card-icon {
  font-size: 1.9rem;
  margin-bottom: 14px;
  display: block;
  line-height: 1;
}

.card-num {
  font-family: 'Space Mono', monospace;
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.panel-card h3 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.panel-card p {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.5;
}

.card-arrow {
  position: absolute;
  bottom: 14px;
  right: 16px;
  font-size: 0.75rem;
  color: var(--muted);
  transition: color 0.15s, transform 0.15s;
}

.panel-card:hover .card-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* ===== DETAIL PAGE ===== */
#page-detail {
  padding: 28px 36px;
  max-width: 1160px;
  margin: 0 auto;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: 'Space Mono', monospace;
  margin-bottom: 24px;
  transition: color 0.15s;
  background: none;
  border: none;
  font-family: inherit;
  letter-spacing: 0.04em;
}

.back-btn:hover { color: var(--accent); }
.back-btn::before { content: '←'; }

.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.detail-icon { font-size: 1.8rem; }

.detail-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

/* ===== SETTINGS PANEL ===== */
.settings-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 18px;
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.group-label {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  font-family: 'Space Mono', monospace;
}

.radio-group { display: flex; gap: 8px; flex-wrap: wrap; }

.radio-option {
  display: inline-flex;
  flex-direction: column;
  padding: 8px 14px;
  border-radius: 7px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg);
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
  gap: 1px;
}

.radio-option input[type="radio"] { display: none; }

.radio-option:has(input[type="radio"]:checked) {
  border-color: var(--accent);
  background: rgba(37,99,235,0.07);
  color: var(--accent);
}

.radio-hint {
  font-size: 0.65rem;
  color: #64748b;
  line-height: 1.3;
}

.radio-option:has(input[type="radio"]:checked) .radio-hint { color: #60a5fa; }

/* ===== VSCODE PREVIEW ===== */
.vscode-wrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #333;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
  font-family: 'Space Mono', 'Consolas', 'Courier New', monospace;
}

/* Tab bar */
.vs-tabbar {
  background: #252526;
  display: flex;
  align-items: stretch;
  height: 35px;
  border-bottom: 1px solid #1e1e1e;
}

.vs-tab {
  padding: 0 18px;
  font-size: 0.76rem;
  color: #ccc;
  background: #1e1e1e;
  border-top: 1.5px solid var(--accent);
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 130px;
}

.vs-tab-close {
  margin-left: auto;
  color: #555;
  cursor: pointer;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
}

.vs-tab-close:hover { background: #444; color: #ccc; }

/* Activity bar + body */
.vs-layout {
  display: flex;
  height: 490px;
}

.vs-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Activity bar */
.vs-activitybar {
  width: 42px;
  background: #333;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 8px;
  gap: 2px;
  flex-shrink: 0;
  border-right: 1px solid #1e1e1e;
}

.activity-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #ccc;
  border-radius: 4px;
  cursor: default;
  opacity: 0.6;
  transition: opacity 0.1s;
}

.activity-icon.active { opacity: 1; border-left: 2px solid #ccc; border-radius: 0; }
.activity-icon:hover { opacity: 1; }

/* Sidebar (explorer) */
.vs-sidebar {
  background: #252526;
  width: 180px;
  flex-shrink: 0;
  overflow-y: auto;
  border-right: 1px solid #1e1e1e;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 10px 12px 6px;
  font-size: 0.67rem;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-section {
  padding: 5px 8px;
  font-size: 0.76rem;
  color: #eee;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.sidebar-section::before { content: '▾'; font-size: 0.7rem; color: #888; }

.sidebar-file {
  padding: 4px 10px 4px 24px;
  font-size: 0.75rem;
  color: #ccc;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: background 0.1s;
}

.sidebar-file:hover { background: #2a2d2e; }
.sidebar-file.active { background: #094771; color: #fff; }

.file-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

/* Editor */
.vs-editor {
  flex: 1;
  background: #1e1e1e;
  overflow-y: auto;
  padding: 14px 10px 14px 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.vs-editor::-webkit-scrollbar { width: 10px; }
.vs-editor::-webkit-scrollbar-track { background: #1e1e1e; }
.vs-editor::-webkit-scrollbar-thumb { background: #424242; border-radius: 2px; }

.ed-line {
  display: flex;
  align-items: flex-start;
  min-height: 20px;
  line-height: 20px;
}

.ed-line:hover { background: rgba(255,255,255,0.03); }

.ln {
  font-size: 0.72rem;
  color: #4a4a4a;
  text-align: right;
  min-width: 40px;
  padding-right: 18px;
  user-select: none;
  flex-shrink: 0;
  line-height: 20px;
}

.ed-line:hover .ln { color: #888; }

.lc {
  flex: 1;
  font-size: 0.76rem;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 20px;
  padding-right: 14px;
}

/* Syntax colors */
.s-h1 { color: #4fc1ff; font-weight: 700; }
.s-h2 { color: #4ec9b0; font-weight: 700; }
.s-h3 { color: #dcdcaa; font-weight: 700; }
.s-muted { color: #4a4a4a; }
.s-body { color: #d4d4d4; }
.s-bullet { color: #c586c0; }
.s-bullet-text { color: #d4d4d4; }
.s-code-inline { color: #ce9178; background: #2d2d2d; padding: 0 3px; border-radius: 3px; }
.s-code-bg { background: #292929; display: block; width: 100%; padding: 0 4px; border-left: 2px solid #3b82f6; }
.s-code-text { color: #9cdcfe; }
.s-bold { color: #ffd700; font-weight: 700; }
.s-comment { color: #6a9955; }
.s-warn { color: #f59e0b; }
.s-hr { color: #333; }

/* Chat panel */
.vs-chat {
  width: 250px;
  flex-shrink: 0;
  background: #1e1e1e;
  border-left: 1px solid #2d2d2d;
  display: flex;
  flex-direction: column;
}

.chat-header {
  padding: 9px 14px;
  font-size: 0.7rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid #2d2d2d;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-agent-badge {
  font-size: 0.62rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.badge-codex  { background: rgba(99,102,241,0.25); color: #818cf8; }
.badge-claude { background: rgba(251,146,60,0.2);  color: #fb923c; }
.badge-gemini { background: rgba(16,185,129,0.2);  color: #34d399; }

.chat-messages {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  overflow-y: auto;
}

.chat-context {
  font-size: 0.7rem;
  color: #4a4a4a;
  text-align: center;
  font-style: italic;
}

.chat-file-ref {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #252526;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.72rem;
  color: #888;
}

.chat-file-ref .file-icon { color: var(--accent2); }

.bubble-user {
  align-self: flex-end;
  background: #0e639c;
  color: #fff;
  padding: 10px 14px;
  border-radius: 14px 14px 2px 14px;
  font-size: 0.8rem;
  line-height: 1.5;
  max-width: 92%;
  box-shadow: 0 3px 12px rgba(0,0,0,0.35);
}

.chat-input-bar {
  padding: 10px 12px;
  border-top: 1px solid #2d2d2d;
  display: flex;
  gap: 7px;
  align-items: center;
  flex-shrink: 0;
}

.chat-input-fake {
  flex: 1;
  background: #2d2d2d;
  border: 1px solid #3c3c3c;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.72rem;
  color: #3c3c3c;
  font-family: inherit;
}

.chat-send {
  width: 26px; height: 26px;
  background: var(--accent);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #fff;
  flex-shrink: 0;
}

/* ===== COPY BAR ===== */
.copy-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
}

.copy-bar-label {
  font-size: 0.68rem;
  color: var(--muted);
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.copy-btn:hover {
  border-color: var(--accent);
  background: rgba(37,99,235,0.06);
  color: var(--accent);
}

.copy-btn .copy-icon { font-size: 1rem; }

.copy-btn.copied {
  border-color: var(--green);
  background: rgba(16,185,129,0.08);
  color: var(--green);
}
