*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0d0f;
  --surface: #18181c;
  --surface2: #222227;
  --border: #2a2a30;
  --accent: #7c6af7;
  --accent-hover: #6a59e0;
  --text: #e8e8ed;
  --text-muted: #888;
  --radius: 10px;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

header {
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.logo {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.3px;
}

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* Upload box */
.upload-box {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 44px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.upload-box:hover, .upload-box.drag-over {
  border-color: var(--accent);
  background: #1a1a22;
}

.upload-icon {
  font-size: 48px;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.upload-hint {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.upload-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.title-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 14px;
  font-size: 14px;
  width: 100%;
  max-width: 360px;
  margin-top: 6px;
  outline: none;
  transition: border-color 0.2s;
}

.title-input:focus { border-color: var(--accent); }

.btn-upload {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  margin-top: 4px;
}

.btn-upload:hover:not(:disabled) { background: var(--accent-hover); }
.btn-upload:disabled { opacity: 0.4; cursor: not-allowed; }

/* Progress */
.progress-wrap {
  margin-top: 24px;
  text-align: center;
}

.progress-bar {
  height: 6px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width 0.2s;
  border-radius: 99px;
}

.progress-label { font-size: 13px; color: var(--text-muted); }

/* Result */
.result-box {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.result-link {
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
  word-break: break-all;
}

.btn-copy, .btn-download {
  align-self: flex-start;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 18px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s;
  text-decoration: none;
}

.btn-copy:hover, .btn-download:hover { border-color: var(--accent); }

/* Recent section */
.recent-section { margin-top: 52px; }
.recent-section h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 18px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.clip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.clip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
}

.clip-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.clip-thumb-wrap {
  aspect-ratio: 16/9;
  background: var(--surface2);
  overflow: hidden;
  position: relative;
}

.clip-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clip-thumb-fallback {
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--accent);
  background: var(--surface2);
}

.clip-card-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.clip-card-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clip-card-meta { font-size: 12px; color: var(--text-muted); }

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

/* Login */
.login-box {
  max-width: 360px;
  margin: 80px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.login-box h2 { font-size: 20px; font-weight: 700; }
.login-box form { display: flex; flex-direction: column; gap: 12px; }
.login-box input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.login-box input:focus { border-color: var(--accent); }
.login-error { color: #f87171; font-size: 13px; }
.password-field {
  position: relative;
  display: flex;
  align-items: center;
}
.password-field input {
  width: 100%;
  padding-right: 68px;
}
.password-toggle {
  position: absolute;
  right: 7px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 8px;
}
.password-toggle:hover,
.password-toggle:focus {
  border-color: var(--border);
  outline: none;
}

/* Header user */
.header-user { margin-left: auto; font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.link-btn { background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* Clip card with actions */
.clip-card-wrap { display: flex; flex-direction: column; }
.clip-card-actions { display: flex; gap: 6px; padding: 6px 0 2px; }

/* Buttons */
.btn-sm {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 5px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-sm:hover { border-color: var(--accent); }
.btn-danger { border-color: #5a2020; color: #f87171; }
.btn-danger:hover { border-color: #f87171; background: #2a1010; }

/* Owner tag */
.owner-tag { color: var(--accent); font-size: 12px; }

/* Clip view page */
.clip-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.clip-title {
  font-size: 22px;
  font-weight: 700;
}

.clip-container video {
  width: 100%;
  border-radius: 12px;
  background: #000;
  max-height: 70vh;
}

.clip-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

@media (max-width: 540px) {
  .clip-grid { grid-template-columns: 1fr 1fr; }
  .upload-box { padding: 32px 16px; }
}
