:root {
  --bg: #061018;
  --panel: rgba(10, 20, 30, 0.82);
  --panel-border: rgba(120, 160, 190, 0.18);
  --text: #e8f1fb;
  --muted: #9cb4cc;
  --accent: #9fd7c3;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.36);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at top, #0b1a27 0%, var(--bg) 58%);
  color: var(--text);
  font-family: "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  overflow: hidden;
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.app {
  width: 100%;
  max-width: 460px;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.00));
  backdrop-filter: blur(8px);
}

.topbar {
  padding: 18px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 5;
}

.topbar-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}

.topbar-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  margin-right: auto;
}

.info-btn {
  border: 1px solid rgba(150, 200, 230, 0.16);
  background: rgba(11, 28, 42, 0.72);
  color: var(--text);
  padding: 8px 12px;
  min-width: 64px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: none;
  white-space: nowrap;
}

.info-btn:hover {
  opacity: 0.95;
}

.lang-switch {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.lang-btn {
  border: 1px solid rgba(150, 200, 230, 0.16);
  background: rgba(11, 28, 42, 0.72);
  color: var(--muted);
  padding: 8px 12px;
  min-width: 52px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: none;
}

.lang-btn.active {
  background: linear-gradient(180deg, #9fd7c3, #6fb4d6);
  color: #051018;
  border-color: transparent;
}

.lang-btn:hover {
  opacity: 0.95;
}

.title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.visual-wrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
  padding: 0 14px;
}

.visual-card {
  height: 100%;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(8, 18, 28, 0.78), rgba(5, 14, 22, 0.92));
  border: 1px solid rgba(120, 160, 190, 0.18);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
  padding: 16px;
}

.response-box {
  align-self: stretch;
  min-height: 112px;
  margin-top: auto;
  padding: 18px 18px 20px;
  border-radius: 22px;
  background: rgba(7, 18, 28, 0.78);
  border: 1px solid rgba(120, 160, 190, 0.16);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
}

.response-text {
  font-size: 1rem;
  line-height: 1.6;
  min-height: 3.2em;
  white-space: pre-wrap;
}

.composer {
  padding: 14px;
  display: grid;
  gap: 10px;
  z-index: 5;
}

.input-shell {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border-radius: 24px;
  background: rgba(8, 18, 28, 0.9);
  border: 1px solid rgba(120, 160, 190, 0.18);
  box-shadow: var(--shadow);
}

textarea {
  width: 100%;
  min-height: 44px;
  max-height: 120px;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 1.4;
}

textarea::placeholder { color: #7f97b1; }

button {
  border: none;
  outline: none;
  background: linear-gradient(180deg, #9fd7c3, #6fb4d6);
  color: #051018;
  padding: 12px 16px;
  min-width: 72px;
  border-radius: 18px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(111, 180, 214, 0.22);
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

.info-modal {
  position: absolute;
  inset: 0;
  z-index: 30;
}

.info-modal.hidden {
  display: none;
}

.info-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 14, 0.58);
  backdrop-filter: blur(8px);
}

.info-sheet {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  max-height: min(78vh, 680px);
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(10, 20, 30, 0.96), rgba(7, 16, 25, 0.98));
  border: 1px solid rgba(120, 160, 190, 0.18);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  overflow: hidden;
}

.info-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(120, 160, 190, 0.12);
}

.info-title-wrap {
  min-width: 0;
}

.info-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 4px;
}

.info-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
}

.info-close {
  border: 1px solid rgba(150, 200, 230, 0.16);
  background: rgba(11, 28, 42, 0.72);
  color: var(--text);
  padding: 8px 10px;
  min-width: 42px;
  border-radius: 14px;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: none;
}

.info-body {
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.info-text {
  margin: 0 0 12px;
  font-size: 0.95rem;
  line-height: 1.62;
  color: var(--text);
  white-space: pre-wrap;
}

.info-text.muted {
  color: var(--muted);
}

.info-foot {
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(120, 160, 190, 0.12);
}

.info-action {
  width: 100%;
  border-radius: 16px;
}

@media (min-width: 768px) {
  .app { max-width: 520px; }
  .title { font-size: 1.25rem; }
}