* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background: #000;
  color: #fff;
  font-family: Arial, sans-serif;
}

.app-shell {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 4px 8px 12px;
}

/* HEADER */
.top-header {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px 8px;
}

.back-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.22);
  font-size: 24px;
  line-height: 1;
  color: #fff;
  text-decoration: none;
}

.memelab-title-wrap {
  min-width: 0;
}

.memelab-title-wrap h1 {
  margin: 0;
  color: #00e5ff;
  font-size: 19px;
  line-height: 1.05;
}

.memelab-title-wrap p {
  margin: 4px 0 0;
  color: rgba(255,255,255,0.64);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

/* SECTIONS */
.section {
  width: 100%;
  margin-bottom: 7px;
}

/* CANVAS */
.canvas-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #090909;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,43,214,0.75);
  position: relative;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  position: relative;
  z-index: 1;
}

/* INPUTS */
textarea,
input,
select {
  width: 100%;
  display: block;
  min-height: 38px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.065);
  color: #fff;
  margin: 0 0 6px;
  font-size: 13px;
  outline: none;
  font-family: Arial, sans-serif;
}

textarea {
  min-height: 118px;
  resize: vertical;
  line-height: 1.35;
}

.prompt-section textarea {
  border-color: rgba(0,229,255,0.9);
  background: rgba(0,229,255,0.09);
  font-size: 14px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(0,229,255,1);
  background: rgba(0,229,255,0.12);
}

textarea::placeholder,
input::placeholder {
  color: rgba(255,255,255,0.65);
}

select {
  appearance: none;
  -webkit-appearance: none;
}

select,
select option {
  background: #111;
  color: #fff;
}

select option:checked {
  background: #ff2bd6;
  color: #fff;
}

/* ROWS */
.row {
  width: 100%;
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.row > * {
  flex: 1 1 0;
  min-width: 0;
}

.row select {
  margin-bottom: 0;
}

/* BUTTONS */
button,
.upload-box {
  width: 100%;
  min-height: 40px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.07);
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  line-height: 1.1;
  cursor: pointer;
  font-family: Arial, sans-serif;
  text-align: center;
}

button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.primary-btn {
  background: rgba(255,43,214,0.18);
  border-color: rgba(255,43,214,0.8);
}

.secondary-btn {
  background: rgba(255,255,255,0.055);
  border-color: rgba(255,255,255,0.24);
}

.x-btn {
  background: rgba(255,255,255,0.065);
  border-color: rgba(255,255,255,0.36);
}

/* UPLOAD BUTTON */
.upload-box {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 6px;
}

.upload-box span {
  opacity: 0.65;
  font-weight: 700;
  margin-left: 4px;
}

.upload-box input {
  display: none;
}

/* X HELP */
.x-instructions {
  font-size: 10.5px;
  color: rgba(255,255,255,0.62);
  margin: 0 0 4px;
  line-height: 1.25;
  text-align: center;
}

/* STATUS */
.status {
  min-height: 14px;
  font-size: 12px;
  line-height: 1.25;
  color: #00e5ff;
  margin: 3px 0 0;
}

.status.working {
  color: #ffeb00;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { opacity: .4; }
  50% { opacity: 1; }
  100% { opacity: .4; }
}

/* HIDDEN CAPTION FIELD */
#captionText[hidden] {
  display: none;
}

/* TAP */
button:active,
.upload-box:active,
.back-btn:active {
  transform: scale(0.97);
}

/* SMALL PHONES */
@media (max-width: 380px) {
  .top-header {
    min-height: 46px;
  }

  textarea {
    min-height: 104px;
  }

  button,
  textarea,
  input,
  select,
  .upload-box {
    font-size: 12px;
    padding: 9px;
  }
}
