:root {
  --sky: #dff4ff; --mint: #e0fbf1; --sand: #fff4dc;
  --panel: #ffffff; --ink: #12304a; --muted: #6b8295; --line: #e3edf3;
  --accent: #14b8a6; --accent-ink: #0f766e; --accent-soft: #e6faf6;
  --coral: #ff6b6b; --sun: #ffd166; --chip: #eef7f9;
  --shadow: 0 24px 60px rgba(18, 48, 74, .14);
}
@media (prefers-color-scheme: dark) {
  :root {
    --sky: #0c1b2a; --mint: #0b2224; --sand: #1d1a14;
    --panel: #12222f; --ink: #e8f4f8; --muted: #8fa7b6; --line: #213646;
    --accent: #2dd4bf; --accent-ink: #5eead4; --accent-soft: #123534; --chip: #1a2f3d;
    --shadow: 0 24px 60px rgba(0, 0, 0, .45);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink);
  background: linear-gradient(160deg, var(--sky) 0%, var(--mint) 55%, var(--sand) 100%) fixed;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 첫 화면 ---------- */
.g-landing {
  position: relative; min-height: 100vh; min-height: 100dvh; overflow: hidden;
  display: flex; align-items: center; justify-content: center; padding: 40px 16px 120px;
}
.g-deco { position: absolute; inset: 0; pointer-events: none; }
.g-sun {
  position: absolute; top: 8%; right: 12%; width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff6d0, var(--sun) 60%, #ffb347);
  box-shadow: 0 0 0 22px rgba(255, 209, 102, .22), 0 0 0 46px rgba(255, 209, 102, .10);
  animation: g-float 7s ease-in-out infinite;
}
.g-cloud {
  position: absolute; height: 44px; border-radius: 44px; background: rgba(255, 255, 255, .85);
  box-shadow: 0 8px 20px rgba(18, 48, 74, .06);
}
.g-cloud::before, .g-cloud::after { content: ""; position: absolute; background: inherit; border-radius: 50%; }
.g-cloud-1 { top: 16%; left: 8%; width: 150px; animation: g-drift 26s linear infinite alternate; }
.g-cloud-1::before { width: 70px; height: 70px; left: 22px; top: -34px; }
.g-cloud-1::after { width: 50px; height: 50px; left: 76px; top: -22px; }
.g-cloud-2 { top: 58%; right: 7%; width: 110px; height: 34px; opacity: .8; animation: g-drift 32s linear infinite alternate-reverse; }
.g-cloud-2::before { width: 52px; height: 52px; left: 16px; top: -26px; }
.g-cloud-2::after { width: 38px; height: 38px; left: 56px; top: -16px; }
.g-flight { position: absolute; left: 4%; bottom: 18%; width: min(46vw, 560px); color: var(--coral); opacity: .55; }
.g-waves { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 130px; color: var(--accent); }
@media (prefers-color-scheme: dark) { .g-cloud { background: rgba(255, 255, 255, .08); box-shadow: none; } }
@keyframes g-float { 50% { transform: translateY(-10px); } }
@keyframes g-drift { to { transform: translateX(60px); } }

.g-card {
  position: relative; width: 100%; max-width: 480px; padding: 36px 32px 28px;
  background: var(--panel); border-radius: 28px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 18px;
}
.g-kicker {
  display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 800; letter-spacing: .16em;
  text-transform: uppercase; color: var(--accent-ink);
}
.g-kicker::before { content: ""; width: 20px; height: 2px; border-radius: 2px; background: var(--coral); }
.g-card h1 { margin: -6px 0 0; font-size: 30px; line-height: 1.3; font-weight: 800; letter-spacing: -.035em; }
.g-card h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--accent), #3b82f6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.g-lead { margin: -8px 0 4px; font-size: 14px; line-height: 1.6; color: var(--muted); }

.g-field { display: flex; flex-direction: column; gap: 8px; }
.g-field label, .g-options label { font-size: 13px; font-weight: 700; }
input[type="text"], select {
  font: inherit; font-size: 15px; padding: 13px 15px; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--chip); color: var(--ink); transition: border-color .15s, background .15s;
}
input[type="text"]:focus, select:focus { outline: none; border-color: var(--accent); background: var(--panel); }

.g-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 170px; padding: 22px; border: 2px dashed #b9e6df; border-radius: 20px; cursor: pointer;
  background: var(--accent-soft); transition: border-color .15s, transform .15s, background .15s;
}
.g-drop strong { font-size: 15px; }
.g-drop > span:last-child { font-size: 12px; color: var(--muted); }
.g-drop:hover, .g-drop:focus-visible, .g-drop.over { border-color: var(--accent); transform: translateY(-2px); outline: none; }
.g-drop-icon {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 4px;
  background: var(--accent); color: #fff; box-shadow: 0 8px 18px rgba(20, 184, 166, .35);
}
.g-drop-icon svg { width: 26px; height: 26px; }
@media (prefers-color-scheme: dark) { .g-drop { border-color: #1f5550; } }

.g-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.g-options select { padding: 8px 12px; font-size: 13px; border-radius: 12px; }
.g-error { margin: 0; font-size: 13px; color: var(--coral); font-weight: 600; }
.g-privacy { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- 버튼 ---------- */
.g-btn {
  font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; white-space: nowrap;
  border: none; background: var(--accent); color: #fff; padding: 11px 18px; border-radius: 999px;
  box-shadow: 0 6px 16px rgba(20, 184, 166, .3); transition: transform .1s, filter .15s;
}
.g-btn:hover { filter: brightness(1.06); }
.g-btn:active { transform: scale(.97); }
.g-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.g-btn-ghost { background: var(--panel); color: var(--accent-ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.g-icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer; flex-shrink: 0;
  background: var(--chip); color: var(--ink); display: grid; place-items: center;
}
.g-icon-btn:hover { background: var(--line); }
.g-icon-btn svg { width: 20px; height: 20px; }

/* ---------- 편집 화면 ---------- */
.g-editor { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 14px 14px 0; gap: 8px; }
.g-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px;
  background: var(--panel); border-radius: 22px; box-shadow: 0 10px 30px rgba(18, 48, 74, .08); flex-wrap: wrap;
}
.g-bar-title { flex: 1; min-width: 200px; }
.g-bar-title input {
  width: 100%; border: none; background: transparent; padding: 2px 6px; border-radius: 8px;
  font-size: 20px; font-weight: 800; letter-spacing: -.03em;
}
.g-bar-title input:focus { background: var(--chip); }
.g-bar-title p { margin: 2px 6px 0; font-size: 12px; color: var(--muted); }
.g-warn {
  font-size: 12px; font-weight: 700; color: #b45309; background: #fff4dc; padding: 6px 12px; border-radius: 999px; cursor: help;
}
@media (prefers-color-scheme: dark) { .g-warn { background: #2b2618; color: #fbbf24; } }
.g-bar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.g-btn-sm { padding: 7px 13px; font-size: 12px; }

.g-btn-ai {
  background: linear-gradient(120deg, #8b5cf6, #3b82f6 55%, var(--accent));
  box-shadow: 0 6px 16px rgba(99, 102, 241, .3);
}

/* ---------- AI 메모 대화상자 ---------- */
.g-dialog {
  width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: none;
  border-radius: 24px; background: var(--panel); color: var(--ink); box-shadow: var(--shadow);
}
.g-dialog::backdrop { background: rgba(8, 24, 36, .45); backdrop-filter: blur(4px); }
.g-dialog-body { display: flex; flex-direction: column; gap: 16px; padding: 26px 26px 22px; }
.g-dialog-head { display: flex; gap: 14px; align-items: flex-start; }
.g-dialog-head h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.g-dialog-head p { margin: 4px 0 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.g-ai-badge {
  width: 42px; height: 42px; border-radius: 14px; flex-shrink: 0; display: grid; place-items: center;
  color: #fff; font-size: 20px; background: linear-gradient(135deg, #8b5cf6, #3b82f6 60%, var(--accent));
}
.g-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.g-dialog input[type="password"], .g-dialog textarea {
  font: inherit; font-size: 14px; padding: 11px 13px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--chip); color: var(--ink);
}
.g-dialog input[type="text"], .g-dialog select { font-size: 14px; padding: 11px 13px; border-radius: 12px; }
.g-dialog textarea { resize: vertical; line-height: 1.5; }
.g-dialog input:focus, .g-dialog textarea:focus { outline: none; border-color: var(--accent); background: var(--panel); }
.g-dialog input:disabled, .g-dialog select:disabled, .g-dialog textarea:disabled { opacity: .6; }
.g-dialog .g-field label small { font-weight: 400; color: var(--muted); }
.g-check { display: flex; align-items: center; gap: 6px; font-size: 12px !important; font-weight: 600 !important; color: var(--muted); cursor: pointer; }
.g-note { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.g-ai-progress { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; background: var(--chip); }
.g-ai-progress p { margin: 0; font-size: 13px; font-weight: 700; }
#g-ai-fill { height: 100%; width: 0; background: linear-gradient(90deg, #8b5cf6, var(--accent)); transition: width .25s; }
.g-ai-errors { margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--coral); max-height: 90px; overflow: auto; }
.g-ai-errors:empty { display: none; }
.g-dialog-foot { display: flex; gap: 8px; align-items: center; }
.g-spacer { flex: 1; }

/* ---------- 핸드폰에서 사진 보내기 ---------- */
.g-phone-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: -6px; }
.g-phone-btn svg { width: 18px; height: 18px; }
.g-phone-dialog { width: min(440px, calc(100% - 24px)); }
.g-phone-badge { background: linear-gradient(135deg, var(--accent), #3b82f6); }
.g-phone-badge svg { width: 22px; height: 22px; }
.g-phone-qr {
  width: 232px; height: 232px; margin: 0 auto; padding: 10px; border-radius: 18px; background: #fff;
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.g-phone-qr svg { display: block; width: 100%; height: 100%; }
.g-phone-url { margin: -6px 0 0; font-size: 11px; color: var(--muted); text-align: center; word-break: break-all; }
.g-phone-warn { margin: 0; padding: 10px 12px; border-radius: 12px; font-size: 12px; font-weight: 600; color: #b45309; background: #fff4dc; }
.g-phone-status { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--chip); font-size: 13px; font-weight: 700; text-align: center; }
.g-phone-status.is-ok { color: var(--accent-ink); background: var(--accent-soft); }
.g-phone-status.is-error { color: #fff; background: var(--coral); }
.g-phone-request {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 14px; background: #fff4dc; color: #7c4a03;
}
.g-phone-request p { margin: 0; font-size: 13px; font-weight: 600; }
.g-phone-request div { display: flex; gap: 6px; }
@media (prefers-color-scheme: dark) { .g-phone-request { background: #2b2618; color: #fbbf24; } }
#g-phone-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #3b82f6); transition: width .2s; }

.g-toast {
  position: fixed; left: 50%; top: 24px; transform: translate(-50%, -12px); z-index: 60;
  max-width: calc(100% - 32px); padding: 11px 20px; border-radius: 999px; text-align: center;
  background: var(--ink); color: var(--panel); font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.g-toast.show { opacity: 1; transform: translate(-50%, 0); }
.g-tip { margin: 0 8px; font-size: 12px; color: var(--accent-ink); font-weight: 600; }
.g-tip::before { content: "✎ "; }
.g-frame-wrap { flex: 1; min-height: 0; margin: 0 -14px; }
#g-frame { width: 100%; height: 100%; border: 0; display: block; }

/* ---------- 진행 표시 ---------- */
.g-progress {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50;
  width: min(360px, calc(100% - 32px)); padding: 14px 18px; border-radius: 18px;
  background: var(--panel); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
  font-size: 13px; font-weight: 700;
}
.g-progress-bar { height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; }
#g-progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #3b82f6); transition: width .2s; }

@media (max-width: 640px) {
  .g-card { padding: 28px 20px 22px; border-radius: 24px; }
  .g-card h1 { font-size: 25px; }
  .g-sun { width: 76px; height: 76px; top: 4%; right: 6%; }
  .g-editor { padding: 10px 10px 0; }
  .g-frame-wrap { margin: 0 -10px; }
  .g-bar-actions { width: 100%; }
  .g-bar-actions > .g-btn { flex: 1; }
  .g-tip { display: none; }
  .g-grid-2 { grid-template-columns: 1fr; }
  .g-dialog-body { padding: 22px 18px 18px; }
}
