/* 공통 동작의 배치와 접근성. 디자인별 색상·구조는 각 style.css에서 변경한다. */
* {
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6
}

button,
input,
textarea {
  font: inherit
}

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

button {
  cursor: pointer
}

button:disabled {
  cursor: wait;
  opacity: .45
}

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

svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0
}

button {
  color: inherit
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px
}

input:focus,
textarea:focus {
  outline: none
}

input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px
}

[hidden] {
  display: none !important
}

body {
  display: flex;
  min-height: 100vh
}

.sidebar {
  width: 254px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 30px 20px 18px;
  background: var(--side);
  border-right: 1px solid var(--line);
  height: 100vh;
  position: sticky;
  top: 0
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -1px
}

.brand-symbol {
  display: flex;
  width: 32px;
  height: 32px;
  color: var(--accent)
}

.brand-symbol svg {
  width: 100%;
  height: 100%
}

.new-chat {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 32px 0 28px;
  font-size: 13px;
  font-weight: bold
}

.new-chat kbd {
  font: 10px sans-serif;
  font-weight: 400;
  margin-left: auto;
  color: var(--muted)
}

.history {
  flex: 1;
  overflow: auto
}

.history-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  margin: 0 10px 12px
}

.history-count {
  font-size: 10px
}

.search-box {
  display: flex;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 8px;
  margin: 0 4px 16px;
  color: var(--muted)
}

.search-box svg {
  width: 15px;
  height: 15px
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px
}

.history-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 11px;
  border-radius: 8px;
  margin: 2px 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  font-size: 12px
}

.history-item.active,
.history-item:hover {
  background: var(--active);
  color: var(--text)
}

.history-empty {
  padding: 15px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 2
}

.profile {
  display: flex;
  align-items: center;
  text-align: left;
  width: 100%;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 18px 2px 0;
  gap: 10px
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--active);
  display: grid;
  place-items: center;
  font-size: 12px
}

.profile-text {
  flex: 1
}

.profile strong {
  font-size: 12px;
  font-weight: 500;
  display: block
}

.profile small {
  font-size: 10px;
  color: var(--muted);
  display: block
}

.profile svg {
  width: 14px;
  height: 14px;
  color: var(--muted)
}

.back-link {
  font-size: 10px;
  color: var(--muted);
  margin: 15px 5px
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 22px 36px;
  min-height: 83px
}

.top-title strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  max-width: 350px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.top-title>span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 4px
}

.top-actions {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-shrink: 0
}

#header-user {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px
}

.login-button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 20px;
  padding: 7px 17px;
  font-size: 11px
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 15px 35px;
  scroll-behavior: smooth
}

.welcome {
  max-width: 780px;
  margin: auto;
  text-align: center;
  padding: 45px 0 20px
}

.hero-mark {
  height: 55px;
  color: var(--accent);
  margin-bottom: 24px
}

.hero-mark svg {
  height: 55px;
  width: 55px
}

.eyebrow {
  font: 10px sans-serif;
  letter-spacing: 2px;
  color: var(--muted);
  margin: 18px 0
}

h1 {
  font-size: 42px;
  line-height: 1.5;
  letter-spacing: -2px;
  font-weight: 400;
  margin: 15px 0 16px
}

h1 em {
  font-style: normal
}

.hero-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 36px
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px
}

.prompt-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  text-align: left;
  padding: 20px 17px;
  position: relative;
  transition: transform .2s, border-color .2s
}

.prompt-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent)
}

.card-icon {
  display: block;
  color: var(--accent);
  margin-bottom: 20px
}

.prompt-card strong {
  display: block;
  font-size: 13px;
  margin-bottom: 7px
}

.prompt-card>span:not(.card-icon):not(.card-arrow) {
  display: block;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.9;
  max-width: 125px
}

.card-arrow {
  position: absolute;
  top: 17px;
  right: 14px;
  color: var(--muted);
  font-size: 15px
}

.composer-dock {
  width: 100%;
  max-width: 850px;
  margin: auto;
  padding: 0 35px 19px
}

.status {
  font-size: 11px;
  color: var(--muted);
  min-height: 18px;
  margin: 8px 0
}

.composer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 19px 20px 12px;
  box-shadow: 0 6px 24px #00000004
}

.composer:focus-within {
  border-color: var(--accent)
}

textarea {
  display: block;
  width: 100%;
  resize: none;
  min-height: 51px;
  max-height: 150px;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.8
}

textarea::placeholder {
  color: var(--muted)
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 12px
}

.input-hint {
  font-size: 9px;
  color: var(--muted);
  flex: 1
}

#char-count {
  font-size: 9px;
  color: var(--muted)
}

.send-button {
  display: grid;
  place-items: center;
  border: 0;
  width: 33px;
  height: 33px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink)
}

.send-button svg {
  width: 17px;
  height: 17px
}

.stop-button {
  border: 1px solid var(--line);
  background: var(--active);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 11px
}

.disclaimer {
  font-size: 9px;
  text-align: center;
  color: var(--muted);
  margin: 12px 0 0
}

.transcript {
  max-width: 730px;
  margin: 20px auto 0
}

.message {
  padding: 16px 0 22px
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 12px
}

.message-meta b {
  color: var(--text);
  font-weight: 500
}

.message.user {
  max-width: 86%;
  margin-left: auto
}

.message.user .message-meta {
  justify-content: flex-end
}

.message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.95
}

.message.user .message-text {
  background: var(--active);
  padding: 15px 21px;
  border-radius: 16px 16px 3px 16px
}

.message.assistant .message-text {
  padding: 4px 0 8px
}

.copy-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 6px 0
}

.copy-button svg {
  width: 13px;
  height: 13px
}

.icon-button {
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  padding: 7px;
  color: var(--muted)
}

.menu-button {
  display: none
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #0007;
  border: 0
}

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

dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 35px;
  width: min(420px, calc(100% - 32px));
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 80px #0003
}

dialog::backdrop {
  background: #10131d70;
  backdrop-filter: blur(5px)
}

.modal-close {
  position: absolute;
  right: 15px;
  top: 15px
}

.modal-mark {
  font-size: 32px;
  color: var(--accent)
}

dialog h2 {
  font-size: 24px;
  letter-spacing: -1px;
  margin: 14px 0 7px
}

.modal-intro {
  font-size: 12px;
  color: var(--muted)
}

.auth-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  margin: 25px 0
}

.auth-tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 0;
  font-size: 12px
}

.auth-tabs .active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent)
}

#auth-form label {
  display: block;
  font-size: 11px;
  margin: 14px 0 7px
}

#auth-form input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 12px
}

.auth-submit {
  width: 100%;
  border: 0;
  padding: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 9px;
  margin-top: 24px;
  font-size: 12px
}

#auth-status {
  font-size: 12px;
  color: var(--accent)
}

.preview-explain {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.9;
  margin-top: 20px
}

.toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  border: 1px solid var(--line);
  background: var(--text);
  color: var(--bg);
  border-radius: 10px;
  font-size: 12px;
  z-index: 100;
  max-width: 90vw;
  text-align: center
}

.thread-tools {
  display: flex;
  justify-content: flex-end
}

.delete-chat {
  font-size: 10px;
  color: var(--muted);
  border: 0;
  background: transparent;
  padding: 5px
}

.fallback-copy {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  padding: 10px;
  margin: 8px 0
}

@media(max-width:1100px) {
  .sidebar {
    width: 220px;
    padding: 26px 16px
  }

  .topbar {
    padding: 20px 25px
  }

  .welcome {
    padding-top: 30px
  }

  h1 {
    font-size: 35px
  }

  .prompt-grid {
    gap: 9px
  }

  .prompt-card {
    padding: 17px 12px
  }

  .chat-body {
    padding: 10px 24px
  }

  .composer-dock {
    padding: 0 24px 16px
  }

  .hero-subtitle {
    line-height: 1.9
  }
}

@media(max-width:760px) {
  .main {
    height: 100dvh
  }

  .sidebar {
    position: fixed;
    z-index: 40;
    left: 0;
    top: 0;
    height: 100dvh;
    width: 270px;
    transform: translateX(-100%);
    transition: transform .2s
  }

  .sidebar.is-open {
    transform: translateX(0)
  }

  .menu-button {
    display: grid
  }

  .topbar {
    padding: 15px 16px;
    min-height: 69px;
    gap: 10px
  }

  .top-title {
    flex: 1;
    min-width: 0
  }

  .top-title strong {
    max-width: 180px;
    font-size: 12px
  }

  .top-title>span {
    display: none
  }

  .top-actions {
    gap: 10px
  }

  .login-button {
    padding: 6px 11px
  }

  .chat-body {
    padding: 8px 20px
  }

  .welcome {
    padding: 22px 0 5px
  }

  .hero-mark {
    margin-bottom: 15px;
    height: 40px
  }

  .hero-mark svg {
    width: 40px;
    height: 40px
  }

  h1 {
    font-size: 29px;
    letter-spacing: -1.5px;
    margin: 12px 0 15px
  }

  .eyebrow {
    font-size: 8px;
    letter-spacing: 1.4px
  }

  .hero-subtitle {
    font-size: 11px;
    margin-bottom: 25px
  }

  .prompt-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px
  }

  .prompt-card {
    padding: 15px
  }

  .card-icon {
    margin-bottom: 12px
  }

  .card-icon svg {
    width: 17px;
    height: 17px
  }

  .prompt-card strong {
    font-size: 12px
  }

  .composer-dock {
    padding: 0 16px 12px
  }

  .composer {
    padding: 14px 14px 10px
  }

  .input-hint {
    font-size: 8px
  }

  #char-count {
    display: none
  }

  .disclaimer {
    font-size: 8px
  }

  .message-text {
    font-size: 13px
  }

  .message.user {
    max-width: 93%
  }

  .status {
    font-size: 10px
  }

  .transcript {
    margin-top: 5px
  }
}

@media(prefers-reduced-motion:reduce) {

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important
  }
}

.prompt-card {
  word-break: keep-all
}

.status[data-state="error"] {
  color: #b42318;
  background: #fff1f0;
  border: 1px solid #f5c2be;
  border-radius: 8px;
  padding: 8px 12px;
  height: auto;
  overflow-wrap: anywhere;
}
