:root {
  --bg: radial-gradient(120% 120% at 10% 20%, #f8fbff 0%, #eef2f7 45%, #e8ecf3 100%);
  --card: rgba(255, 255, 255, 0.78);
  --border: #e5e7eb;
  --text: #0f172a;
  --muted: #6b7280;
  --accent: #1d4ed8;
  --accent-soft: #e5ecff;
  --shadow: 0 18px 60px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'SF Pro Display', 'SF Pro Text', 'Inter', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

.hidden {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  background: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
}

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

.dot {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6ee7b7, #60a5fa);
  box-shadow: 0 12px 28px rgba(96, 165, 250, 0.3);
  display: grid;
  place-items: center;
}

.icon-badge i {
  width: 18px;
  height: 18px;
  color: #0f172a;
}

.title {
  font-weight: 700;
  letter-spacing: -0.01em;
}

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

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: 110%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.16);
  min-width: 190px;
  overflow: hidden;
  z-index: 20;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
}

.dropdown-item:hover {
  background: rgba(37, 99, 235, 0.08);
}

.dropdown-item i {
  margin-right: 0;
}

.search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 999px;
  box-shadow: none;
  min-width: 240px;
}

.search input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  width: 180px;
}

.search i {
  margin-right: 0;
}

button {
  border: none;
  cursor: pointer;
  padding: 12px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 120ms ease;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.28);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
  opacity: 0.94;
}

button.ghost {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

select {
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-weight: 600;
}

main {
  max-width: 1020px;
  margin: 32px auto 72px;
  padding: 0 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.card + .card {
  margin-top: 18px;
}

.file-drop {
  border: 1px dashed #d7dded;
  border-radius: 18px;
  padding: 24px;
  display: block;
  background: rgba(229, 236, 255, 0.6);
  color: var(--text);
  margin: 18px 0;
  text-align: center;
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease;
}

.file-drop:hover {
  border-color: #b8c7ff;
  transform: translateY(-1px);
}

.file-drop input {
  display: none;
}

.file-drop-body {
  display: grid;
  gap: 8px;
  place-items: center;
}

.big-plus {
  font-size: 34px;
  font-weight: 700;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

.label {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: -0.01em;
}

.value.small {
  font-size: 14px;
  word-break: break-all;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.file-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.log-list {
  display: grid;
  gap: 10px;
}

.log-item {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
}

.log-type {
  font-weight: 700;
}

.log-meta {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.file-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.9);
  display: grid;
  gap: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.file-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
}

.file-name {
  font-weight: 700;
  word-break: break-all;
  letter-spacing: -0.01em;
}

.file-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.file-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.chip {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 600;
}

.actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actions-row button {
  flex: 1;
  min-width: 120px;
}

.ghost.sm {
  padding: 9px 12px;
}

.link {
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.center {
  text-align: center;
}

.plus {
  font-size: 16px;
  margin-right: 6px;
}

.share-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.share-card {
  max-width: 520px;
  width: 100%;
  text-align: center;
  gap: 12px;
  display: grid;
}

.share-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  margin: 0 auto;
}

.share-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.share-actions button {
  min-width: 140px;
}

.log-list {
  display: grid;
  gap: 10px;
}

.log-item {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
}

.log-type {
  font-weight: 700;
}

.log-meta {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.progress {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: min(560px, 90%);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.progress-bar {
  height: 8px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  width: 0%;
  transition: width 120ms linear;
}

.progress-text {
  padding: 10px 14px;
  font-weight: 700;
  color: var(--text);
}

.code-editor {
  height: 320px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0f172a;
}

.code-fallback {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px;
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
}

.canvas-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

#draw-canvas {
  width: 100%;
  max-width: 900px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  margin-top: 10px;
}

.photo-area {
  display: grid;
  gap: 10px;
}

#photo-video,
#photo-canvas {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #000;
}

.record-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.record-controls span {
  font-weight: 600;
}

.editor-layout {
  max-width: 1100px;
  margin: 20px auto 60px;
  padding: 0 16px;
  display: grid;
  gap: 14px;
}

.editor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.editor-card {
  min-height: 60vh;
}

.icon-only {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 6px;
  border-radius: 10px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.icon-only:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #ef4444;
}

.icon-only i {
  margin-right: 0;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
}

.badge.subtle {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text);
}

button i,
.link i,
.share-badge i {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  vertical-align: middle;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 30;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  max-width: 520px;
  width: 92%;
  z-index: 31;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
}

.modal-card.wide {
  max-width: 960px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-body {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.field input,
.field select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 14px;
}

.radio-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

@media (max-width: 900px) {
  main {
    margin: 20px auto 56px;
    padding: 0 14px;
  }
  .topbar {
    padding: 12px 14px;
    gap: 12px;
  }
  .actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }
  .search {
    width: 100%;
    min-width: 0;
  }
  .search input {
    width: 100%;
  }
  .card {
    padding: 18px;
  }
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .card-title-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .stats {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  .file-list {
    grid-template-columns: 1fr;
  }
  .file-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .actions-row {
    flex-direction: column;
  }
  .actions-row button {
    width: 100%;
  }
  .editor-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .editor-layout {
    margin: 16px auto 54px;
    padding: 0 12px;
  }
  .share-card {
    padding: 18px;
  }
  .share-actions {
    width: 100%;
    flex-direction: column;
  }
  .share-actions button {
    width: 100%;
  }
  .modal-card.wide {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .actions {
    width: 100%;
    justify-content: flex-start;
  }
  .actions-row button {
    flex: 1 1 100%;
  }
}
