﻿:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f9fafc;
  --border: #e4e8ef;
  --text: #18202f;
  --muted: #687386;
  --primary: #635bff;
  --primary-dark: #5048df;
  --primary-light: #efeeff;
  --success: #16845b;
  --success-light: #e8f7f0;
  --danger: #d14343;
  --danger-light: #fff0f0;
  --warning: #a96d00;
  --warning-light: #fff7df;
  --code-bg: #171a21;
  --code-text: #e8ecf3;
  --shadow: 0 8px 30px rgba(26, 36, 56, 0.07);
  --radius: 16px;
}


* {
  box-sizing: border-box;
}


html {
  scroll-behavior: smooth;
}


body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Hiragino Kaku Gothic ProN",
    "Hiragino Sans",
    "Yu Gothic",
    Meiryo,
    sans-serif;
  line-height: 1.6;
}


button,
input {
  font: inherit;
}


button {
  cursor: pointer;
}


.hidden {
  display: none !important;
}




/* =========================
   共通
========================= */


.screen {
  min-height: 100vh;
}


.app-screen {
  max-width: 1440px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}


.button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  padding: 0 18px;
  font-weight: 700;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}


.button:hover {
  transform: translateY(-1px);
}


.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}


.primary-button {
  background: var(--primary);
  color: white;
  box-shadow: 0 5px 14px rgba(99, 91, 255, 0.2);
}


.primary-button:hover {
  background: var(--primary-dark);
}


.secondary-button {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
}


.secondary-button:hover {
  background: var(--surface-soft);
}


.message {
  padding: 13px 16px;
  border-radius: 10px;
  margin: 16px 0;
  font-size: 14px;
}


.message.error {
  color: var(--danger);
  background: var(--danger-light);
  border: 1px solid #ffd4d4;
}


.message.success {
  color: var(--success);
  background: var(--success-light);
  border: 1px solid #c9eddd;
}


.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}


.count-label {
  color: var(--muted);
  font-size: 13px;
}




/* =========================
   ログイン
========================= */


#login-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px 16px;
  background:
    radial-gradient(circle at top left, #eeedff 0, transparent 35%),
    var(--bg);
}


.auth-card {
  width: 100%;
  max-width: 460px;
  padding: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}


.logo-area {
  text-align: center;
  margin-bottom: 30px;
}


.logo-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--primary);
  color: white;
  font-size: 20px;
  font-weight: 900;
}


.logo-area h1 {
  margin: 0;
  font-size: 26px;
}


.logo-area p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}


.google-button {
  width: 100%;
  background: white;
  color: #202124;
  border: 1px solid #d9dce1;
}


.google-button:hover {
  background: #f8f9fa;
}


.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 24px 0;
  color: var(--muted);
  font-size: 12px;
}


.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}


.form-group {
  margin-bottom: 18px;
}


.form-group label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 700;
}


.form-group input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  background: white;
}


.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.1);
}


.auth-buttons {
  display: grid;
  gap: 10px;
}


.auth-note {
  margin: 22px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}




/* =========================
   ヘッダー
========================= */


.app-header {
  background: white;
  border-bottom: 1px solid var(--border);
}


.header-inner {
  max-width: 1440px;
  height: 68px;
  padding: 0 32px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}


.header-logo {
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-weight: 800;
}


.small-logo {
  width: 31px;
  height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 900;
}


.header-user {
  display: flex;
  align-items: center;
  gap: 14px;
}


.user-name {
  color: var(--muted);
  font-size: 13px;
}


.logout-button {
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
}




/* =========================
   ホーム
========================= */


.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 42px;
}


.page-heading h1 {
  margin: 6px 0 6px;
  font-size: 32px;
  letter-spacing: -0.03em;
}


.page-heading p {
  margin: 0;
  color: var(--muted);
}


.projects-section {
  margin-top: 20px;
}


.section-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}


.section-title-row h2 {
  margin: 0;
  font-size: 18px;
}


.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}


.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 3px 15px rgba(26, 36, 56, 0.04);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}


.project-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}


.project-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--primary-light);
  font-size: 21px;
}


.project-card h3 {
  margin: 0 0 5px;
  font-size: 17px;
}


.project-date {
  color: var(--muted);
  font-size: 12px;
}


.progress-area {
  margin-top: 20px;
}


.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  font-size: 12px;
  color: var(--muted);
}


.progress-bar {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 100px;
  background: #edf0f4;
}


.progress-value {
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
}


.project-open-button {
  width: 100%;
  margin-top: 18px;
}


.empty-state {
  text-align: center;
  padding: 70px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}


.empty-icon {
  font-size: 38px;
  margin-bottom: 10px;
}


.empty-state h3 {
  margin: 0 0 7px;
}


.empty-state p {
  max-width: 500px;
  margin: 0 auto 20px;
  color: var(--muted);
  font-size: 14px;
}




/* =========================
   学習画面
========================= */


.learning-heading {
  margin-bottom: 24px;
}


.back-button {
  padding: 0;
  margin-bottom: 20px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}


.learning-title-area {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}


.learning-title-area h1 {
  margin: 5px 0 3px;
  font-size: 28px;
}


.learning-title-area p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}


.learning-actions {
  flex-shrink: 0;
}


.hidden-file-input {
  display: none;
}


.learning-layout {
  min-height: 660px;
  display: grid;
  grid-template-columns: 240px minmax(350px, 1fr) 360px;
  gap: 14px;
}


.file-panel,
.code-panel,
.analysis-panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}


.panel-heading {
  padding: 17px 18px;
  border-bottom: 1px solid var(--border);
}


.panel-heading h2 {
  margin: 0;
  font-size: 14px;
}


.panel-heading span {
  color: var(--muted);
  font-size: 11px;
}


.file-search {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}


.file-search input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  font-size: 12px;
}


.file-search input:focus {
  border-color: var(--primary);
}


.file-list {
  max-height: 570px;
  overflow-y: auto;
  padding: 7px;
}


.file-item {
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}


.file-item:hover {
  background: var(--surface-soft);
}


.file-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
}


.file-icon {
  flex-shrink: 0;
}


.file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}


.empty-files {
  padding: 30px 15px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}


.code-panel {
  display: flex;
  flex-direction: column;
  min-height: 660px;
}


.code-header {
  min-height: 65px;
  padding: 12px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}


.code-label,
.ai-label {
  color: var(--primary);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}


.code-header h2 {
  max-width: 430px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 2px 0 0;
  font-size: 14px;
}


.language-badge {
  padding: 4px 8px;
  background: #f0f2f5;
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
}


.code-content {
  flex: 1;
  margin: 0;
  padding: 20px;
  overflow: auto;
  background: var(--code-bg);
  color: var(--code-text);
  font-family:
    "SFMono-Regular",
    Consolas,
    "Liberation Mono",
    Menlo,
    monospace;
  font-size: 12px;
  line-height: 1.75;
  tab-size: 2;
  white-space: pre;
}


.analysis-panel {
  display: flex;
  flex-direction: column;
}


.analysis-empty {
  flex: 1;
  padding: 50px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}


.analysis-empty-icon {
  font-size: 40px;
  margin-bottom: 14px;
}


.analysis-empty h3 {
  margin: 0 0 8px;
  font-size: 16px;
}


.analysis-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}


#analysis-result {
  overflow-y: auto;
  max-height: 590px;
}


.analysis-section {
  padding: 18px;
  border-bottom: 1px solid var(--border);
}


.analysis-section h3 {
  margin: 0 0 10px;
  font-size: 13px;
}


.analysis-section p {
  margin: 0;
  color: #4c5667;
  font-size: 12px;
  line-height: 1.8;
}


.flow-list,
.learning-steps {
  margin: 0;
  padding-left: 20px;
}


.flow-list li,
.learning-steps li {
  margin-bottom: 8px;
  color: #4c5667;
  font-size: 12px;
}


.point-list,
.risk-list {
  display: grid;
  gap: 8px;
}


.point-item,
.risk-item {
  padding: 10px;
  border-radius: 8px;
  background: var(--warning-light);
  color: #765000;
  font-size: 12px;
}


.risk-item {
  background: var(--danger-light);
  color: #8c3030;
}


.analysis-footer {
  padding: 15px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}


#analysis-date {
  color: var(--muted);
  font-size: 10px;
}


.analysis-footer .button {
  min-height: 35px;
  padding: 0 10px;
  font-size: 11px;
}




/* =========================
   ローディング
========================= */


.analysis-loading {
  position: relative;
  z-index: 10;
  margin-bottom: 14px;
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--primary-light);
  border: 1px solid #dddbff;
  border-radius: 12px;
}


.loading-spinner {
  width: 25px;
  height: 25px;
  flex-shrink: 0;
  border: 3px solid #d9d7ff;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}


.analysis-loading h3 {
  margin: 0;
  font-size: 14px;
}


.analysis-loading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}


@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}




/* =========================
   トースト
========================= */


.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  max-width: 360px;
  padding: 13px 17px;
  border-radius: 10px;
  background: #222735;
  color: white;
  box-shadow: var(--shadow);
  font-size: 13px;
}




/* =========================
   レスポンシブ
========================= */


@media (max-width: 1150px) {
  .learning-layout {
    grid-template-columns: 220px minmax(300px, 1fr);
  }


  .analysis-panel {
    grid-column: 1 / -1;
    min-height: 400px;
  }


  #analysis-result {
    max-height: none;
  }


  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


@media (max-width: 760px) {
  .app-screen {
    padding: 25px 15px 60px;
  }


  .header-inner {
    padding: 0 15px;
  }


  .user-name {
    display: none;
  }


  .page-heading,
  .learning-title-area {
    align-items: stretch;
    flex-direction: column;
  }


  .page-heading h1 {
    font-size: 27px;
  }


  .page-heading .button {
    width: 100%;
  }


  .project-grid {
    grid-template-columns: 1fr;
  }


  .learning-layout {
    grid-template-columns: 1fr;
  }


  .file-panel {
    min-height: 280px;
  }


  .file-list {
    max-height: 260px;
  }


  .code-panel {
    min-height: 500px;
  }


  .analysis-panel {
    grid-column: auto;
  }


  .learning-actions .button {
    width: 100%;
  }


  .auth-card {
    padding: 28px 20px;
  }
}


@media (max-width: 450px) {
  .header-logo span:last-child {
    display: none;
  }


  .code-content {
    font-size: 11px;
    padding: 14px;
  }


  .analysis-loading {
    align-items: flex-start;
  }


  .analysis-loading p {
    display: none;
  }
}