:root {
  --navy: #062b4f;
  --deep-navy: #052747;
  --magenta: #8c1b79;
  --pink: #f6cfd9;
  --paper: #fff9f4;
  --ink: #111827;
  --muted: #6b7280;
  --line: #d8d8d8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.site-header {
  min-height: 82px;
  background: var(--navy);
  color: #ffffff;
  display: grid;
  grid-template-columns: 260px 1fr 260px;
  align-items: center;
  padding: 12px 20px;
}

.brand {
  color: #ffffff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 28px;
  font-weight: 800;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  background: #4338ca;
  border-radius: 8px;
  font-size: 22px;
}

.header-copy {
  text-align: center;
  font-size: 21px;
  line-height: 1.25;
}

.header-copy span {
  display: block;
  font-size: 18px;
}

.app-shell {
  width: min(980px, calc(100% - 32px));
  margin: 36px auto 48px;
  display: grid;
  grid-template-columns: 330px 360px;
  justify-content: center;
  align-items: start;
  gap: 34px;
  flex: 1;
}

.poster-panel {
  display: flex;
  justify-content: center;
}

#posterCanvas {
  width: min(100%, 270px);
  height: auto;
  display: block;
  border: 12px solid var(--magenta);
  background: var(--pink);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.controls-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.upload-card,
.name-card {
  width: 100%;
  background: var(--deep-navy);
  color: #ffffff;
  border-radius: 8px;
}

.upload-card {
  min-height: 162px;
  padding: 18px 72px 18px 24px;
  position: relative;
  cursor: pointer;
  display: grid;
  align-content: center;
  text-align: center;
  border: 0;
  font: inherit;
}

.upload-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.upload-title,
.name-card label {
  font-size: 24px;
  font-weight: 800;
}

.upload-help {
  margin-top: 24px;
  font-size: 16px;
  line-height: 1.1;
}

.upload-icon {
  position: absolute;
  right: 19px;
  top: 74px;
  width: 38px;
  height: 38px;
}

.upload-icon svg {
  width: 100%;
  height: 100%;
  fill: #ffffff;
}

.name-card {
  padding: 22px;
  display: grid;
  gap: 12px;
  text-align: center;
}

.name-card input {
  width: 100%;
  height: 45px;
  padding: 0 20px;
  border: 2px solid #83786c;
  border-radius: 999px;
  font-size: 16px;
  outline: none;
}

.name-card input:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
}

.nudge-grid {
  display: grid;
  grid-template-columns: repeat(4, 44px);
  justify-content: center;
  gap: 8px;
}

.nudge-grid button {
  width: 44px;
  height: 38px;
  border: 2px solid #667085;
  border-radius: 8px;
  background: #ffffff;
  color: var(--deep-navy);
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
}

.nudge-grid button:hover,
.nudge-grid button:focus-visible {
  border-color: #f59e0b;
}

.download-button {
  min-width: 134px;
  min-height: 46px;
  padding: 0 24px;
  border: 3px solid #667085;
  border-radius: 999px;
  background: var(--deep-navy);
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.download-button:hover,
.download-button:focus-visible {
  background: #0b3d70;
}

.site-footer {
  min-height: 108px;
  background: var(--navy);
  color: #ffffff;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  text-align: center;
  padding: 20px;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(5, 39, 71, 0.45);
}

.success-dialog,
.crop-dialog {
  width: min(380px, calc(100% - 32px));
  border-radius: 8px;
  padding: 24px;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  display: grid;
  gap: 14px;
  text-align: center;
}

.crop-dialog {
  width: min(430px, calc(100% - 32px));
}

.success-dialog strong,
.crop-dialog strong {
  color: var(--deep-navy);
  font-size: 24px;
}

.success-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.success-dialog button {
  width: 92px;
  height: 40px;
  justify-self: center;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: var(--magenta);
  font-weight: 800;
  cursor: pointer;
}

.crop-preview {
  width: 240px;
  height: 240px;
  justify-self: center;
  border-radius: 50%;
  background: #ffffff;
}

.crop-label {
  color: var(--deep-navy);
  font-size: 18px;
  font-weight: 800;
}

.crop-range {
  width: 100%;
  accent-color: var(--magenta);
}

.crop-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.primary-button,
.secondary-button {
  min-width: 92px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  background: var(--magenta);
}

.secondary-button {
  background: var(--deep-navy);
}

@media (max-width: 900px) {
  .site-header {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .brand {
    justify-self: center;
  }

  .header-copy {
    font-size: 18px;
  }

  .app-shell {
    width: min(100% - 24px, 680px);
    grid-template-columns: 1fr;
    margin-top: 24px;
    gap: 24px;
  }

  #posterCanvas {
    width: min(100%, 360px);
  }

  .controls-panel {
    width: min(100%, 520px);
    justify-self: center;
  }
}

@media (max-width: 460px) {
  .site-header {
    min-height: auto;
    padding: 16px 14px 18px;
    gap: 12px;
  }

  .brand {
    font-size: 34px;
    line-height: 1.05;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    font-size: 26px;
  }

  .header-copy,
  .header-copy span {
    font-size: 20px;
    line-height: 1.25;
  }

  .app-shell {
    width: calc(100% - 30px);
    margin: 22px auto 32px;
    gap: 22px;
  }

  #posterCanvas {
    width: min(100%, 292px);
    border-width: 8px;
  }

  .controls-panel {
    gap: 12px;
  }

  .upload-card {
    min-height: 142px;
    padding: 22px 62px 22px 18px;
  }

  .upload-title,
  .name-card label {
    font-size: 26px;
    line-height: 1.1;
  }

  .upload-help {
    margin-top: 18px;
    font-size: 18px;
    line-height: 1.2;
  }

  .upload-icon {
    right: 18px;
    top: 76px;
    width: 32px;
    height: 32px;
  }

  .name-card {
    padding: 18px;
  }

  .name-card input {
    height: 44px;
    font-size: 16px;
  }

  .site-footer {
    min-height: 92px;
    padding: 16px;
    gap: 8px;
    font-size: 14px;
  }

  .crop-dialog,
  .success-dialog {
    padding: 20px;
  }

  .crop-preview {
    width: 210px;
    height: 210px;
  }
}
