:root {
  color-scheme: light;
  --ink: #19324a;
  --ink-soft: #5d6c78;
  --paper: #fffdf7;
  --paper-deep: #f3ede0;
  --line: #ddd5c6;
  --accent: #ff6b4a;
  --accent-dark: #dc4f32;
  --blue: #2d63d7;
  --danger: #ad3b33;
  --success: #237b58;
  --shadow: 0 24px 70px rgba(25, 50, 74, 0.14);
  font-family:
    Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic",
    system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: #eee7d9;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.background-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 10% 15%, rgba(255, 107, 74, 0.14), transparent 28%),
    radial-gradient(circle at 88% 82%, rgba(45, 99, 215, 0.12), transparent 28%),
    linear-gradient(rgba(25, 50, 74, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25, 50, 74, 0.045) 1px, transparent 1px);
  background-size: auto, auto, 30px 30px, 30px 30px;
}

.page-shell {
  width: min(1160px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 40px 0;
  display: grid;
  place-items: center;
}

.auth-layout {
  width: 100%;
  min-height: min(760px, calc(100vh - 80px));
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(390px, 0.9fr);
  overflow: hidden;
  border: 1px solid rgba(25, 50, 74, 0.1);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.intro-panel {
  min-height: 640px;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background:
    linear-gradient(155deg, rgba(25, 50, 74, 0.96), rgba(30, 57, 82, 0.94)),
    var(--ink);
}

.brand {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px 10px 10px 3px;
  color: #fff;
  background: var(--accent);
  font-family: Georgia, serif;
  font-size: 1.05rem;
  font-style: italic;
}

.intro-copy {
  max-width: 520px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.intro-copy h1 {
  margin: 0;
  font-size: clamp(2.7rem, 6vw, 4.8rem);
  line-height: 1.07;
  letter-spacing: -0.065em;
}

.intro-copy > p:last-child {
  max-width: 450px;
  margin: 26px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 1rem;
  line-height: 1.8;
}

.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feature-list span {
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.78rem;
}

.auth-panel {
  padding: 48px;
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(100%, 390px);
}

.auth-heading {
  margin-bottom: 28px;
}

.auth-heading h2 {
  margin: 0;
  font-size: 1.85rem;
  letter-spacing: -0.045em;
}

.auth-heading > p:last-child {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 0.93rem;
  line-height: 1.6;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 24px;
  padding: 4px;
  border-radius: 13px;
  background: var(--paper-deep);
}

.tab-button {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 0.87rem;
  font-weight: 800;
}

.tab-button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 3px 10px rgba(25, 50, 74, 0.08);
}

.auth-form {
  display: grid;
  gap: 17px;
}

.auth-form label {
  display: grid;
  gap: 8px;
}

.auth-form label > span {
  font-size: 0.82rem;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  outline: 0;
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(45, 99, 215, 0.12);
}

.primary-button,
.secondary-button,
.danger-button,
.text-button {
  min-height: 48px;
  border-radius: 12px;
  font-weight: 850;
}

.primary-button {
  border: 1px solid var(--ink);
  color: #fff;
  background: var(--ink);
  box-shadow: 0 10px 22px rgba(25, 50, 74, 0.16);
}

.primary-button:hover:not(:disabled) {
  background: #244560;
  transform: translateY(-1px);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--ink);
}

.danger-button {
  border: 1px solid rgba(173, 59, 51, 0.25);
  color: var(--danger);
  background: #fff8f5;
}

.text-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.setup-notice {
  margin-bottom: 18px;
  padding: 13px 14px;
  display: grid;
  gap: 4px;
  border: 1px solid #e7bd64;
  border-radius: 12px;
  color: #6e5115;
  background: #fff8dc;
  font-size: 0.82rem;
  line-height: 1.5;
}

.form-message {
  min-height: 22px;
  margin: 16px 0 0;
  color: var(--danger);
  font-size: 0.82rem;
  line-height: 1.5;
}

.form-message.success {
  color: var(--success);
}

.auth-footnote {
  margin: 14px 0 0;
  color: #8c948f;
  font-size: 0.72rem;
  line-height: 1.55;
}

.memo-view {
  width: 100%;
  max-width: 940px;
}

.memo-header {
  margin-bottom: 18px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(25, 50, 74, 0.1);
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.88);
  box-shadow: 0 10px 30px rgba(25, 50, 74, 0.08);
  backdrop-filter: blur(12px);
}

.account-area {
  display: flex;
  align-items: center;
  gap: 16px;
}

.account-copy {
  display: grid;
  gap: 2px;
  text-align: right;
}

.account-copy span {
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.account-copy strong {
  max-width: 260px;
  overflow: hidden;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memo-workspace {
  padding: clamp(24px, 5vw, 52px);
  border: 1px solid rgba(25, 50, 74, 0.1);
  border-radius: 26px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.memo-heading {
  margin-bottom: 24px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.memo-heading h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: -0.065em;
}

.save-state {
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  color: var(--success);
  background: #eaf6ef;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.save-state.dirty {
  color: #836313;
  background: #fff3ce;
}

.save-state.error {
  color: var(--danger);
  background: #ffebe6;
}

.state-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.memo-field {
  display: block;
}

textarea {
  width: 100%;
  min-height: 410px;
  padding: 24px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  outline: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      #fff 0,
      #fff 31px,
      rgba(45, 99, 215, 0.09) 32px
    );
  font-size: 1rem;
  line-height: 2rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

textarea::placeholder {
  color: #a39d91;
}

.memo-meta {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.memo-actions {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  max-width: min(420px, calc(100% - 32px));
  padding: 12px 17px;
  border-radius: 12px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 14px 35px rgba(25, 50, 74, 0.24);
  font-size: 0.84rem;
  font-weight: 750;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 24px, 620px);
    padding: 12px 0;
  }

  .auth-layout {
    min-height: auto;
    grid-template-columns: 1fr;
    border-radius: 22px;
  }

  .intro-panel {
    min-height: 330px;
    padding: 30px;
  }

  .intro-copy h1 {
    font-size: clamp(2.25rem, 11vw, 3.5rem);
  }

  .intro-copy > p:last-child {
    margin-top: 16px;
  }

  .feature-list {
    display: none;
  }

  .auth-panel {
    padding: 36px 24px;
  }

  .memo-header {
    align-items: flex-start;
  }

  .account-area {
    gap: 8px;
  }

  .account-copy {
    display: none;
  }

  .memo-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  textarea {
    min-height: 360px;
    padding: 18px;
  }

  .memo-actions {
    grid-template-columns: 1fr 1fr;
  }

  .memo-actions .primary-button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 470px) {
  .intro-panel {
    min-height: 300px;
    padding: 24px;
  }

  .intro-copy > p:last-child {
    font-size: 0.88rem;
    line-height: 1.65;
  }

  .auth-panel {
    padding: 30px 20px;
  }

  .memo-workspace {
    padding: 24px 18px;
    border-radius: 20px;
  }

  .memo-meta {
    flex-direction: column;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
