:root {
  --screen-max: 460px;
  --status-h: 50px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --icon-size: 55px;
  --label-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100svh;
  overflow: hidden;
  color: #111111;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button {
  font: inherit;
}

[hidden] {
  display: none;
}

.phone-screen {
  position: relative;
  width: min(100vw, var(--screen-max));
  min-height: 100svh;
  margin: 0 auto;
  overflow: hidden;
  background: #ffffff;
  color: #111111;
}

.status-bar {
  position: relative;
  z-index: 4;
  height: calc(var(--status-h) + var(--safe-top));
  padding: var(--safe-top) 26px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #111111;
  pointer-events: none;
  user-select: none;
}

.status-time {
  min-width: 64px;
  font-size: 20px;
  font-weight: 680;
  line-height: 1;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.status-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 118px;
}

.signal-icon {
  width: 24px;
  height: 16px;
  display: block;
  flex: 0 0 auto;
}

.wifi-icon {
  width: 25px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
  margin-left: -2px;
}

.battery {
  position: relative;
  width: 35px;
  height: 16px;
  margin-left: -2px;
  flex: 0 0 auto;
}

.battery-shell {
  position: relative;
  width: 30px;
  height: 16px;
  border-radius: 5px;
  overflow: hidden;
  background: #d5d5d5;
}

.battery-level {
  position: absolute;
  inset: 0 auto 0 0;
  width: 80%;
  background: #111111;
}

.battery-num {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.07em;
  font-variant-numeric: tabular-nums;
}

.battery-cap {
  position: absolute;
  left: 31px;
  top: 50%;
  width: 3px;
  height: 5px;
  transform: translateY(-50%);
  border-radius: 0 999px 999px 0;
  background: #d5d5d5;
}

.desktop-matrix {
  height: calc(100svh - var(--status-h) - var(--safe-top));
  padding: 8px 16px calc(10px + var(--safe-bottom));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  background: #ffffff;
}

.launcher-grid {
  grid-column: 1 / 5;
  grid-row: 1 / 8;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(7, minmax(0, 1fr));
  align-items: stretch;
  justify-items: stretch;
}

.dock-grid {
  grid-column: 1 / 5;
  grid-row: 8 / 9;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: 1fr;
  align-items: stretch;
  justify-items: stretch;
  border-top: 1px solid #ececec;
  background: #ffffff;
}

.app-tile {
  appearance: none;
  border: 0;
  padding: 4px 2px;
  margin: 0;
  width: 100%;
  min-width: 0;
  background: transparent;
  color: inherit;
  display: grid;
  grid-template-rows: auto auto;
  align-content: center;
  justify-items: center;
  gap: 6px;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.app-tile:active .icon-box {
  transform: scale(0.94);
}

.icon-box {
  width: var(--icon-size);
  height: var(--icon-size);
  border-radius: 22.4%;
  overflow: hidden;
  display: block;
  background: transparent;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
  transform: translateZ(0);
  transition: transform 0.16s cubic-bezier(.2, .9, .2, 1);
}

.icon-box img {
  width: 100%;
  height: 100%;
  display: block;
  transform: scale(var(--icon-scale));
  transform-origin: 50% 50%;
  user-select: none;
  pointer-events: none;
}

.app-label {
  max-width: calc(var(--icon-size) + 28px);
  font-size: var(--label-size);
  font-weight: 500;
  line-height: 1.15;
  color: #111111;
  letter-spacing: 0.01em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dock-tile {
  gap: 5px;
}

.dock-tile .app-label {
  display: none;
}

.app-window {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-rows: calc(var(--status-h) + var(--safe-top)) 1fr;
  background: #ffffff;
}

.app-window[hidden] {
  display: none;
}

.app-window-bar {
  height: calc(var(--status-h) + var(--safe-top));
  padding: var(--safe-top) 16px 0;
  display: grid;
  grid-template-columns: 46px 1fr 46px;
  align-items: center;
  border-bottom: 1px solid #eeeeee;
  background: #ffffff;
  color: #111111;
}

.app-window-bar strong {
  grid-column: 2;
  text-align: center;
  font-size: 15px;
  font-weight: 650;
}

.app-back {
  appearance: none;
  border: 0;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: #111111;
  font-size: 34px;
  line-height: 1;
}

#AppIframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #ffffff;
}

@media (max-height: 720px) {
  :root {
    --icon-size: 52px;
    --label-size: 11px;
  }

  .desktop-matrix {
    padding-left: 12px;
    padding-right: 12px;
  }
}
