:root {
  --accent: #3b5bdb;
  --accent-soft: #edf2ff;
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --border: #e7e8ec;
  --danger: #d6336c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
ul { list-style: none; margin: 0; padding: 0; }
img { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.topbar {
  max-width: 1240px; margin: 0 auto; padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.footer { padding: 64px 24px 32px; text-align: center; font-size: 13px; }
.footer a { color: var(--muted); }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 38px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #cfd2d9; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f0f1f3; border-color: transparent; }
.btn:disabled { opacity: .6; cursor: default; }
[hidden] { display: none !important; }

/* 프로필 */
.profile { display: flex; gap: 40px; align-items: flex-start; padding: 48px 0 72px; }
.avatar {
  width: 144px; height: 144px; flex: none; border-radius: 50%;
  object-fit: cover; box-shadow: var(--shadow);
}
.avatar-empty {
  display: grid; place-items: center; background: var(--accent-soft);
  color: var(--accent); font-size: 56px; font-weight: 700;
}
.profile-body { min-width: 0; flex: 1; display: grid; gap: 16px; }
.profile-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.profile-head h1 { font-size: 32px; letter-spacing: -.02em; }
.bio { margin: 0; max-width: 68ch; color: #3d434c; white-space: pre-line; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  padding: 3px 12px; border-radius: 999px; font-size: 13px;
  background: #f0f1f3; color: #3d434c;
}
.tags-accent li { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.links { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 14px; font-weight: 600; }

/* 포트폴리오 */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-head h2 { font-size: 22px; letter-spacing: -.01em; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.sort-hint { margin: -8px 0 20px; font-size: 14px; color: var(--accent); }
.empty { color: var(--muted); padding: 48px 0; text-align: center; }

.grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.thumb { aspect-ratio: 16 / 9; background: #f0f1f3; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-btn { position: relative; display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.play {
  position: absolute; inset: 0; margin: auto; width: 56px; height: 56px;
  display: grid; place-items: center; border-radius: 50%;
  background: rgba(0, 0, 0, .6); color: #fff; transition: background .15s, transform .15s;
}
.play svg { width: 28px; height: 28px; margin-left: 3px; }
.thumb-btn:hover .play { background: var(--accent); transform: scale(1.06); }
.thumb-empty {
  height: 100%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 40px; font-weight: 700;
}
.card-body { flex: 1; padding: 18px 18px 8px; display: grid; gap: 8px; align-content: start; }
.card-title { font-size: 16px; overflow-wrap: anywhere; }
.card-desc {
  padding: 0; border: 0; background: none; text-align: left; cursor: pointer;
  font-size: 14px; line-height: 1.55; color: var(--muted);
  white-space: pre-line; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden;
}
.card-desc:hover { color: var(--text); }
.card-actions { display: flex; align-items: center; gap: 4px; padding: 8px 12px 12px; min-height: 56px; }
.spacer { flex: 1; }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.icon-btn-danger:hover { background: #fff0f6; color: var(--danger); }
.icon { width: 20px; height: 20px; }

/* 정렬모드 */
.grid.sorting .card { cursor: grab; outline: 2px dashed #c5cae0; outline-offset: 2px; user-select: none; }
.grid.sorting .card * { pointer-events: none; }
.grid.sorting .card.dragging { opacity: .4; }

/* 모달 */
.modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  padding: 28px; border: 0; border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  box-shadow: 0 20px 60px rgba(16, 24, 40, .25); overflow-y: auto;
}
.modal::backdrop { background: rgba(17, 20, 28, .5); }
.modal h3 { font-size: 20px; margin: 0 32px 20px 0; overflow-wrap: anywhere; }
.modal-x {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px;
  border: 0; border-radius: 50%; background: none; font-size: 22px; line-height: 1;
  color: var(--muted); cursor: pointer;
}
.modal-x:hover { background: #f0f1f3; }
.detail-desc { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: #3d434c; }
.modal-video { width: min(960px, calc(100vw - 32px)); padding: 0; background: #000; overflow: visible; }
.modal-video .modal-x { top: -44px; right: 0; color: #fff; }
.modal-video .modal-x:hover { background: rgba(255, 255, 255, .15); }
.video-frame { aspect-ratio: 16 / 9; }
.video-frame iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: var(--radius); }

/* 폼 */
.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: #3d434c; }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.form label.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.form em { color: var(--danger); font-style: normal; }
.form input:not([type=file]):not([type=checkbox]), .form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); font-size: 15px; font-weight: 400;
}
.form input[type=file] { font-size: 14px; font-weight: 400; max-width: 100%; }
.form textarea { resize: vertical; }
.form input:focus, .form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form .invalid { border-color: var(--danger) !important; }
.hint { font-weight: 400; color: var(--muted); }
.error, .form-error { font-weight: 500; color: var(--danger); font-size: 13px; }
.error:empty, .form-error:empty { display: none; }
.form-error { margin: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.login-box { max-width: 360px; margin: 64px auto; padding: 32px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.login-box h1 { font-size: 20px; margin-bottom: 20px; }
.login-box .form-error { margin-bottom: 12px; }

@media (max-width: 599px) {
  .container, .topbar { padding-left: 16px; padding-right: 16px; }
  .profile { flex-direction: column; gap: 24px; padding: 24px 0 48px; }
  .avatar { width: 104px; height: 104px; }
  .avatar-empty { font-size: 40px; }
  .profile-head h1 { font-size: 26px; }
  .modal { padding: 22px 18px; }
}
