:root {
  --color-bg: #f1f7f8;
  --color-surface: #ffffff;
  --color-surface-muted: #eef8f8;
  --color-border: #d9ecec;
  --color-border-strong: #bdd7d8;
  --color-text: #111827;
  --color-muted: #66756f;
  --color-subtle: #8a9792;
  --color-cognizant-navy: #000048;
  --color-cognizant-teal: #248d95;
  --color-cognizant-light-blue: #82c7de;
  --color-accent: var(--color-cognizant-navy);
  --color-accent-hover: var(--color-cognizant-navy);
  --color-accent-soft: #e6f4f3;
  --color-warning-soft: #f5efe3;
  --shadow-panel: 0 18px 48px rgba(27, 45, 39, 0.08);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --space-page: 32px;
  --space-panel: 24px;
  --font-sans: "Segoe UI", "Noto Sans JP", "Hiragino Sans", Meiryo, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background:
    radial-gradient(circle at 8% -12%, rgba(130, 199, 222, 0.38), transparent 26%),
    radial-gradient(circle at 90% 0%, rgba(36, 141, 149, 0.18), transparent 24%),
    linear-gradient(180deg, #f7fcfd 0%, var(--color-bg) 50%, #e7f4f5 100%);
  color: var(--color-text);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 28px var(--space-page) var(--space-page);
}

.brand-line {
  max-width: 1480px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--color-cognizant-navy), var(--color-cognizant-teal));
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  max-width: 1480px;
  margin: 0 auto 22px;
  padding: 22px 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-cognizant-navy) 0%, #08106f 54%, #0f6f7a 100%);
  box-shadow: 0 20px 48px rgba(0, 0, 72, 0.18);
}

.brand-area {
  display: grid;
  gap: 7px;
}

.brand-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 800;
}

.brand-logo {
  display: block;
  width: 148px;
  height: auto;
  object-fit: contain;
}

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  gap: 24px;
  max-width: 1480px;
  margin: 0 auto;
  align-items: start;
}

.panel {
  background: linear-gradient(180deg, #ffffff 0%, #f8fdfd 100%);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-cognizant-teal);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
}

.form-panel {
  position: sticky;
  top: 24px;
  padding: var(--space-panel);
}

.result-panel {
  min-width: 0;
  padding: var(--space-panel);
}

.panel-heading {
  display: grid;
  gap: 6px;
  margin-bottom: 20px;
}

.panel-heading p,
.lead {
  margin: 0;
  color: var(--color-muted);
  line-height: 1.65;
}

.app-header .lead {
  color: rgba(255, 255, 255, 0.82);
}

.eyebrow {
  margin: 0;
  color: var(--color-cognizant-teal);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.app-header .eyebrow {
  color: var(--color-cognizant-light-blue);
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.05;
}

.app-header h1 {
  color: #fff;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
}

h3 {
  font-size: 18px;
  line-height: 1.3;
}

.account-area {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: min(360px, 100%);
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.auth-row,
.download-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.auth-user {
  color: rgba(255, 255, 255, 0.76);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 700;
}

.status-chip.ready {
  background: rgba(130, 199, 222, 0.22);
  color: #fff;
}

form {
  display: grid;
  gap: 18px;
}

.field-block {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 14px 0 18px;
  border: 0;
  border-bottom: 1px solid var(--color-border);
}

.field-block:last-of-type {
  border-bottom: 0;
}

.field-block legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin-bottom: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eefafa;
  color: var(--color-cognizant-navy);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.field-block legend::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 999px;
}

.field-block.required legend {
  border: 1px solid rgba(0, 0, 72, 0.16);
}

.field-block.required legend::before {
  background: var(--color-cognizant-navy);
}

.field-block.optional legend {
  border: 1px solid rgba(36, 141, 149, 0.2);
}

.field-block.optional legend::before {
  background: var(--color-cognizant-teal);
}

label {
  display: grid;
  gap: 7px;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 700;
}

.label-with-help {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.help-trigger {
  display: inline-flex;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  min-height: 18px;
  min-width: 18px;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.65;
}

input::placeholder,
textarea::placeholder {
  color: var(--color-subtle);
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aab8b2;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
summary:focus-visible {
  border-color: var(--color-cognizant-teal);
  box-shadow: 0 0 0 3px rgba(36, 141, 149, 0.16);
}

.date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 800;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.primary {
  width: 100%;
  min-height: 46px;
  background: var(--color-cognizant-navy);
  color: #fff;
}

.primary:hover:not(:disabled) {
  background: #07076f;
}

.secondary,
.ghost-button {
  background: var(--color-surface);
  border-color: var(--color-border-strong);
  color: var(--color-cognizant-navy);
}

.secondary:hover:not(:disabled),
.ghost-button:hover:not(:disabled) {
  background: var(--color-accent-soft);
  border-color: #b9c8c2;
}

.app-header .ghost-button {
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.app-header .ghost-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.62);
}

.text-button {
  min-height: 34px;
  padding: 6px 4px;
  background: transparent;
  color: var(--color-muted);
}

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 6px 0 16px;
}

.metric-item {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff 0%, #effafa 100%);
}

.metric-item span,
.meta-label {
  display: block;
  margin-bottom: 4px;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-item strong {
  display: block;
  overflow: hidden;
  color: var(--color-text);
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-card {
  margin: 0 0 16px;
  padding: 15px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #f9fefe;
  color: var(--color-muted);
  line-height: 1.7;
}

.progress-card {
  display: grid;
  gap: 14px;
}

.progress-meta {
  display: grid;
  grid-template-columns: 0.9fr 1.4fr 0.9fr;
  gap: 12px;
}

.progress-meta strong,
.progress-meta div div {
  color: var(--color-text);
  font-weight: 800;
}

#progress-section-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#progress-section-list li {
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.55;
}

.result-stack {
  display: grid;
  gap: 18px;
}

.result-section {
  display: grid;
  gap: 12px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding-top: 8px;
}

.section-heading p {
  margin: 0;
  color: var(--color-muted);
  font-size: 13px;
}

.markdown-preview {
  min-height: 420px;
  max-height: min(72vh, 860px);
  margin: 0;
  padding: clamp(24px, 3vw, 38px);
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: #202a26;
  line-height: 1.78;
  scroll-behavior: smooth;
}

.markdown-preview > :first-child {
  margin-top: 0;
}

.markdown-preview > :last-child {
  margin-bottom: 0;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4 {
  color: var(--color-text);
  line-height: 1.35;
  letter-spacing: -0.025em;
}

.markdown-preview h1 {
  margin: 0 0 1.1em;
  padding-bottom: 0.55em;
  border-bottom: 1px solid var(--color-border);
  font-size: clamp(26px, 3vw, 40px);
}

.markdown-preview h2 {
  margin: 1.8em 0 0.7em;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--color-border);
  font-size: 1.45rem;
}

.markdown-preview h3 {
  margin: 1.45em 0 0.55em;
  font-size: 1.12rem;
}

.markdown-preview h4 {
  margin: 1.2em 0 0.4em;
  font-size: 1rem;
}

.markdown-preview p,
.markdown-preview ul,
.markdown-preview ol,
.markdown-preview table,
.markdown-preview blockquote {
  margin: 0.85em 0;
}

.markdown-preview ul,
.markdown-preview ol {
  padding-left: 1.35em;
}

.markdown-preview li + li {
  margin-top: 0.42em;
}

.markdown-preview a {
  color: #1e728c;
  font-weight: 700;
  text-decoration: none;
}

.markdown-preview a:hover {
  text-decoration: underline;
}

.markdown-preview code {
  padding: 0.14em 0.38em;
  border-radius: 6px;
  background: var(--color-surface-muted);
  color: #6c3f11;
  font-family: var(--font-mono);
  font-size: 0.93em;
}

.markdown-preview pre {
  margin: 1em 0;
  padding: 14px;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  background: #15221e;
  color: #e9f2ef;
}

.markdown-preview pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.markdown-preview table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.markdown-preview th,
.markdown-preview td {
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  vertical-align: top;
}

.markdown-preview th {
  background: var(--color-surface-muted);
  text-align: left;
}

.markdown-preview blockquote {
  padding-left: 14px;
  border-left: 3px solid var(--color-cognizant-teal);
  color: var(--color-muted);
}

.result-details {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.result-details summary {
  padding: 14px 16px;
  cursor: pointer;
  color: var(--color-cognizant-navy);
  font-weight: 800;
  list-style: none;
  user-select: none;
}

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

.result-details summary::after {
  content: "+";
  float: right;
  color: var(--color-muted);
}

.result-details[open] summary::after {
  content: "-";
}

pre#result {
  min-height: 180px;
  max-height: 420px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  border-top: 1px solid var(--color-border);
  background: #111c18;
  color: #e8f3ef;
  white-space: pre-wrap;
  word-break: break-word;
}

#help-tooltip,
.help-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: 360px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  background: #17241f;
  color: #f3faf7;
  box-shadow: 0 14px 28px rgba(17, 24, 39, 0.18);
  font-size: 13px;
  line-height: 1.6;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .form-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 18px;
  }

  .app-header,
  .result-header,
  .section-heading {
    display: grid;
  }

  .account-area {
    justify-items: start;
  }

  .auth-row,
  .download-row {
    justify-content: flex-start;
  }

  .date-grid,
  .metric-strip,
  .progress-meta {
    grid-template-columns: 1fr;
  }

  .panel {
    border-radius: 18px;
  }
}
