:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --panel: #ffffff;
  --text: #151923;
  --muted: #737b89;
  --line: #dfe3ea;
  --primary: #2f6fec;
  --primary-dark: #1d55c6;
  --danger: #e53935;
  --shadow: 0 8px 24px rgba(28, 38, 58, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

button,
input {
  font: inherit;
  max-width: 100%;
}

.shell {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 12px 12px calc(96px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 2px 12px;
}

.topbar > div {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h2 {
  font-size: 17px;
}

.panel,
.preview-panel {
  width: 100%;
  max-width: 100%;
  margin: 10px 0;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.section-title,
.motion-row,
.grid2,
.slider-field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title span,
.status,
label,
.slider-field strong {
  color: var(--muted);
}

label {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
  font-weight: 700;
}

.field input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.grid2 {
  align-items: stretch;
  min-width: 0;
}

.grid2 > * {
  flex: 1 1 0;
  min-width: 0;
}

.upload {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 10px;
  border: 1px dashed #aeb7c6;
  border-radius: 8px;
  background: #f8fafc;
  text-align: center;
}

.upload input {
  display: none;
}

.preview-panel {
  padding: 12px;
}

.preview-frame {
  position: relative;
  height: 230px;
  overflow: hidden;
  border: 8px solid #566170;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(47, 111, 236, 0.10), transparent 35%),
    linear-gradient(0deg, #9da5b2, #b8bec8);
}

.preview-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 66%;
  transform: translate(-50%, -50%);
  padding: 12px 6px;
  color: #fff;
  font-size: 26px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.preview-logo::first-letter {
  color: var(--danger);
}

.hidden-dots span {
  position: absolute;
  width: 58px;
  height: 18px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(229, 57, 53, 0.55);
  font-size: 9px;
  font-weight: 800;
  text-align: center;
  line-height: 18px;
}

.tabs,
.position-grid {
  display: grid;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.tabs {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 14px;
  padding: 4px;
  border-radius: 8px;
  background: #edf0f5;
}

.tab,
.pill,
.position-grid button,
.primary {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.tab {
  background: transparent;
  color: var(--muted);
}

.tab.active,
.position-grid button.active,
.pill.active {
  background: var(--primary);
  color: #fff;
}

.position-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
}

.position-grid button {
  min-width: 0;
  padding: 0 5px;
  background: #edf0f5;
  color: #515b6b;
  font-size: 12px;
  overflow-wrap: anywhere;
  line-height: 1.12;
}

.slider-field {
  margin: 8px 0 18px;
}

.slider-field:last-child {
  margin-bottom: 2px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

.pill {
  flex: 1 1 0;
  background: #edf0f5;
  color: #515b6b;
}

.primary {
  padding: 0 16px;
  background: var(--primary);
  color: #fff;
}

.primary:active {
  background: var(--primary-dark);
}

.wide {
  width: 100%;
}

.bottom-actions {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  transform: translateX(-50%);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(244, 245, 247, 0.94);
  backdrop-filter: blur(12px);
}

.status {
  min-height: 18px;
  margin: 7px 0 0;
  font-size: 13px;
  text-align: center;
}

@media (max-width: 420px) {
  .shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .grid2 {
    display: block;
  }

  .grid2 > * + * {
    margin-top: 10px;
  }

  .position-grid button {
    min-height: 42px;
    font-size: 11px;
  }
}

@media (max-width: 360px) {
  .position-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .preview-frame {
    height: 200px;
  }
}
