@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@500;600;700;800&display=swap");

:root {
  /* Core theme tokens */
  --bg-color: #fdf8f5;
  --surface-color: #ffffff;
  --primary-color: #d66d54;
  --text-primary: #3d342b;
  --text-secondary: #968d87;
  --shadow-warm: 0 4px 12px rgba(214, 109, 84, 0.08);
  --border-radius-lg: 16px;
  --border-radius-sm: 8px;

  /* Support tokens */
  --border-soft: #f2e8e3;
  --border-soft-strong: #e9d7cf;
  --surface-soft: #fff7f3;
  --surface-tint: #fef0ea;
  --text-inverse: #ffffff;
  --success: #3f7a58;
  --column-width: 720px;
  --font-display: "Nunito", "NanumSquareRound", "Pretendard", sans-serif;
  --font-body: "Nunito", "NanumSquareRound", "Pretendard", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg-color);
  color: var(--text-primary);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(214, 109, 84, 0.08), transparent 32%),
    radial-gradient(circle at 85% 12%, rgba(214, 109, 84, 0.06), transparent 22%),
    var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  min-height: 100vh;
  overflow: hidden;
  padding: 18px 16px 18px;
}

/* Soft background glow keeps the workspace from feeling clinical. */
.page-glow {
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 999px;
  filter: blur(18px);
  opacity: 0.9;
  pointer-events: none;
}

.page-glow-left {
  top: 40px;
  left: -84px;
  background: rgba(214, 109, 84, 0.12);
}

.page-glow-right {
  top: 210px;
  right: -92px;
  background: rgba(255, 211, 196, 0.88);
}

.site-header,
.app-root,
.app-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  width: 100%;
  max-width: var(--column-width);
  margin: 0 auto;
}

.header-content {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

/* Soft badge for the Hangul brand mark. */
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 50px;
  height: 46px;
  border-radius: var(--border-radius-sm);
  background: var(--primary-color);
  color: #ffffff;
  box-shadow: var(--shadow-warm);
  font-family: "NanumSquareRound", "Pretendard", "Nunito", sans-serif;
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.brand-name,
.section-title,
.feedback-main h2,
.feedback-section h3,
.privacy-card h1,
.tool-title {
  font-family: var(--font-display);
}

.brand-text-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.brand-name {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.brand-tagline {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  margin: 0;
  letter-spacing: -0.01em;
}

.ghost-button,
.minor-button {
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text-primary);
  box-shadow: var(--shadow-warm);
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.ghost-button:hover,
.minor-button:hover {
  transform: translateY(-1px);
  background: var(--surface-color);
  border-color: var(--border-soft-strong);
  box-shadow: 0 8px 18px rgba(214, 109, 84, 0.1);
}

.ghost-button:active,
.minor-button:active,
.primary-button:active,
.interactive-highlight:active,
.copy-icon-button:active,
.collapsed-draft-bar:active {
  transform: scale(0.99);
}

.app-root {
  width: 100%;
  max-width: var(--column-width);
  margin: 0 auto;
}

.app-footer {
  width: 100%;
  max-width: var(--column-width);
  margin: auto auto 0;
  padding: 2px 4px 0;
  color: var(--text-secondary);
  font-size: 0.76rem;
  text-align: center;
}

.app-footer a {
  color: var(--text-secondary);
  transition: color 180ms ease;
}

.app-footer a:hover {
  color: var(--text-primary);
}

.shell-layout {
  display: grid;
  gap: 14px;
}

.flow-stack,
.result-stack {
  display: grid;
  gap: 14px;
}

/* Main surfaces use white cards, soft corners, and warm shadows. */
.panel,
.privacy-card,
.feedback-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--border-radius-lg);
  background: var(--surface-color);
  box-shadow: var(--shadow-warm);
}

.panel {
  padding: 18px;
}

.workspace-top {
  display: grid;
  gap: 8px;
}

.tool-title {
  margin: 0;
  font-size: clamp(1.55rem, 5vw, 2.15rem);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.03em;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-tint);
  color: var(--primary-color);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tool-text,
.support-copy,
.explanation-text,
.privacy-card p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

.route-chip,
.status-pill,
.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--surface-soft);
  color: var(--text-primary);
  font-size: 0.82rem;
}

.composer-card {
  display: grid;
  gap: 16px;
}

.composer-card,
.feedback-card,
.privacy-card,
.collapsed-draft-bar {
  animation: surface-enter 180ms ease;
}

.composer-header,
.section-header,
.privacy-header {
  display: grid;
  gap: 10px;
}

.result-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.section-title,
.feedback-main h2,
.feedback-section h3,
.privacy-card h1 {
  margin: 0;
  color: var(--text-primary);
}

.feedback-main h2 {
  font-size: clamp(1.25rem, 4.3vw, 1.65rem);
  line-height: 1.28;
}

.feedback-section h3,
.privacy-card h1 {
  font-size: 1.18rem;
  line-height: 1.3;
}

.eyebrow-label {
  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  color: #8e8e93 !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
  display: inline-block !important;
  opacity: 1 !important;
  -webkit-font-smoothing: antialiased !important;
}

.result-header-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
}

.result-header-text .eyebrow-label {
  margin: 0 !important;
  line-height: 1.1 !important;
}

.instruction-caption {
  margin: 0 !important;
  font-size: 11px;
  line-height: 1.15;
  color: var(--text-secondary);
}

.support-label {
  display: block;
  margin: 0 0 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.composer-field {
  display: grid;
  gap: 8px;
}

.input-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.action-buttons-group {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.composer-field textarea {
  min-height: 180px;
  width: 100%;
  resize: vertical;
  padding: 16px 16px 18px;
  border: 1px solid var(--border-soft);
  border-radius: var(--border-radius-lg);
  background: var(--surface-color);
  color: var(--text-primary);
  box-shadow: inset 0 1px 2px rgba(61, 52, 43, 0.03);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.composer-field textarea::placeholder {
  color: #b4aaa4;
}

.composer-field textarea:focus {
  outline: none;
  border-color: rgba(214, 109, 84, 0.42);
  box-shadow:
    inset 0 0 0 1px rgba(214, 109, 84, 0.08),
    0 0 0 4px rgba(214, 109, 84, 0.1);
}

.composer-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 0.84rem;
}

.sample-btn {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sample-btn:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

.char-counter {
  font-size: 12px;
  color: var(--text-secondary);
}

.char-counter.is-near-limit {
  color: var(--primary-color);
}

.composer-actions,
.route-chips,
.result-actions,
.footer-actions {
  display: grid;
  gap: 10px;
}

.composer-actions {
  align-items: stretch;
}

.footer-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.route-chips {
  display: flex;
  flex-wrap: wrap;
}

/* Primary CTA should feel encouraging and tactile. */
.primary-button {
  border: 0;
  border-radius: var(--border-radius-lg);
  padding: 14px 18px;
  width: 100%;
  background: var(--primary-color);
  color: var(--text-inverse);
  box-shadow: var(--shadow-warm);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease,
    background-color 180ms ease;
}

.primary-button:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 10px 20px rgba(214, 109, 84, 0.18);
}

.primary-button:disabled,
.minor-button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
  transform: none;
  box-shadow: none;
}

.minor-button {
  background: var(--surface-tint);
  color: var(--primary-color);
  font-weight: 700;
}

.copy-icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 14px;
  justify-self: end;
}

.copy-icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.copy-icon-button.is-copied {
  background: rgba(63, 122, 88, 0.1);
  border-color: rgba(63, 122, 88, 0.22);
  color: var(--success);
}

.secondary-icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  justify-self: end;
  border-radius: 14px;
  background: transparent;
  color: var(--text-secondary);
  box-shadow: none;
}

.secondary-icon-button:hover {
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary-color);
  box-shadow: var(--shadow-warm);
}

.secondary-icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.collapsed-draft-bar {
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  color: var(--text-primary);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

.collapsed-draft-bar:hover {
  transform: translateY(-1px);
  border-color: var(--border-soft-strong);
  background: var(--surface-soft);
  box-shadow: 0 10px 18px rgba(214, 109, 84, 0.12);
}

.collapsed-draft-bar:focus-visible {
  outline: none;
  border-color: rgba(214, 109, 84, 0.42);
  box-shadow:
    0 0 0 4px rgba(214, 109, 84, 0.1),
    var(--shadow-warm);
}

.collapsed-draft-preview {
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collapsed-draft-bar .action-buttons-group {
  color: var(--text-secondary);
}

.collapsed-draft-bar .action-buttons-group svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.collapsed-draft-bar:hover .action-buttons-group {
  color: var(--primary-color);
}

.privacy-card {
  padding: 22px;
}

.feedback-card,
.empty-state-grid,
.explanation-grid {
  display: grid;
  gap: 14px;
}

.feedback-body {
  display: grid;
  gap: 14px;
}

.interactive-result-card {
  gap: 16px;
  background: linear-gradient(180deg, #fff9f6 0%, var(--surface-color) 100%);
}

.interactive-result-card p {
  margin: 0;
}

.interactive-natural-text {
  margin: 0;
  color: var(--text-primary);
  font-size: clamp(1.12rem, 4vw, 1.35rem);
  line-height: 1.95;
  word-break: keep-all;
}

.interactive-highlight {
  display: inline;
  margin: 0 1px;
  padding: 0.08em 0.22em;
  border-radius: 4px;
  background: rgba(214, 109, 84, 0.15);
  color: var(--text-primary);
  vertical-align: baseline;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.interactive-highlight:hover {
  background: rgba(214, 109, 84, 0.22);
}

.interactive-highlight.is-selected {
  background: rgba(214, 109, 84, 0.28);
  box-shadow: inset 0 0 0 1px rgba(214, 109, 84, 0.22);
}

.interactive-highlight:focus-visible {
  outline: none;
  box-shadow:
    inset 0 0 0 1px rgba(214, 109, 84, 0.26),
    0 0 0 3px rgba(214, 109, 84, 0.12);
}

.inline-note {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: var(--border-radius-lg);
  background: var(--surface-color);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-warm);
}

.inline-note-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-note-target {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.55;
}

.inline-note-accordion {
  gap: 10px;
}

.inline-note-accordion .category-pill {
  transition:
    background-color 180ms ease,
    color 180ms ease;
}

.inline-note-accordion.is-open .category-pill {
  background: #fde8e0;
  color: var(--primary-color);
}

.inline-note-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    max-height 240ms ease,
    opacity 180ms ease;
}

.inline-note-accordion.is-open .inline-note-body {
  opacity: 1;
}

.inline-note-content {
  padding-top: 2px;
}

/* Tutor note copy stays quiet and readable inside the accordion. */
.inline-note-content .explanation-text {
  color: var(--text-secondary);
  line-height: 1.6;
}

.result-copy {
  background: var(--surface-color);
  border-radius: var(--border-radius-lg);
  padding: 16px;
  border: 1px solid var(--border-soft);
}

.explanation-item {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--border-radius-lg);
  background: var(--surface-color);
  border: 1px solid var(--border-soft);
}

.explanation-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.explanation-pair {
  display: grid;
  gap: 8px;
}

.pair-row {
  display: grid;
  gap: 4px;
}

.pair-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pair-text {
  font-weight: 700;
}

.loading-panel {
  display: grid;
  gap: 12px;
}

.loading-line {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(214, 109, 84, 0.08),
    rgba(214, 109, 84, 0.18),
    rgba(214, 109, 84, 0.08)
  );
  background-size: 220% 100%;
  animation: shimmer 1.6s linear infinite;
}

.loading-line.short {
  width: 58%;
}

.loading-line.medium {
  width: 74%;
}

.status-pill {
  background: #f7efe9;
  color: var(--primary-color);
  font-weight: 800;
}

.category-pill {
  border-radius: var(--border-radius-sm);
  background: #fdf1ea;
  color: var(--primary-color);
  font-weight: 800;
}

.footer-actions > * {
  width: 100%;
  text-align: center;
}

.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;
}

@keyframes shimmer {
  0% {
    background-position: 220% 0;
  }

  100% {
    background-position: -40% 0;
  }
}

@keyframes surface-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 960px) {
  .page-shell {
    padding: 22px 22px 20px;
  }

  .panel,
  .privacy-card,
  .feedback-card {
    padding-left: 20px;
    padding-right: 20px;
  }
}

@media (max-width: 720px) {
  .footer-actions {
    grid-template-columns: 1fr;
  }

  .page-shell {
    padding-left: 14px;
    padding-right: 14px;
  }
}
