:root {
  color-scheme: dark;
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: #0b0b0d;
  color: #f7f7f8;
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(circle at 84% 18%, rgba(193, 22, 19, 0.22), transparent 30rem),
    linear-gradient(180deg, #111114 0%, #050506 100%);
}

button,
input {
  font: inherit;
}

.app {
  width: min(100%, 28rem);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 1rem;
}

.preview-panel {
  min-height: 0;
  display: grid;
  place-items: center;
}

#posterCanvas,
.poster-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: min(68vh, 42rem);
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  background: #000;
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.4);
}

.poster-image {
  object-fit: contain;
  user-select: auto;
  -webkit-user-select: auto;
  -webkit-touch-callout: default;
}

[hidden] {
  display: none !important;
}

.control-panel {
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(12, 12, 14, 0.86);
  backdrop-filter: blur(18px);
}

.brand-row {
  display: grid;
  grid-template-columns: 6.2rem minmax(0, 1fr);
  gap: 0.8rem;
  align-items: center;
}

.brand-row img {
  width: 6.2rem;
  height: auto;
  object-fit: contain;
}

h1 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
  font-weight: 700;
}

p {
  margin: 0;
}

.brand-row p,
.status {
  color: rgba(247, 247, 248, 0.68);
  font-size: 0.82rem;
  line-height: 1.55;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

#avatarInput {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.button {
  min-height: 3rem;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.9rem;
  color: #fff;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    opacity 0.16s ease,
    background 0.16s ease;
}

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

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.primary {
  background: #cf1d1a;
}

.secondary {
  background: rgba(255, 255, 255, 0.14);
}

.secondary:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.2);
}

.status {
  margin-top: 0.75rem;
}

.copy-card {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.copy-card-header {
  display: flex;
  align-items: center;
}

h2 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.4;
}

.moment-copy {
  white-space: pre-line;
  line-height: 1.8;
  margin-top: 0.75rem;
  padding: 0.85rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(247, 247, 248, 0.9);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.copy-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.copy-button {
  width: 100%;
  background: rgba(255, 255, 255, 0.14);
}

@media (min-width: 800px) {
  .app {
    width: min(100%, 72rem);
    grid-template-columns: minmax(22rem, 32rem) minmax(20rem, 26rem);
    grid-template-rows: 1fr;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    padding-inline: 2rem;
  }

  .preview-panel {
    justify-content: end;
  }

  #posterCanvas,
  .poster-image {
    height: min(86vh, 48rem);
  }

  .control-panel {
    align-self: center;
  }
}

@media (max-height: 720px) {
  #posterCanvas,
  .poster-image {
    height: min(62vh, 35rem);
  }

  .control-panel {
    padding: 0.85rem;
  }
}
