:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #050505;
  color: #f6f8fb;
}

* {
  box-sizing: border-box;
}

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

body {
  background: #050505;
}

button,
input,
select {
  font: inherit;
}

.app {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: #050505;
}

.preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 48dvh;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.88)),
    #090909;
}

canvas {
  width: min(100%, calc(100dvh - 252px) * 3 / 4);
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  display: block;
  background: #050505;
  touch-action: none;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  color: rgba(255, 255, 255, 0.86);
  text-align: center;
  pointer-events: none;
}

.empty-state strong {
  font-size: 22px;
  line-height: 1.2;
}

.empty-state span {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.58);
}

.empty-state.hidden {
  display: none;
}

.panel {
  padding: 14px 30px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(7, 7, 7, 0.98);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 14px;
  row-gap: 12px;
}

.icon-button {
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #161616;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.icon-button.primary {
  background: #12aee8;
  border-color: #12aee8;
}

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

.icon-button input {
  display: none;
}

.icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  font-size: 19px;
  line-height: 1;
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 14px;
  row-gap: 16px;
  margin-top: 18px;
  margin-left: auto;
  margin-right: auto;
  max-width: 720px;
}

label {
  min-width: 0;
}

.fields label {
  display: grid;
  gap: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  line-height: 1.2;
}

.fields label > span {
  display: block;
  height: 16px;
  line-height: 16px;
  text-align: center;
}

.fields input,
.fields select {
  width: 100%;
  height: 44px;
  line-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 0 12px;
  background: #111;
  color: #fff;
  outline: none;
  display: block;
  text-align: center;
}

.fields input::-webkit-date-and-time-value {
  text-align: center;
}

.fields input::-webkit-datetime-edit {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
}

.fields input::-webkit-datetime-edit-fields-wrapper {
  display: flex;
  align-items: center;
}

.fields input[type="range"] {
  padding: 0;
  height: 44px;
  accent-color: #2f8cff;
}

.fields .range-field {
  grid-column: 1 / -1;
}

.fields input:focus,
.fields select:focus {
  border-color: #12aee8;
}

.notice {
  max-width: 720px;
  margin: 16px auto 0;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.48);
  text-align: center;
}

@media (min-width: 840px) {
  .app {
    grid-template-columns: minmax(0, 1fr) 360px;
    grid-template-rows: 100dvh;
  }

  .preview {
    min-height: 100dvh;
  }

  canvas {
    width: min(100%, calc(100dvh * 3 / 4));
  }

  .panel {
    align-self: stretch;
    border-top: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding: 22px;
  }

  .fields {
    grid-template-columns: 1fr;
  }
}
