:root {
  color-scheme: light;
  --bg: #f7f7f2;
  --ink: #191a17;
  --muted: #65685f;
  --line: #deded4;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --shadow: 0 18px 44px rgba(25, 26, 23, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.topbar-actions,
.row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow,
.section-kicker {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 5vw, 4.6rem); /* CHANGED: clamp floor lowered for small screens */
  line-height: 0.96;
  max-width: 760px;
}

h2 {
  margin-bottom: 18px;
  font-size: 1.35rem;
}

.admin-link,
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  padding: 0 16px;
  font: inherit;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.admin-link {
  background: transparent;
  color: var(--ink);
}

button:hover,
.button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

button:disabled,
input:disabled,
textarea:disabled {
  cursor: wait;
  opacity: 0.62;
}

.admin-link:hover {
  color: var(--accent-dark);
  border-color: var(--accent-dark);
}

.notice {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 14px 16px;
  color: var(--muted);
}

.share-grid,
.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.share-card,
.share-panel,
.login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.share-card {
  display: flex;
  min-height: 230px;
  flex-direction: column;
  padding: 18px;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.type-pill {
  border-radius: 999px;
  background: #e6f4f1;
  color: var(--accent-dark);
  padding: 5px 9px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.share-card h2 {
  margin: 14px 0 10px;
}

.body-preview {
  overflow: hidden;
  display: -webkit-box;
  color: #373934;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
  white-space: pre-wrap;
}

.link-preview {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbf7;
  padding: 10px;
  color: #373934;
}

.link-preview.has-image {
  grid-template-columns: 88px 1fr;
}

.link-preview img {
  width: 88px;
  height: 88px;
  border-radius: 6px;
  object-fit: cover;
  background: #e9ebe2;
}

.link-preview p {
  margin: 5px 0;
  color: var(--muted);
}

.link-preview span {
  display: block;
  color: var(--accent-dark);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.file-preview {
  display: grid;
  place-items: center;
  min-height: 92px;
  border: 1px dashed #b8bbb0;
  border-radius: 8px;
  background: #fbfbf7;
  color: var(--muted);
  text-align: center;
}

/* CHANGED: fixed-size media container */
.media-preview {
  margin: 0;
}

.media-preview img,
.media-preview video {
  display: block;
  width: 100%;
  height: 240px;        /* CHANGED: fixed height instead of max-height */
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
  object-fit: contain;    /* CHANGED: cover fills the box uniformly; use 'contain' if you want letterbox */
}

.media-preview figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.card-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
  flex-wrap: wrap;
}

.subtle {
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-shell {
  max-width: 1220px;
}

.login-panel {
  max-width: 430px;
  padding: 22px;
}

.panel-form,
.share-panel {
  display: grid;
  gap: 14px;
}

.share-panel {
  padding: 20px;
}

label {
  display: grid;
  gap: 7px;
  color: #3c3f38;
  font-size: 0.92rem;
  font-weight: 750;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cfd2c8;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

input[type="range"] {
  padding: 0;
}

input[type="file"] {
  padding: 9px;
}

.check-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.range-value,
.form-message {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.upload-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.upload-progress progress {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #e7e8df;
}

.upload-progress progress::-webkit-progress-bar {
  background: #e7e8df;
}

.upload-progress progress::-webkit-progress-value {
  background: var(--accent);
}

.upload-progress progress::-moz-progress-bar {
  background: var(--accent);
}

.upload-progress span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
  min-width: 42px;
  text-align: end;
}

.manage-list {
  margin-top: 20px;
  display: grid;
  gap: 10px;
}

.manage-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
}

.manage-row strong {
  overflow-wrap: anywhere;
}

.danger {
  border-color: var(--danger);
  background: transparent;
  color: var(--danger);
}

.danger:hover {
  background: var(--danger);
  color: #fff;
}

.is-hidden {
  display: none !important;
}

/* CHANGED: 3-step responsive breakpoints */

/* Tablet: 2 columns */
@media (max-width: 860px) {
  .share-grid,
  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-link {
    width: 100%;
  }
}

/* Mobile: 1 column */
@media (max-width: 560px) {
  .share-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .shell {
    width: calc(100% - 24px);
    padding: 20px 0 40px;
  }

  .share-card {
    min-height: unset;
  }

  .media-preview img,
  .media-preview video {
    height: 200px; /* CHANGED: slightly shorter on phones */
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .admin-link,
  .topbar-actions button {
    flex: 1;
  }
}
