:root {
  --ink: #121417;
  --muted: #5c6570;
  --line: #cfd6de;
  --line-strong: #121417;
  --surface: rgba(255, 255, 255, 0.58);
  --accent: #d60051;
  --accent-ink: #ffffff;
  --highlight: #d6ff3f;
  --signal: #d60051;
  --ok: #1f8a4c;
  --danger: #c0392b;
  --radius: 2px;
  --font-display: "Syne", "IBM Plex Sans KR", sans-serif;
  --font-body: "IBM Plex Sans KR", "Apple SD Gothic Neo", sans-serif;
  color: var(--ink);
  font-family: var(--font-body);
  background-color: #e7ebf0;
  background-image:
    radial-gradient(ellipse 80% 50% at 8% -12%, rgba(214, 0, 81, 0.16), transparent 55%),
    radial-gradient(ellipse 55% 40% at 100% 0%, rgba(214, 0, 81, 0.08), transparent 50%),
    linear-gradient(165deg, #f7f5f6 0%, #ebe7ea 48%, #e4e0e4 100%);
  background-attachment: fixed;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

button,
input,
select {
  font: inherit;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.75rem 0 4.5rem;
  animation: rise 0.55s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes stepIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulseDot {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.55;
  }
}

@keyframes barFlow {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.25rem;
}

.brand-mark {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

button.brand-link {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

button.brand-link:hover {
  transform: none;
  opacity: 0.8;
}

.brand-mark strong {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.4vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.live {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.live-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
}

.live-item i {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--line);
}

.live-item.ok i {
  background: var(--ok);
}

.live-item.bad i {
  background: var(--danger);
}

.hero {
  margin-bottom: 2rem;
  padding-bottom: 1.75rem;
  border-bottom: 2px solid var(--muted);
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 6vw, 4.1rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
  white-space: nowrap;
}

.hero h1 em {
  font-style: normal;
  background: linear-gradient(120deg, transparent 0%, var(--highlight) 0%);
  background-repeat: no-repeat;
  background-size: 100% 0.35em;
  background-position: 0 88%;
}

.hero-lead {
  margin: 0.75rem 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2rem;
  align-items: start;
}

.steps {
  display: grid;
  gap: 0.35rem;
  position: sticky;
  top: 1.25rem;
}

.steps button {
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.7rem 0.2rem;
  cursor: pointer;
  color: var(--muted);
  border-left: 2px solid transparent;
  padding-left: 0.85rem;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.steps button:hover:not(:disabled) {
  color: var(--ink);
  transform: translateX(2px);
}

.steps button.active {
  color: var(--ink);
  border-left-color: var(--signal);
  font-weight: 600;
}

.steps button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.steps button small {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.main {
  min-width: 0;
}

.stage {
  animation: stepIn 0.35s ease both;
}

.stage-head {
  margin-bottom: 1.25rem;
}

.stage-head h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.stage-head p,
.hint,
.meta,
.file-name {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.drop-grid {
  display: grid;
  gap: 0.85rem;
}

.drop {
  position: relative;
  display: block;
  padding: 1.15rem 1.2rem;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.drop:hover,
.drop:focus-within {
  border-color: rgba(214, 0, 81, 0.55);
  transform: translateY(-1px);
}

.drop.has-file {
  border-style: solid;
  border-color: rgba(214, 0, 81, 0.45);
  background: rgba(214, 0, 81, 0.08);
}

.drop.has-file:hover,
.drop.has-file:focus-within {
  border-color: var(--accent);
}

.drop-block {
  display: grid;
  gap: 0.55rem;
  width: 100%;
}

.drop-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.6rem;
  grid-template-rows: auto auto auto;
  column-gap: 0.55rem;
  row-gap: 0.55rem;
  align-items: stretch;
  width: 100%;
}

.drop-row .drop {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}

/* X 없을 때 메일함이 전체 너비(메일함+X와 동일)를 쓰도록 */
.drop-row:not(:has(.clear-upload)) .drop {
  grid-column: 1 / -1;
}

.drop-row .clear-upload {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  min-width: 0;
}

.drop-row .upload-bar {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
}

.drop-row .upload-status {
  grid-column: 1;
  grid-row: 3;
  margin: 0;
  min-width: 0;
}

.drop-row:not(:has(.clear-upload)) .upload-bar,
.drop-row:not(:has(.clear-upload)) .upload-status {
  grid-column: 1 / -1;
}

.drop .file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clear-upload {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
  padding: 0;
}

.clear-upload:hover:not(:disabled) {
  border-color: var(--ink);
  color: var(--ink);
  background: #fff;
}

.stream-text {
  margin: 0;
  min-height: 1.5em;
  white-space: pre-wrap;
}

.stream-text .caret {
  display: inline-block;
  width: 0.55ch;
  height: 1em;
  margin-left: 0.1ch;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: pulseDot 0.9s steps(1) infinite;
}

.upload-bar {
  height: 0.45rem;
  border: 1px solid rgba(214, 0, 81, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  overflow: hidden;
}

.upload-bar > i {
  position: relative;
  display: block;
  height: 100%;
  width: 0;
  overflow: hidden;
  background-color: var(--accent);
  transition: width 0.18s ease;
}

.upload-bar > i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.45) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: barFlow 1.4s linear infinite;
}

.upload-status {
  font-size: 0.82rem;
  color: var(--muted);
}

.upload-status.ok {
  color: var(--ok);
}

.upload-status.bad {
  color: var(--danger);
}

.drop span {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.field {
  display: grid;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}

.field > span {
  font-size: 0.86rem;
  font-weight: 600;
}

.field input[type="date"],
.field select {
  width: 100%;
  padding: 0.8rem 0.85rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
}

.field input[type="date"]:focus,
.field select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--ink);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.row .field {
  margin-bottom: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.4rem;
}

button {
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  padding: 0.78rem 1.05rem;
  cursor: pointer;
  border-radius: var(--radius);
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

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

button.primary {
  background: var(--ink);
  color: #fff;
}

button.primary:hover:not(:disabled) {
  background: #000;
}

button.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

button.accent:hover:not(:disabled) {
  background: #b80046;
  border-color: #b80046;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.error {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--danger);
  background: rgba(192, 57, 43, 0.08);
  color: var(--danger);
  animation: stepIn 0.25s ease both;
}

.progress {
  display: grid;
  gap: 0.45rem;
  margin: 1rem 0 1.4rem;
  padding: 1.1rem 1.15rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: rgba(231, 235, 240, 0.72);
  backdrop-filter: blur(8px);
  color: var(--ink);
}

.progress strong {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.progress .dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
  animation: pulseDot 1.2s ease infinite;
}

.analysis-progress {
  gap: 0.7rem;
}

.analysis-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.analysis-bar {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.75);
}

.progress-label {
  margin: 0;
  font-weight: 600;
}

.progress-detail,
.progress-counts {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.phase-list {
  list-style: none;
  margin: 0.2rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.phase-list li {
  position: relative;
  padding-left: 1.1rem;
  color: rgba(92, 101, 112, 0.55);
  font-size: 0.86rem;
}

.phase-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: rgba(92, 101, 112, 0.28);
}

.phase-list li.active {
  color: var(--ink);
  font-weight: 600;
}

.phase-list li.active::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(214, 0, 81, 0.18);
}

.phase-list li.done {
  color: var(--muted);
}

.phase-list li.done::before {
  background: var(--ok);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0.35rem 0 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.scope-note {
  margin: 0 0 1.25rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.55;
}

.weekly-panel {
  margin: 0 0 1.5rem;
}

.weekly-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.weekly-panel-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.icon-copy {
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.icon-copy:hover:not(:disabled) {
  transform: none;
  opacity: 0.7;
}

.icon-copy.copied {
  color: var(--ok);
}

.weekly-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
}

.weekly-col {
  min-width: 0;
  padding: 1rem 1.1rem 1.25rem;
}

.weekly-col + .weekly-col {
  border-left: 1.5px solid var(--line);
}

.weekly-col h3 {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.weekly-body {
  font-size: 0.95rem;
  line-height: 1.55;
}

.weekly-body .stream-text {
  font-weight: 500;
  white-space: pre-wrap;
}

@media (max-width: 860px) {
  .hero,
  .layout,
  .row,
  .weekly-table {
    grid-template-columns: 1fr;
  }

  .weekly-col + .weekly-col {
    border-left: 0;
    border-top: 1.5px solid var(--line);
  }

  .hero h1 {
    white-space: normal;
  }

  .steps {
    position: static;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--line);
  }

  .steps button {
    border-left: 0;
    border-bottom: 2px solid transparent;
    padding: 0.65rem 0.25rem;
    font-size: 0.9rem;
  }

  .steps button.active {
    border-bottom-color: var(--signal);
  }

  .steps button small {
    display: none;
  }
}
