:root {
  --bg: #0f1115;
  --fg: #e6e8ef;
  --muted: #9aa4b2;
  --card: #151923;
  --accent: #4f8cff;
  --radius: 28px;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  --tile-size: clamp(92px, 12vw, 140px);
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: ui-rounded, system-ui, -apple-system, Segoe UI, Roboto,
    "SF Pro Rounded", "SF Pro", Arial, sans-serif;
  background: radial-gradient(1200px 800px at 20% -10%, #1b2335, #0f1115 60%),
    radial-gradient(800px 600px at 120% 10%, #1c2a3a, transparent 50%);
  color: var(--fg);
  user-select: none;
  overscroll-behavior: none;
}
header {
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(8px);
  background: linear-gradient(
    180deg,
    rgba(15, 17, 21, 0.8),
    rgba(15, 17, 21, 0.35) 60%,
    transparent
  );
  padding: env(safe-area-inset-top) 20px 10px 20px;
}
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.clock {
  font-weight: 600;
  letter-spacing: 0.2px;
}
.search {
  flex: 1;
  max-width: 520px;
  position: relative;
}
.search input {
  width: 100%;
  padding: 14px 44px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  outline: none;
  font-size: 16px;
  box-shadow: var(--shadow);
}
.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.7;
}

main {
  padding: 10px 24px 120px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--tile-size), 1fr));
  gap: 22px;
  align-items: start;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transform-origin: center;
  transition: transform 0.12s ease;
}
.tile:active {
  transform: scale(0.98);
}

.icon {
  width: var(--tile-size);
  height: var(--tile-size);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: white;
  font-size: clamp(36px, 5vw, 48px);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.02)
  );
  position: relative;
  overflow: hidden;
}
.icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    120% 120% at -20% -20%,
    rgba(255, 255, 255, 0.25),
    transparent 50%
  );
  mix-blend-mode: overlay;
}

.label {
  text-align: center;
  max-width: var(--tile-size);
  font-size: 15px;
  color: #eef;
  opacity: 0.95;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}
.badge {
  position: absolute;
  top: 6px;
  right: -6px;
  background: #ff5d5d;
  color: white;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

/* edit mode */
.tile.editable .icon {
  outline: 2px dashed rgba(255, 255, 255, 0.28);
  outline-offset: 4px;
}
.tile.jiggle {
  animation: jiggle 0.22s infinite alternate ease-in-out;
}
@keyframes jiggle {
  from {
    transform: rotate(-1.2deg);
  }
  to {
    transform: rotate(1.2deg);
  }
}
.delete-btn {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  color: #fff;
  background: #ff3b30;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  font-weight: 900;
  line-height: 0;
}
.tile.editable .delete-btn {
  display: flex;
}
.tile[draggable="true"] {
  -webkit-user-drag: element;
}

/* dock */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.dock-inner {
  pointer-events: auto;
  display: flex;
  gap: 14px;
  padding: 12px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.dock button {
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
}

/* modal */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.35);
  z-index: 20;
  padding: 24px;
}
.modal.show {
  display: grid;
}
.sheet {
  width: min(560px, 96vw);
  background: #0f131b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 20px;
}
.sheet h2 {
  margin: 0 0 12px;
}
.row {
  display: flex;
  gap: 12px;
  margin: 12px 0;
}
.row label {
  min-width: 88px;
  opacity: 0.85;
}
.row input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0b0f15;
  color: #fff;
}
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

/* color chips */
.colors {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.chip {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
}
.chip.selected {
  outline: 3px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}

/* hide scrollbars in kiosk */
::-webkit-scrollbar {
  width: 0;
  height: 0;
}
