/* ============================================================
   다이빙 로그북 — 앱스토어 앱처럼 깔끔한 화면
   밝은 회색 바탕 + 흰 카드, 큰 제목, 목록은 구분선으로 묶음
   ============================================================ */
:root {
  --ocean: #0b74d1; --ocean-2: #0a5aa6; --deep: #062f52; --lagoon: #17a2c6;
  --coral: #ff6a4d; --kelp: #22a37a; --sun: #ffb800;

  --bg: #f2f3f7; --card: #ffffff; --card-2: #f6f7fa; --text: #111827; --muted: #6b7280; --line: #e6e8ee;
  --primary: var(--ocean); --primary-ink: #fff; --chip: #eef3fb; --chip-ink: #0b5fb0;
  --danger: #e5484d; --field: #f2f3f7;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 16px -6px rgba(16, 24, 40, .08);
  --radius: 20px; --tabbar-h: 0px;
  --critter: #0b5f8a; --critter-op: .07;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d11; --card: #161a21; --card-2: #1d222b; --text: #f2f4f7; --muted: #98a2b3; --line: #262c36;
    --primary: #3a9bff; --primary-ink: #fff; --chip: #1c2a3d; --chip-ink: #8cc2ff;
    --danger: #ff6369; --field: #1d222b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --critter: #7fd6f0;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; overscroll-behavior-x: none; }
body {
  color: var(--text); background: var(--bg); min-height: 100vh;
  font: 15px/1.55 "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased; letter-spacing: -.01em;
}
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 30px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.03em; font-weight: 800; }
h2 { font-size: 18px; margin: 0 0 14px; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 14px; margin: 0 0 12px; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 6px; }
h2 .ic { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--primary); font: inherit; cursor: pointer; }

/* ===== 배경 바다: 로그인 화면에서만 ===== */
.sea { display: none; position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
body.auth-mode .sea { display: block; }
.sea .critter, .sea .school svg { position: absolute; fill: var(--critter); color: var(--critter); opacity: var(--critter-op); }
.sea .c1 { width: 260px; height: 160px; top: 18%; left: -280px; animation: swim-r 95s linear infinite; }
.sea .c2 { width: 150px; height: 112px; top: 62%; right: -170px; transform: scaleX(-1); animation: swim-l 120s linear infinite 8s; }
.sea .c3 { position: absolute; top: 40%; left: -200px; width: 180px; height: 90px; animation: swim-r 70s linear infinite 20s; }
.sea .school svg { width: 42px; height: 21px; transform: scaleX(-1); }
.sea .school svg:nth-child(1) { left: 0; top: 10px; } .sea .school svg:nth-child(2) { left: 40px; top: 0; }
.sea .school svg:nth-child(3) { left: 52px; top: 34px; } .sea .school svg:nth-child(4) { left: 92px; top: 16px; }
.sea .school svg:nth-child(5) { left: 18px; top: 52px; }
.sea .c4 { width: 70px; height: 128px; top: 105%; right: 12%; animation: drift-up 80s linear infinite 4s; }
@keyframes swim-r { from { transform: translateX(0); } to { transform: translateX(calc(100vw + 600px)); } }
@keyframes swim-l { from { transform: scaleX(-1) translateX(0); } to { transform: scaleX(-1) translateX(calc(100vw + 400px)); } }
@keyframes drift-up { from { transform: translateY(0); } to { transform: translateY(-140vh); } }
.bubbles i {
  position: absolute; bottom: -20px; width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid rgba(190, 236, 250, .5); background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.55), transparent 60%);
  animation: bubble 18s ease-in infinite; opacity: .55;
}
.bubbles i:nth-child(1) { left: 6%; } .bubbles i:nth-child(2) { left: 14%; width: 6px; height: 6px; animation-delay: 3s; animation-duration: 14s; }
.bubbles i:nth-child(3) { left: 27%; width: 14px; height: 14px; animation-delay: 7s; animation-duration: 22s; }
.bubbles i:nth-child(4) { left: 41%; width: 7px; height: 7px; animation-delay: 1s; animation-duration: 16s; }
.bubbles i:nth-child(5) { left: 58%; animation-delay: 9s; } .bubbles i:nth-child(6) { left: 66%; width: 5px; height: 5px; animation-delay: 5s; animation-duration: 12s; }
.bubbles i:nth-child(7) { left: 78%; width: 12px; height: 12px; animation-delay: 11s; animation-duration: 20s; }
.bubbles i:nth-child(8) { left: 86%; width: 8px; height: 8px; animation-delay: 2s; }
.bubbles i:nth-child(9) { left: 93%; width: 6px; height: 6px; animation-delay: 13s; animation-duration: 15s; }
.bubbles i:nth-child(10) { left: 50%; width: 9px; height: 9px; animation-delay: 15s; animation-duration: 19s; }
@keyframes bubble { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: .6; } 50% { transform: translate(14px, -55vh); } 100% { transform: translate(-6px, -110vh); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sea * { animation: none !important; } .bubbles { display: none; } }

/* ===== 상단 바 (반투명 흰색, 앱 내비게이션 바 느낌) ===== */
.topbar {
  position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; gap: 20px;
  padding: 10px max(20px, env(safe-area-inset-right)) 10px max(20px, env(safe-area-inset-left));
  padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; white-space: nowrap; letter-spacing: -.03em; font-size: 18px; }
.brand img { width: 34px; height: 34px; border-radius: 10px; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { color: var(--muted); padding: 7px 14px; border-radius: 999px; white-space: nowrap; font-weight: 700; transition: background .15s, color .15s; }
.topbar nav a:hover { color: var(--text); background: var(--card-2); }
.topbar nav a.active { color: var(--primary); background: var(--chip); }
.topbar .btn.primary { background: var(--coral); border-color: var(--coral); }

/* ===== 아래쪽 탭 바 (휴대폰) ===== */
.tabbar { display: none; }
@media (max-width: 760px) {
  :root { --tabbar-h: calc(58px + env(safe-area-inset-bottom)); }
  .topbar { gap: 10px; padding-left: 16px; padding-right: 16px; }
  .topbar nav, .topbar #newBtn { display: none; }
  .brand { font-size: 17px; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
    height: var(--tabbar-h); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--card) 85%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line);
  }
  .tabbar[hidden] { display: none !important; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 700; padding-top: 6px; }
  .tabbar a svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a.active { color: var(--primary); }
  .tabbar .tab-add { padding-top: 0; }
  .tabbar .tab-add b {
    display: grid; place-items: center; width: 50px; height: 50px; margin-top: -18px; border-radius: 50%;
    background: var(--coral); color: #fff; font-size: 30px; font-weight: 500; line-height: 1;
    box-shadow: 0 8px 20px -6px rgba(255, 106, 77, .75), 0 0 0 5px var(--bg);
  }
}

main { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 26px 20px calc(96px + var(--tabbar-h)); }
@media (max-width: 760px) { main { padding: 18px 16px calc(28px + var(--tabbar-h)); } h1 { font-size: 27px; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }

.card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .card { border: 1px solid var(--line); } }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.notice { border-left: 4px solid var(--primary); }

/* ===== 버튼·입력 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0;
  background: var(--card-2); color: var(--text); padding: 11px 18px; border-radius: 12px; font: inherit; font-weight: 700;
  cursor: pointer; transition: transform .1s, filter .15s, background .15s; white-space: nowrap; min-height: 42px;
}
.card .btn:not(.primary):not(.coral):not(.solid) { background: var(--field); }
.btn:hover { filter: brightness(.97); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.coral { background: var(--coral); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; }
.btn.small { padding: 7px 13px; font-size: 14px; min-height: 36px; border-radius: 10px; }
.btn.icon-btn { padding: 0; width: 42px; }
.btn.small.icon-btn { width: 38px; }
.btn.icon-btn .ic { width: 20px; height: 20px; color: var(--primary); }
.btn:disabled, .btn.disabled { opacity: .45; cursor: default; pointer-events: none; }

label.f, .lbl { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 700; min-width: 0; }
.label-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--field); border: 1.5px solid transparent; border-radius: 12px;
  padding: 11px 13px; width: 100%; min-width: 0; min-height: 46px; transition: border-color .15s, background .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); background: var(--card); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2398a2b3' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.fields { display: grid; gap: 14px 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.fields .wide { grid-column: 1 / -1; }
.fields .w2 { grid-column: span 2; }
@media (max-width: 420px) { .fields { grid-template-columns: 1fr 1fr; } .fields .w2 { grid-column: 1 / -1; } }
.unit { position: relative; }
.unit input { padding-right: 46px; }
.unit::after { content: attr(data-unit); position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; font-weight: 600; pointer-events: none; }
.check { flex-direction: row !important; align-items: center; gap: 10px; padding-top: 22px; color: var(--text) !important; font-weight: 600 !important; font-size: 14px !important; }
.check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--primary); }
.fields .check.wide { padding-top: 2px; }

/* 로그 작성: 섹션마다 카드 */
.dive-form { display: grid; gap: 14px; }
fieldset.sec { border: 0; margin: 0; padding: 18px 20px 20px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
@media (prefers-color-scheme: dark) { fieldset.sec { border: 1px solid var(--line); } }
fieldset.sec legend { float: left; width: 100%; font-weight: 800; font-size: 17px; margin: 0 0 16px; padding: 0; display: flex; gap: 10px; align-items: center; letter-spacing: -.02em; }
fieldset.sec legend + * { clear: both; }
fieldset.sec legend .n { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--chip); color: var(--primary); }
fieldset.sec legend .n .ic { width: 17px; height: 17px; }
.form-actions {
  position: sticky; bottom: var(--tabbar-h); z-index: 5; display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 0 max(12px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%);
}
.form-actions .btn { min-width: 96px; }

.stars { display: flex; gap: 2px; min-height: 46px; align-items: center; }
.stars button { border: 0; background: none; font-size: 30px; line-height: 1; color: var(--line); cursor: pointer; padding: 0 2px; transition: transform .1s; }
.stars button:hover { transform: scale(1.12); }
.stars button.on { color: var(--sun); }
@media (max-width: 420px) { .stars button { font-size: 25px; padding: 0 1px; } }

/* ===== 로그인 화면: 바닷속 장면 ===== */
body.auth-mode { background: linear-gradient(180deg, #2bb5d8 0%, #0b5f8a 35%, #07304d 70%, #041a2b 100%) fixed; }
body.auth-mode main { max-width: none; padding: 0; }
body.auth-mode .sea { --critter: #b9ecfa; --critter-op: .22; }
body.auth-mode .sea .rays {
  position: absolute; inset: -10% -10% 30%;
  background: repeating-conic-gradient(from 200deg at 50% -10%, rgba(255,255,255,.10) 0deg 4deg, transparent 4deg 13deg);
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%); -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  animation: rays 12s ease-in-out infinite alternate;
}
@keyframes rays { from { transform: rotate(-2deg); opacity: .8; } to { transform: rotate(2deg); opacity: 1; } }
.scene { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 40px 16px 160px; overflow: hidden; }
.scene .floor { position: absolute; left: 0; right: 0; bottom: 0; height: 170px; pointer-events: none; }
.scene .floor .sand { position: absolute; left: -5%; right: -5%; bottom: -40px; height: 90px; border-radius: 50% 50% 0 0; background: #0d3a4f; }
.scene .floor svg { position: absolute; bottom: 20px; }
.scene .k1 { left: 6%; width: 40px; height: 150px; color: #1f7f68; fill: #1f7f68; animation: sway 6s ease-in-out infinite; transform-origin: bottom; }
.scene .k2 { left: 11%; width: 30px; height: 110px; color: #2e9e7a; fill: #2e9e7a; animation: sway 7s ease-in-out infinite reverse; transform-origin: bottom; }
.scene .k3 { right: 9%; width: 36px; height: 130px; color: #1f7f68; fill: #1f7f68; animation: sway 6.5s ease-in-out infinite; transform-origin: bottom; }
.scene .co1 { left: 20%; width: 90px; height: 80px; color: #ff7a59; }
.scene .co2 { right: 16%; width: 70px; height: 64px; color: #f2a541; }
.scene .co3 { right: 25%; width: 50px; height: 46px; color: #e8577a; }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.scene .nemo { position: absolute; width: 46px; height: 23px; fill: #ff8a3d; animation: bob 4s ease-in-out infinite; }
.scene .nemo.n1 { left: 24%; bottom: 120px; } .scene .nemo.n2 { left: 29%; bottom: 140px; width: 34px; height: 17px; animation-delay: .6s; }
@keyframes bob { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(6px, -8px); } }
.auth { position: relative; z-index: 2; width: 100%; max-width: 410px; }
.auth .hero { text-align: center; margin-bottom: 22px; color: #fff; }
.auth .hero img { width: 80px; height: 80px; border-radius: 22px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.auth .hero h1 { font-size: 30px; margin-top: 12px; }
.auth .hero p { color: #c8eefa; margin: 6px 0 0; }
.auth .card { background: rgba(255,255,255,.95); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 30px 60px -20px rgba(0, 15, 30, .6); border: 0; }
@media (prefers-color-scheme: dark) { .auth .card { background: rgba(22, 26, 33, .92); } }
.auth form { display: grid; gap: 14px; }
.auth .btn.primary { min-height: 50px; font-size: 16px; }
.auth .feats { display: flex; justify-content: center; gap: 18px; margin-top: 18px; color: #c8eefa; font-size: 13px; flex-wrap: wrap; }
.auth .feats span { display: flex; align-items: center; gap: 6px; }
.err { color: var(--danger); font-size: 14px; min-height: 1em; }

/* ===== 큰 배너 (대시보드·커뮤니티·프로필) ===== */
.hero-banner {
  position: relative; overflow: hidden; border-radius: 24px; padding: 24px; margin-bottom: 16px; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, #2bb5e0 0%, #0b74d1 45%, #062f52 100%);
}
.hero-banner > * { position: relative; }
.hero-banner h1 { font-size: 26px; }
.hero-banner p { color: rgba(255,255,255,.8); margin: 4px 0 0; }
.hero-banner .critter, .detail-hero .critter { position: absolute; right: 20px; bottom: -8px; width: 170px; height: 128px; fill: rgba(255,255,255,.13); color: rgba(255,255,255,.13); --critter-line: rgba(6, 47, 82, .2); }
.hero-banner .big { display: flex; align-items: baseline; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.hero-banner .big b { font-size: 54px; line-height: 1; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.hero-banner .big span { color: rgba(255,255,255,.85); font-weight: 600; }
.hero-banner .actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.hero-banner .btn.ghost { background: rgba(255,255,255,.18); color: #fff; }
.detail-hero .critter { top: 54px; bottom: auto; width: 210px; height: 132px; }
@media (max-width: 640px) { .detail-hero .critter, .hero-banner .critter { width: 110px; height: 82px; right: 8px; } .hero-banner .big b { font-size: 46px; } }

.stats { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); margin-bottom: 16px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } .stats.six { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1060px) { .stats.six { grid-template-columns: repeat(6, 1fr); } }
.stat { background: var(--card); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .stat { border: 1px solid var(--line); } }
.stat .si { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 12px; color: var(--primary); background: var(--chip); }
.stat:nth-child(2) .si { color: var(--kelp); background: color-mix(in srgb, var(--kelp) 14%, transparent); }
.stat:nth-child(3) .si { color: #5b5bd6; background: color-mix(in srgb, #5b5bd6 14%, transparent); }
.stat:nth-child(4) .si { color: var(--coral); background: color-mix(in srgb, var(--coral) 14%, transparent); }
.stat:nth-child(5) .si { color: #d99a00; background: color-mix(in srgb, var(--sun) 18%, transparent); }
.stat:nth-child(6) .si { color: #e5487a; background: color-mix(in srgb, #e5487a 14%, transparent); }
.stat .v { font-size: 26px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .v small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.stat .l { font-size: 13px; color: var(--muted); margin-top: 4px; }

.map { height: 420px; border-radius: 16px; overflow: hidden; z-index: 0; background: #aad3df; }
.map.small { height: 260px; }
@media (max-width: 640px) { .map { height: 300px; } .map.small { height: 240px; } }
.legend { display: inline-flex; align-items: center; gap: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }

.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: 80px 1fr 34px; align-items: center; gap: 10px; font-size: 13px; }
.bar .t { height: 10px; background: var(--card-2); border-radius: 5px; overflow: hidden; }
.bar .t i { display: block; height: 100%; background: var(--primary); border-radius: 5px; }
.bar .k { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.cols { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 6px; }
.cols .c { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; min-width: 0; }
.cols .c i { width: 100%; max-width: 30px; background: var(--primary); border-radius: 7px 7px 3px 3px; min-height: 3px; }
.cols .c span { font-size: 11px; color: var(--muted); }
.cols .c b { font-size: 11px; font-weight: 700; }
.cols .c.zero i { background: var(--card-2); }
.cols .c.zero b { color: var(--muted); font-weight: 500; }

/* ===== 목록: 구분선으로 묶은 앱 목록 ===== */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input { flex: 1 1 220px; background: var(--card); }
.toolbar select { flex: 0 1 150px; background-color: var(--card); }
.loglist { display: grid; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
@media (prefers-color-scheme: dark) { .loglist { border: 1px solid var(--line); } }
.card .loglist { background: none; box-shadow: none; border: 0; border-radius: 0; margin: 0 -8px; }
.logitem {
  position: relative; display: grid; grid-template-columns: 58px 1fr auto; gap: 14px; align-items: center; color: var(--text);
  padding: 12px 16px; transition: background .15s;
}
.card .logitem { padding: 10px 8px; border-radius: 12px; }
.logitem + .logitem::before { content: ""; position: absolute; top: 0; left: 88px; right: 0; height: 1px; background: var(--line); }
.card .logitem + .logitem::before { left: 80px; }
.logitem:hover { background: var(--card-2); }
.logitem .no {
  position: relative; width: 58px; height: 58px; border-radius: 14px; display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(160deg, #2bb5e0, #0b74d1) center/cover; color: #fff; font-weight: 800; font-size: 16px; letter-spacing: -.02em;
}
.logitem .no.img { color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.8); }
.logitem .t { font-weight: 700; letter-spacing: -.015em; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 16px; }
.logitem .s { font-size: 13px; color: var(--muted); margin-top: 1px; }
.logitem .r { text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; }
.logitem .r b { color: var(--text); font-size: 16px; font-weight: 800; }
.logitem .soc { display: flex; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 3px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--chip); color: var(--chip-ink); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.chip.coral { background: color-mix(in srgb, var(--coral) 13%, transparent); color: var(--coral); }
a.chip { text-decoration: none; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty svg.art { width: 140px; height: 104px; fill: var(--primary); color: var(--primary); opacity: .85; margin-bottom: 4px; animation: bob 5s ease-in-out infinite; --critter-line: rgba(255,255,255,.5); }
.empty h2 { justify-content: center; color: var(--text); font-size: 19px; }

/* ===== 로그 상세 ===== */
.detail-hero {
  position: relative; overflow: hidden; border-radius: 24px; color: #fff; margin-bottom: 14px; min-height: 220px;
  background: radial-gradient(120% 140% at 0% 0%, #2bb5e0 0%, #0b74d1 45%, #062f52 100%) center/cover;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 22px;
}
.detail-hero.photo::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 25%, rgba(0,0,0,.72)); }
.detail-hero > * { position: relative; }
.detail-hero .top { position: absolute; top: 16px; left: 18px; right: 18px; display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.detail-hero h1 { font-size: 30px; text-shadow: 0 2px 12px rgba(0,0,0,.25); }
.detail-hero .sub { color: rgba(255,255,255,.85); }
.detail-hero .sub a { color: #fff; font-weight: 700; }
.detail-hero .chip { background: rgba(255,255,255,.2); color: #fff; }
.detail-hero .btn { background: rgba(0,0,0,.28); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.detail-hero .btn.danger { color: #ffd2cc; }
.badge-no {
  display: inline-flex; flex-direction: column; align-items: center; line-height: 1; padding: 8px 13px 9px; border-radius: 14px;
  background: var(--coral); color: #fff; font-weight: 800; font-size: 24px; letter-spacing: -.03em;
}
.badge-no small { font-size: 10px; font-weight: 700; letter-spacing: .12em; opacity: .85; margin-bottom: 3px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; box-shadow: var(--shadow); }
.quick div { padding: 14px 8px; text-align: center; }
.quick div + div { border-left: 1px solid var(--line); }
.quick b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.03em; }
.quick b small { font-size: 13px; color: var(--muted); font-weight: 600; }
.quick span { font-size: 12px; color: var(--muted); }
@media (max-width: 500px) { .quick { grid-template-columns: repeat(2, 1fr); } .quick div:nth-child(3) { border-left: 0; } .quick div:nth-child(n+3) { border-top: 1px solid var(--line); } }
/* 항목: 이름은 왼쪽, 값은 오른쪽, 줄마다 구분선 */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 28px; }
.kv div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.kv div span { font-size: 14px; color: var(--muted); }
.kv div b { font-weight: 700; text-align: right; }
.profile > svg { width: 100%; height: auto; display: block; }
.profile .note { font-size: 12px; color: var(--muted); margin-top: 6px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.gallery .m { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--card-2); }
.gallery .m img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; transition: transform .3s; }
.gallery .m img:hover { transform: scale(1.04); }
.gallery .m .x { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 16px; }
.gallery .m .find { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 700; color: #fff; background: rgba(0,0,0,.5); padding: 4px 9px; border-radius: 999px; backdrop-filter: blur(4px); }
.video { width: 100%; max-height: 480px; border-radius: 14px; background: #000; }
.pre { white-space: pre-wrap; }
.nav-row { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; }
.dz { border: 1.5px dashed var(--line); border-radius: 14px; padding: 18px; text-align: center; color: var(--muted); font-size: 14px; }
.progress { height: 6px; background: var(--card-2); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--primary); width: 0; transition: width .2s; }
.progress i.indet { width: 35%; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* ===== 이용 등급·관리자 ===== */
.plan-badge { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; background: var(--chip); color: var(--chip-ink); }
.plan-badge.pro { background: linear-gradient(135deg, #ffd56b, #ff9f43); color: #4a2a00; }
.meter { margin-bottom: 14px; }
.meter-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 4px; }
.meter-top b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.plan-table th, .plan-table td { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: center; }
.plan-table th:first-child, .plan-table td:first-child { text-align: left; color: var(--muted); }
.plan-table th { font-size: 12px; color: var(--muted); }
.adm-list { display: grid; gap: 10px; }
.adm-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end; padding: 16px 18px; }
.adm-who b { font-size: 16px; }
.adm-edit { display: grid; grid-template-columns: 100px 180px 170px auto; gap: 8px; align-items: end; }
@media (max-width: 900px) { .adm-row { grid-template-columns: 1fr; } .adm-edit { grid-template-columns: 1fr 1fr; } }

/* ===== 프로필 사진 ===== */
.avatar { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  background: linear-gradient(160deg, #2bb5e0, #0b74d1); color: #fff; font-size: 12px; font-weight: 800; overflow: hidden; }
.avatar.item { width: 58px; height: 58px; font-size: 17px; background: linear-gradient(160deg, #ffa07a, var(--coral)); }
.avatar.lg { width: 64px; height: 64px; font-size: 20px; border: 3px solid rgba(255,255,255,.8); }
.avatar.xl { width: 92px; height: 92px; font-size: 28px; }
.hero-who { display: flex; align-items: center; gap: 14px; }
.hero-who h1 { margin: 0; }
.avatar-edit { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.comment .av { width: 36px; height: 36px; }
.av-wrap { position: relative; width: 36px; height: 36px; }
.av-wrap .badge { position: absolute; right: -6px; bottom: -6px; font-size: 15px; line-height: 1; }

/* ===== 생물 도감 ===== */
.sp-head .searchrow { margin-bottom: 12px; }
.sp-groups { gap: 6px; }
.sp-groups .chip { border: 0; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; padding: 7px 13px; background: var(--card-2); color: var(--muted); }
.sp-groups .chip.on { background: var(--primary); color: #fff; }
.sp-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.sp-tools label.small { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; cursor: pointer; }
.sp-tools input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); }
.sp-area-tools { display: flex; gap: 6px; align-items: center; }
.sp-area-tools select { width: auto; min-height: 38px; padding-top: 6px; padding-bottom: 6px; font-size: 14px; }
.sp-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.sp-grid.small { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
@media (max-width: 420px) { .sp-grid, .sp-grid.small { grid-template-columns: repeat(2, 1fr); } }
.sp-card, .ident-item {
  position: relative; display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden; cursor: pointer; font: inherit; color: var(--text);
  background: var(--card); border: 0; border-radius: 18px; box-shadow: var(--shadow); transition: transform .15s;
}
@media (prefers-color-scheme: dark) { .sp-card, .ident-item { border: 1px solid var(--line); } }
.card .sp-card, .modal .sp-card { box-shadow: none; background: var(--card-2); }
.sp-card:hover, .ident-item:hover:not(:disabled) { transform: translateY(-2px); }
.sp-card.picked { outline: 3px solid var(--coral); outline-offset: -3px; }
.sp-card.picked::after { content: "✓"; position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; background: var(--coral); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.sp-img { display: grid; place-items: center; aspect-ratio: 4 / 3; background: linear-gradient(160deg, #2bb5e0, #0b74d1); overflow: hidden; }
.sp-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-ph { width: 60%; height: 50%; fill: rgba(255,255,255,.35); color: rgba(255,255,255,.35); --critter-eye: #0b74d1; }
.sp-txt { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; min-width: 0; }
.sp-txt b { font-weight: 800; letter-spacing: -.015em; }
.sp-txt i { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-meta { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-top: 4px; font-size: 11px; color: var(--muted); }
.sp-meta .chip { font-size: 11px; padding: 1px 7px; }

.modal { position: fixed; inset: 0; z-index: 3500; background: rgba(0, 0, 0, .5); display: grid; place-items: center; padding: 16px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-card { position: relative; width: 100%; max-width: 640px; max-height: calc(100vh - 32px); overflow: auto; background: var(--card); border-radius: 24px; padding: 20px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); }
@media (max-width: 640px) { .modal { place-items: end center; padding: 0; } .modal-card { border-radius: 24px 24px 0 0; max-height: 92vh; padding-bottom: max(20px, env(safe-area-inset-bottom)); } }
.modal-x { position: absolute; top: 12px; right: 12px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(0,0,0,.5); color: #fff; font-size: 20px; cursor: pointer; }
.picker-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.picker-head .modal-x { position: static; background: var(--card-2); color: var(--text); }
.picker .sp-grid { min-height: 160px; }
.picker-foot { position: sticky; bottom: -20px; display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 14px -20px -20px; padding: 12px 20px max(14px, env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
.picker-foot .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-gallery { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.sp-gallery figure { position: absolute; inset: 0; margin: 0; display: none; }
.sp-gallery figure.on { display: block; }
.sp-gallery img { width: 100%; height: 100%; object-fit: contain; }
.sp-gallery figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 6px; font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.sp-thumbs { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; }
.sp-thumbs button { flex: none; width: 54px; height: 54px; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; background: none; }
.sp-thumbs button.on { border-color: var(--coral); }
.sp-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-nophoto { display: grid; place-items: center; padding: 20px; border-radius: 16px; background: linear-gradient(160deg, #2bb5e0, #0b74d1); text-align: center; }
.sp-nophoto p { color: #e3f6fc !important; margin: 6px 0 0; }
.sp-path { margin: 6px 0 0; }
.sp-summary { margin-top: 12px; padding: 14px; background: var(--card-2); border-radius: 14px; }
.sp-summary p { margin: 0 0 6px; }
.sp-summary p:last-child { margin: 0; }
.sp-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }

.ident-top { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: start; }
.ident-top img { width: 120px; height: 120px; object-fit: cover; border-radius: 16px; }
.ident-top h2 { margin-bottom: 6px; }
.ident-top p { margin: 0 0 4px; }
.ident-list { display: grid; gap: 10px; margin-top: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.ident-item { background: var(--card-2); box-shadow: none; }
.ident-item:disabled { cursor: default; }
.conf { align-self: flex-start; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--kelp) 16%, transparent); color: var(--kelp); margin-bottom: 2px; }
.conf.mid { background: color-mix(in srgb, var(--sun) 22%, transparent); color: #a27300; }
.conf.low { background: var(--card-2); color: var(--muted); }

/* ===== 옆으로 넘겨 메뉴 이동 ===== */
#app.enter-r { animation: enter-r .28s cubic-bezier(.2, .7, .3, 1); }
#app.enter-l { animation: enter-l .28s cubic-bezier(.2, .7, .3, 1); }
#app.edge-r { animation: edge-r .3s ease; }
#app.edge-l { animation: edge-l .3s ease; }
@keyframes enter-r { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes enter-l { from { transform: translateX(-40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes edge-r { 40% { transform: translateX(-14px); } }
@keyframes edge-l { 40% { transform: translateX(14px); } }
@media (prefers-reduced-motion: reduce) { #app.enter-r, #app.enter-l, #app.edge-r, #app.edge-l { animation: none; } }

/* ===== 반응·댓글 ===== */
.reacts { display: flex; flex-wrap: wrap; gap: 6px; }
.react {
  display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid transparent; background: var(--card-2); color: var(--text); font: inherit; font-size: 14px; transition: transform .12s, background .15s;
}
.react .e { font-size: 18px; line-height: 1; }
.react b { font-weight: 800; font-variant-numeric: tabular-nums; }
.react:hover { transform: scale(1.05); }
.react.zero { opacity: .7; padding: 7px 10px; }
.react.zero:hover { opacity: 1; }
.react.on { background: color-mix(in srgb, var(--coral) 12%, var(--card)); border-color: var(--coral); color: var(--coral); }
.react.on .e { animation: pop .35s ease; }
@keyframes pop { 50% { transform: scale(1.35); } }
.react-who { margin: 8px 0 0; }
.comments { display: grid; gap: 12px; margin: 16px 0 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.comment { display: grid; grid-template-columns: 36px 1fr; gap: 10px; }
.comment .cb { min-width: 0; background: var(--card-2); border-radius: 4px 16px 16px 16px; padding: 9px 13px; }
.comment .ch { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 2px; }
.comment .ch a { color: var(--text); }
.comment .del { margin-left: auto; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.comment .del:hover { color: var(--danger); }
.cform .emoji-row { display: flex; gap: 2px; flex-wrap: wrap; margin-bottom: 6px; }
.cform .emoji-row button { border: 0; background: none; font-size: 21px; line-height: 1; padding: 5px; border-radius: 10px; cursor: pointer; }
.cform .emoji-row button:hover { background: var(--card-2); }
.cform .crow { display: flex; gap: 8px; align-items: flex-end; }
.cform textarea { min-height: 48px; flex: 1; }
.acts { display: grid; }
.act { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: center; color: var(--text); padding: 10px 4px; border-bottom: 1px solid var(--line); }
.act:last-child { border-bottom: 0; }
.act .at { font-size: 14px; line-height: 1.5; }
.act .q { display: block; color: var(--muted); font-size: 13px; }

/* ===== 자격증 ===== */
.cert-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
@media (max-width: 420px) { .cert-list { grid-template-columns: 1fr; } }
.cert { display: grid; grid-template-columns: auto 1fr; gap: 14px; background: var(--card-2); border-radius: 16px; padding: 12px; }
.cert-photos { display: grid; grid-template-columns: 1fr; gap: 6px; width: 116px; }
.cp { position: relative; aspect-ratio: 1.586; border-radius: 9px; overflow: hidden; background: var(--card); } /* 신용카드 비율 */
.cp img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.cp span { position: absolute; left: 6px; bottom: 4px; font-size: 10px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.cp .x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; font-size: 13px; line-height: 1; }
.cp.add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; border: 1.5px dashed var(--line); color: var(--muted); }
.cp.add span { position: static; color: var(--muted); text-shadow: none; font-size: 11px; }
.cp.add:hover { border-color: var(--primary); color: var(--primary); }
.cert-info { min-width: 0; display: flex; flex-direction: column; }
.cert-info .t { font-weight: 800; font-size: 16px; letter-spacing: -.015em; }
.cert-info .s { font-size: 13px; color: var(--muted); }
.cert-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 10px; }
.cert-form { background: var(--card-2); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.cert-form input, .cert-form select { background-color: var(--card); }

.searchrow { display: flex; gap: 8px; margin-bottom: 8px; }
.searchrow input { flex: 1; }
.results { display: grid; gap: 4px; margin-bottom: 8px; }
.results button { text-align: left; border: 0; background: var(--card-2); color: var(--text); border-radius: 12px; padding: 10px 12px; cursor: pointer; font: inherit; font-size: 14px; }
.results button:hover { background: var(--chip); }

#toast {
  position: fixed; left: 50%; bottom: calc(max(24px, env(safe-area-inset-bottom)) + var(--tabbar-h)); transform: translateX(-50%) translateY(20px); opacity: 0; transition: .25s;
  background: rgba(17, 24, 39, .92); color: #fff; padding: 12px 20px; border-radius: 14px; z-index: 3000; pointer-events: none;
  max-width: calc(100% - 32px); box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); font-weight: 600; font-size: 14px;
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { background: var(--danger); }
#lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .92); z-index: 4000; display: grid; place-items: center; cursor: zoom-out; }
#lightbox img { max-width: 96vw; max-height: 92vh; object-fit: contain; border-radius: 8px; }

.leaflet-container { font: inherit; }
.leaflet-popup-content { font-size: 13px; line-height: 1.55; }
.leaflet-popup-content-wrapper { border-radius: 14px; }
.popup-list { margin-top: 6px; display: grid; gap: 2px; }
.popup-list a { display: block; }
