:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #1a2744;
  background: #f0f6ff;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #1a2744;
  --muted: #68788a;
  --line: #d6e4f0;
  --canvas: #f0f6ff;
  --surface: #ffffff;
  --button: #c4dff0;
  --button-hover: #b0cce5;
  --warm: #b96035;
  --error: #a53931;
  --error-pale: #fae9e6;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 38vh) minmax(0, 1fr);
  background: var(--canvas);
}

.art-panel {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #27303f;
}

.art-background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.art-title {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  margin: 0;
  transform: translate(-50%, -50%);
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 38px;
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.72);
  white-space: nowrap;
}

.workspace {
  min-width: 0;
  min-height: 100vh;
  background: var(--canvas);
}

.site-shell {
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 0 38px;
}

.site-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-bottom: 1px solid var(--line);
}

.brand {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #fff;
}

.brand img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.main-content {
  min-height: calc(100vh - 76px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 38px 0;
}

.start-stage {
  width: min(100%, 560px);
  display: flex;
  justify-content: center;
}

.work-stage {
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--canvas);
}

#convert-form {
  display: grid;
  gap: 14px;
}

.primary-button,
.secondary-button {
  min-height: 54px;
  padding: 0 22px;
  border: 0;
  border-radius: 28px;
  background: var(--button);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.primary-button:hover,
.primary-button:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible {
  background: var(--button-hover);
}

.start-stage .primary-button {
  width: min(100%, 390px);
  min-height: 60px;
}

.secondary-button {
  width: 100%;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.file-input {
  display: none;
}

.file-name {
  min-width: 0;
  margin: 0;
  padding: 12px 14px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.upload-feedback {
  min-height: 0;
  margin: 0;
  color: var(--error);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.upload-feedback:not(:empty) {
  margin-top: 2px;
}

.error-message {
  margin: 0;
  padding: 11px 12px;
  border-radius: 14px;
  background: var(--error-pale);
  color: var(--error);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.output-stage {
  display: grid;
  gap: 16px;
}

.download-link {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
}

.download-link span {
  color: var(--muted);
}

.download-link strong {
  overflow-wrap: anywhere;
}

.download-link:hover,
.download-link:focus-visible {
  border-color: var(--button-hover);
  outline: 2px solid var(--button-hover);
  outline-offset: 1px;
}

.auth-section {
  width: min(100%, 620px);
  display: grid;
  grid-template-columns: minmax(160px, 0.72fr) minmax(300px, 1.28fr);
  gap: 32px;
  align-items: start;
}

.auth-heading {
  padding-top: 10px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--warm);
  font-size: 12px;
  font-weight: 700;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
}

.auth-form {
  display: grid;
  gap: 18px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field label {
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

.form-field input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--button);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
}

.form-field input:focus-visible {
  outline: 2px solid var(--button-hover);
  border-color: var(--button-hover);
}

@media (max-width: 1000px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .art-panel {
    min-height: 300px;
    height: 300px;
  }

  .art-background {
    object-position: center 30%;
  }

  .art-title {
    font-size: 34px;
  }

  .workspace {
    min-height: calc(100vh - 300px);
  }

  .site-shell {
    width: min(100%, 820px);
  }

  .main-content {
    min-height: calc(100vh - 376px);
  }

  .auth-section {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .auth-heading {
    padding: 0;
  }
}

@media (max-width: 600px) {
  .art-panel {
    min-height: 280px;
    height: 280px;
  }

  .art-title {
    font-size: 32px;
  }

  .site-shell {
    width: calc(100% - 32px);
    padding: 0;
  }

  .site-header {
    min-height: 64px;
  }

  .main-content {
    min-height: calc(100vh - 344px);
    padding: 26px 0 34px;
  }

  .work-stage {
    padding: 20px;
  }

  h1 {
    font-size: 28px;
  }

  .auth-section {
    gap: 16px;
  }
}

@media (max-width: 1000px) and (max-height: 520px) {
  .app-shell {
    grid-template-columns: minmax(220px, 30vw) minmax(0, 1fr);
  }

  .art-panel {
    height: 100vh;
    min-height: 100vh;
  }

  .art-background {
    object-position: center 35%;
  }

  .art-title {
    font-size: 28px;
  }

  .workspace {
    min-height: 100vh;
  }

  .site-shell {
    width: 100%;
    padding: 0 20px;
  }

  .site-header {
    min-height: 54px;
  }

  .brand {
    width: 36px;
    height: 36px;
  }

  .main-content {
    min-height: calc(100vh - 54px);
    padding: 12px 0;
  }

  .work-stage,
  .auth-section {
    width: 100%;
    padding: 16px;
    gap: 10px;
  }

  .primary-button,
  .secondary-button {
    min-height: 42px;
    padding: 0 14px;
    font-size: 12px;
  }

  .start-stage .primary-button {
    min-height: 46px;
  }

  .file-name,
  .field-hint,
  .download-link {
    font-size: 12px;
  }

  .auth-section {
    grid-template-columns: minmax(120px, 0.72fr) minmax(210px, 1.28fr);
  }

  h1 {
    font-size: 26px;
  }
}
