:root {
  --ink: #0b1f1c;
  --ink-soft: #243833;
  --foam: #f3f7f5;
  --mist: #d7e6e0;
  --accent: #ff4d3d;
  --accent-deep: #e0382a;
  --ok: #0f9f6e;
  --danger: #b42318;
  --shadow: 0 24px 60px rgba(11, 31, 28, 0.14);
  --radius: 22px;
  --font-display: "Syne", sans-serif;
  --font-body: "Figtree", sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #c8efe3 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #ffe2c8 0%, transparent 45%),
    linear-gradient(165deg, #eef6f3 0%, #e7f0ec 45%, #f7f1ea 100%);
  background-attachment: fixed;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.app {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  animation: rise 480ms ease both;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--ink);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px rgba(11, 31, 28, 0.22);
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: -0.04em;
}

.icon-btn {
  border: 0;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
  color: var(--ink);
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.icon-btn:active {
  transform: scale(0.96);
}

.hero {
  margin-bottom: 22px;
  animation: rise 560ms ease both;
}

.hero h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 8vw, 3.1rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  font-weight: 800;
}

.hero p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: 28ch;
}

.composer {
  display: grid;
  gap: 12px;
  animation: rise 640ms ease both;
}

.field {
  width: 100%;
  min-height: 56px;
  border: 1px solid rgba(11, 31, 28, 0.1);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  border-radius: 18px;
  padding: 16px 18px;
  font: inherit;
  color: var(--ink);
  outline: none;
  box-shadow: var(--shadow);
  resize: vertical;
}

.field:focus {
  border-color: rgba(255, 77, 61, 0.55);
  box-shadow: 0 0 0 4px rgba(255, 77, 61, 0.15), var(--shadow);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn {
  border: 0;
  border-radius: 16px;
  min-height: 52px;
  padding: 0 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--ink);
  color: var(--foam);
  grid-column: 1 / -1;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  border: 1px solid rgba(11, 31, 28, 0.08);
}

.hint {
  margin: 8px 2px 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.hint a {
  color: var(--ink);
  font-weight: 700;
}

.status {
  margin-top: 18px;
  min-height: 1.2em;
  color: var(--ink-soft);
  font-weight: 600;
}

.status.error {
  color: var(--danger);
}

.media {
  margin-top: 22px;
  display: none;
  animation: rise 420ms ease both;
}

.media.visible {
  display: block;
}

.media-head {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.thumb {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  background: var(--mist);
  box-shadow: var(--shadow);
}

.platform-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.platform-row img {
  width: 18px;
  height: 18px;
}

.platform-row span {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.media-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.meta {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.section-label {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.format-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.format-list li button {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(11, 31, 28, 0.08);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.format-list li button:active {
  transform: scale(0.985);
}

.format-list li button:hover {
  border-color: rgba(255, 77, 61, 0.35);
  background: rgba(255, 255, 255, 0.9);
}

.format-title {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.format-sub {
  grid-column: 1 / -1;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.format-cta {
  align-self: center;
  color: var(--accent-deep);
  font-weight: 800;
  font-size: 0.85rem;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: end center;
  background: rgba(11, 31, 28, 0.35);
  padding: 16px;
}

.sheet.open {
  display: grid;
  animation: fade 180ms ease both;
}

.sheet-panel {
  width: min(560px, 100%);
  background: #f7fbf9;
  border-radius: 24px 24px 18px 18px;
  padding: 22px 18px max(18px, env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
  animation: slide 260ms ease both;
}

.sheet-panel h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: -0.03em;
}

.sheet-panel ol {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--ink-soft);
  display: grid;
  gap: 8px;
}

.sheet-panel code {
  font-size: 0.85rem;
  background: var(--mist);
  padding: 2px 6px;
  border-radius: 6px;
  word-break: break-all;
}

.sheet-actions {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(120%);
  background: var(--ink);
  color: var(--foam);
  padding: 12px 16px;
  border-radius: 999px;
  font-weight: 700;
  z-index: 30;
  transition: transform 240ms ease;
  max-width: min(90vw, 420px);
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slide {
  from {
    transform: translateY(24px);
  }
  to {
    transform: none;
  }
}

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