:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f8f9fb;
  --ink: #171a21;
  --muted: #687082;
  --line: #e4e7ec;
  --brand: #f05a32;
  --brand-dark: #d94822;
  --success: #12805c;
  --danger: #c9362b;
  --warning: #9a6700;
  --shadow: 0 24px 70px rgba(20, 28, 45, 0.1);
  --radius-lg: 24px;
  --radius-md: 15px;
  font-family: Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 8%, rgba(240, 90, 50, 0.08), transparent 30rem),
    var(--bg);
}

button, input { font: inherit; }

button, .button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}

button:hover, .button:hover { transform: translateY(-1px); }
button:disabled { cursor: not-allowed; opacity: .55; transform: none; }

.button-primary {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 8px 18px rgba(240, 90, 50, .22);
}

.button-primary:hover { background: var(--brand-dark); }

.button-secondary { color: var(--ink); background: #eef0f4; }
.button-danger { color: var(--danger); background: #fff0ee; }
.button-small { min-height: 36px; padding: 0 12px; border-radius: 10px; font-size: 13px; }

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--surface);
  outline: none;
}

input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(240, 90, 50, .12);
}

label { display: grid; gap: 7px; color: #454b59; font-size: 13px; font-weight: 700; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.error-text { min-height: 20px; color: var(--danger); font-size: 13px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 850;
  letter-spacing: -.03em;
}

.brand img { width: 36px; height: 36px; }
.brand span { color: var(--muted); font-weight: 600; }

/* Public share page */
.public-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

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

.secure-note { color: var(--muted); font-size: 13px; }

.share-card {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
  min-height: 540px;
  overflow: hidden;
  border: 1px solid rgba(228, 231, 236, .8);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.preview-pane {
  min-height: 430px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #151b29;
}

.preview-pane > img {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  object-fit: cover;
}

.preview-badge {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 2;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  color: #fff;
  background: rgba(17,24,39,.72);
  backdrop-filter: blur(8px);
  font-size: 12px;
}

.share-details {
  padding: 46px 38px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.share-details h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.1;
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
}

.filename { margin: 14px 0 0; color: var(--muted); line-height: 1.55; overflow-wrap: anywhere; }

.file-meta {
  margin: 28px 0;
  padding: 18px 0;
  display: grid;
  gap: 13px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; font-size: 14px; }
.meta-row dt { color: var(--muted); }
.meta-row dd { margin: 0; font-weight: 700; text-align: right; }
.download-button { width: 100%; }
.privacy-note { margin: 16px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; text-align: center; }

.password-panel { margin-top: 28px; display: grid; gap: 12px; }
.password-panel .button-primary { width: 100%; }

.public-error {
  width: min(540px, calc(100% - 32px));
  margin: 80px auto;
  padding: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.public-error img { width: 52px; }
.public-error h1 { margin: 20px 0 10px; letter-spacing: -.035em; }
.public-error p { margin: 0; color: var(--muted); line-height: 1.6; }

/* Admin */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.login-card h1 { margin: 28px 0 8px; font-size: 30px; letter-spacing: -.04em; }
.login-card > p { margin: 0 0 26px; color: var(--muted); }
.login-form { display: grid; gap: 16px; }

.admin-shell { min-height: 100vh; }
.admin-header { height: 72px; padding: 0 max(24px, calc((100vw - 1420px) / 2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.9); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; }
.header-actions { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.admin-main { width: min(1420px, calc(100% - 48px)); margin: 0 auto; padding: 32px 0 56px; }
.admin-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.admin-intro h1 { margin: 0; font-size: 34px; letter-spacing: -.045em; }
.admin-intro p { margin: 8px 0 0; color: var(--muted); }

.admin-grid { display: grid; grid-template-columns: minmax(300px, .75fr) minmax(520px, 1.25fr); gap: 22px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 8px 28px rgba(20,28,45,.045); }
.panel-header { padding: 20px 20px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.panel-body { padding: 20px; }
.search-input { max-width: 240px; }

.file-list { max-height: 330px; overflow: auto; display: grid; gap: 7px; margin-top: 14px; }
.file-item { width: 100%; min-height: 58px; padding: 10px 12px; border: 1px solid transparent; border-radius: 12px; display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 10px; align-items: center; color: var(--ink); background: var(--surface-soft); text-align: left; }
.file-item:hover { border-color: #f1b7a7; background: #fff8f5; }
.file-item.selected { border-color: var(--brand); background: #fff5f1; }
.file-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--brand); background: #ffeae3; font-size: 11px; font-weight: 850; }
.file-copy { min-width: 0; }
.file-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 750; }
.file-sub { margin-top: 4px; display: block; color: var(--muted); font-size: 11px; }

.create-form { margin-top: 20px; padding-top: 20px; display: grid; gap: 14px; border-top: 1px solid var(--line); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.selected-path { min-height: 42px; padding: 11px 12px; border: 1px dashed #ccd1da; border-radius: 10px; color: var(--muted); background: var(--surface-soft); font-size: 12px; overflow-wrap: anywhere; }

.share-grid { padding: 20px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; }
.share-item { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.share-thumb { position: relative; aspect-ratio: 16 / 8.8; overflow: hidden; background: #171d2a; }
.share-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.status-pill { position: absolute; top: 10px; left: 10px; padding: 5px 8px; border-radius: 999px; color: #fff; background: rgba(18,128,92,.88); backdrop-filter: blur(6px); font-size: 10px; font-weight: 800; }
.status-pill.disabled, .status-pill.expired { background: rgba(83,91,107,.9); }
.share-copy { padding: 15px; }
.share-copy h3 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.share-copy > p { margin: 7px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.share-stats { margin: 14px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.share-stat { padding: 9px; border-radius: 9px; background: var(--surface-soft); }
.share-stat span { display: block; color: var(--muted); font-size: 10px; }
.share-stat strong { display: block; margin-top: 3px; font-size: 12px; }
.share-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.empty-state { padding: 54px 24px; color: var(--muted); text-align: center; grid-column: 1 / -1; }

.flash { margin-bottom: 18px; padding: 14px 16px; border: 1px solid #b8e3d3; border-radius: 12px; color: #0e694c; background: #edf9f4; }
.link-result { display: grid; gap: 10px; margin-top: 10px; }
.link-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.link-row input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

@media (max-width: 900px) {
  .share-card { grid-template-columns: 1fr; }
  .preview-pane { min-height: auto; aspect-ratio: 16 / 9; }
  .admin-grid { grid-template-columns: 1fr; }
  .share-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 620px) {
  .public-shell { width: min(100% - 20px, 1080px); padding-top: 18px; }
  .public-header { margin-bottom: 16px; }
  .secure-note { display: none; }
  .share-card { border-radius: 18px; }
  .share-details { padding: 30px 24px; }
  .share-details h1 { font-size: 30px; }
  .admin-header { padding: 0 16px; }
  .header-actions > span { display: none; }
  .admin-main { width: min(100% - 24px, 1420px); padding-top: 22px; }
  .admin-intro { align-items: flex-start; flex-direction: column; }
  .admin-intro h1 { font-size: 29px; }
  .panel-header { align-items: flex-start; flex-direction: column; }
  .search-input { max-width: none; }
  .field-row, .share-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

