@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/eb-garamond-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

* { box-sizing: border-box; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #F4F4F2;
  color: #1A1A1A;
  min-height: 100dvh;
  touch-action: manipulation;
  color-scheme: light;
}

[hidden] { display: none !important; }

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
}

body:not(.has-photo) #app {
  justify-content: center;
}

.stage {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #F4F4F2;
}

body:not(.has-photo) .stage { display: none; }

#preview {
  display: block;
  width: 100%;
  background: #FFFFFF;
  border-radius: 12px;
  touch-action: none;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

body:not(.has-photo) .panel textarea,
body:not(.has-photo) #save { display: none; }

.file input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.file span,
button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  padding: 12px 16px;
}

.file { display: block; }

.file span,
#save,
#share {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: #1F5EFF;
  color: #FFFFFF;
}

body:not(.has-photo) .file span {
  min-height: 96px;
  font-size: 1.25rem;
}

button:disabled { opacity: 0.45; }

.ghost {
  background: transparent;
  color: #1A1A1A;
  width: 100%;
}

textarea {
  width: 100%;
  min-height: 88px;
  margin: 0;
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: #FFFFFF;
  color: #1A1A1A;
  font: inherit;
  resize: vertical;
}

.status {
  min-height: 1.2em;
  margin: 0;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  background: #F4F4F2;
}

.sheet p { margin: 0; }

.sheet img {
  width: 100%;
  border-radius: 12px;
  background: #FFFFFF;
}

body.sheet-open { overflow: hidden; }
