* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

:root {
  --background: #ffffff;
  --foreground: #1a1a1a;
  --muted: #f2f2f7;
  --muted-foreground: #8e8e93;
  --border: #e5e5ea;
  --blue: #007aff;
  --green: #34c759;
  --switch-off: #e9e9ea;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--background);
  color: var(--foreground);
  display: flex;
  justify-content: center;
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 440px;
  background: var(--background);
}

/* Top status bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 0;
  font-size: 14px;
  font-weight: 600;
}
.topbar-icons {
  display: flex;
  align-items: center;
  gap: 6px;
  }
  .topbar-icons svg,
  .device-status-icons svg {
  display: block;
  height: 12px;
  width: auto;
  }

/* Device preview */
.preview-wrap {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
}
.device {
  position: relative;
  overflow: hidden;
  background: #000;
  width: 294px;
  height: 617px;
  border-radius: 52px;
  border: 10px solid #1a1a1a;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.35);
}
.wallpaper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.island {
  position: absolute;
  left: 50%;
  top: 12px;
  height: 28px;
  width: 96px;
  transform: translateX(-50%);
  border-radius: 9999px;
  background: #000;
  z-index: 20;
}
.device-status {
  position: absolute;
  left: 0;
  right: 0;
  top: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}
.device-status-icons {
  display: flex;
  align-items: center;
  gap: 4px;
}
.device-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 64px 24px 28px;
  color: #fff;
}
.datetime {
  text-align: center;
}
.date {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.9;
}
.time {
  font-size: 72px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}
.device-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.circle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  width: 44px;
  border: none;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  cursor: pointer;
}
.device-name {
  flex: 1;
  text-align: center;
  line-height: 1.1;
  font-size: 30px;
}
.device-name.italic {
  font-style: italic;
}
.device-name.bold {
  font-weight: 700;
}
.home-indicator {
  margin: 20px auto 0;
  height: 4px;
  width: 112px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.7);
}

/* Sections */
.section {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
}
.title-section {
  padding-bottom: 12px;
  padding-top: 16px;
}
.title-section h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.segmented {
  margin-top: 12px;
  display: flex;
  border-radius: 10px;
  background: var(--muted);
  padding: 2px;
}
.seg-btn {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 6px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.seg-btn.active {
  background: var(--background);
  color: var(--foreground);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Rows */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  font-size: 16px;
}
.group {
  border-top: 1px solid var(--border);
}
.group .row {
  border-top: none;
}
.group .row-btn {
  border-top: 1px solid var(--border);
}
.row-btn {
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--foreground);
  text-align: left;
}
.row-btn:active {
  background: var(--muted);
}
.row-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.blue {
  color: var(--blue);
}
.chevron {
  color: var(--muted-foreground);
}
.name-input {
  flex: 1;
  background: transparent;
  border: none;
  text-align: right;
  font-size: 16px;
  color: var(--muted-foreground);
  outline: none;
}
.name-input:focus {
  color: var(--foreground);
}
.name-input::placeholder {
  color: rgba(142, 142, 147, 0.6);
}

.row-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
}
.muted {
  color: var(--muted-foreground);
}

/* Toggle */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 28px;
  width: 48px;
  border: none;
  border-radius: 9999px;
  background: var(--switch-off);
  cursor: pointer;
  transition: background 0.2s;
}
.toggle.on {
  background: var(--green);
}
.toggle .knob {
  position: absolute;
  height: 24px;
  width: 24px;
  border-radius: 9999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  left: 2px;
  transition: left 0.2s;
}
.toggle.on .knob {
  left: 22px;
}

/* Font grid */
.font-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.font-opt {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--muted);
  padding: 12px;
  font-size: 18px;
  color: var(--foreground);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.font-opt.italic {
  font-style: italic;
}
.font-opt.selected {
  border-color: var(--blue);
  background: rgba(0, 122, 255, 0.1);
}

/* Slider */
.slider-row {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.small-a {
  font-size: 12px;
}
.big-a {
  font-size: 24px;
}
.ios-slider {
  flex: 1;
  height: 4px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 9999px;
  background: #d1d1d6;
}
.ios-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 28px;
  width: 28px;
  border-radius: 9999px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}
.ios-slider::-moz-range-thumb {
  height: 28px;
  width: 28px;
  border: none;
  border-radius: 9999px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

/* Emoji keyboard sheet */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.sheet-backdrop {
  flex: 1;
  border: none;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
}
.keyboard {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  border-radius: 16px 16px 0 0;
  background: #d1d4db;
  padding-bottom: 4px;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.12);
}
.kb-search-wrap {
  padding: 8px 8px 0;
}
.kb-search {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  padding: 8px 12px;
  color: #6b7280;
}
.kb-search input {
  width: 100%;
  background: transparent;
  border: none;
  font-size: 14px;
  color: #111827;
  outline: none;
}
.kb-search input::placeholder {
  color: #6b7280;
}
.kb-grid {
  height: 224px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
}
.kb-section-label {
  padding: 0 4px 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
}
.kb-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  row-gap: 4px;
  margin-bottom: 8px;
}
.kb-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.kb-emoji:active {
  transform: scale(0.9);
}
.kb-empty {
  grid-column: span 8;
  padding: 24px 0;
  text-align: center;
  font-size: 14px;
  color: #6b7280;
}
.kb-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding: 4px 4px 0;
}
.kb-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  width: 36px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: #6b7280;
  cursor: pointer;
}
.kb-tab.active {
  background: rgba(0, 0, 0, 0.1);
  color: #111827;
}
.kb-tab.abc,
.kb-tab.del {
  color: #374151;
  font-size: 16px;
  font-weight: 500;
}
.kb-tabs-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-around;
}
