:root {
  color-scheme: dark;
  --ink: #f5f7f2;
  --muted: #aeb8b1;
  --line: rgba(245, 247, 242, 0.16);
  --panel: rgba(18, 24, 21, 0.82);
  --panel-strong: rgba(25, 32, 28, 0.96);
  --surface: #101512;
  --accent: #3fd0a2;
  --accent-strong: #1f8a6e;
  --amber: #e5b452;
  --coral: #e86f5d;
  --cream: #f1ead5;
  --shadow: rgba(0, 0, 0, 0.36);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #101512;
  color: var(--ink);
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.wallpaper {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(63, 208, 162, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(229, 180, 82, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 20% 15%, rgba(63, 208, 162, 0.16), transparent 28%),
    linear-gradient(135deg, #111612 0%, #151914 42%, #211915 100%);
  background-size: 48px 48px, 48px 48px, auto, auto;
}

.os-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(288px, 360px) 1fr;
  width: 100%;
  height: 100%;
}

.os-shell.browser-collapsed {
  grid-template-columns: 1fr;
}

.app-browser {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 18px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: rgba(12, 16, 14, 0.78);
  backdrop-filter: blur(18px);
  min-width: 0;
  overflow: auto;
}

.app-browser.collapsed {
  display: none;
}

.browser-header,
.desktop-topbar,
.window-titlebar,
.dock {
  display: flex;
  align-items: center;
}

.browser-header {
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

.browser-header h1 {
  font-size: 24px;
}

.launcher,
.suggestions,
.library {
  display: grid;
  gap: 10px;
}

.launcher label,
.suggestions h2,
.library h2 {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

textarea:focus,
input:focus {
  border-color: rgba(63, 208, 162, 0.7);
  box-shadow: 0 0 0 3px rgba(63, 208, 162, 0.18);
}

.primary-button,
.secondary-button,
.icon-button,
.menu-button {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
}

.primary-button {
  min-height: 42px;
  background: var(--accent-strong);
  border-color: rgba(63, 208, 162, 0.5);
  font-weight: 800;
}

.secondary-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.icon-button,
.menu-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  font-weight: 900;
}

.suggestion-grid,
.app-list,
.desktop-icons {
  display: grid;
  gap: 8px;
}

.suggestion-card,
.app-card,
.desktop-icon,
.dock-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
}

.suggestion-card {
  padding: 10px;
  min-height: 58px;
  display: grid;
  align-content: center;
}

.suggestion-card strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}

.suggestion-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.app-card {
  padding: 10px;
}

.app-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-card span {
  color: var(--muted);
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.desktop {
  position: relative;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.desktop-topbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 20;
  justify-content: space-between;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 16, 14, 0.64);
  backdrop-filter: blur(18px);
}

.system-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--cream);
  font-weight: 800;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(63, 208, 162, 0.18);
}

.status-dot.busy {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(229, 180, 82, 0.2);
}

.status-dot.error {
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(232, 111, 93, 0.2);
}

.clock {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.desktop-icons {
  position: absolute;
  top: 82px;
  left: 22px;
  z-index: 4;
  width: 132px;
}

.desktop-icon {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 12px 8px;
  text-align: center;
  min-height: 92px;
}

.desktop-icon-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-strong), var(--amber));
  color: #09120e;
  font-weight: 900;
}

.desktop-icon span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.window-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.app-window {
  position: absolute;
  pointer-events: auto;
  display: grid;
  grid-template-rows: 40px 44px 1fr;
  width: min(860px, calc(100vw - 56px));
  height: min(640px, calc(100vh - 128px));
  min-width: 320px;
  min-height: 320px;
  border: 1px solid rgba(245, 247, 242, 0.22);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel-strong);
  box-shadow: 0 24px 60px var(--shadow);
}

.app-window.maximized {
  top: 72px !important;
  left: 14px !important;
  width: calc(100vw - 28px) !important;
  height: calc(100vh - 148px) !important;
}

.window-titlebar {
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px 0 12px;
  background: rgba(255, 255, 255, 0.07);
  border-bottom: 1px solid var(--line);
  user-select: none;
}

.window-title {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 900;
}

.window-actions {
  display: inline-flex;
  gap: 6px;
}

.window-action {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 900;
}

.window-action.close {
  color: white;
  border-color: rgba(232, 111, 93, 0.45);
  background: rgba(232, 111, 93, 0.2);
}

.window-command {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.16);
}

.window-command input {
  min-width: 0;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.frame-wrap {
  position: relative;
  min-height: 0;
  background: #f7f8f3;
}

.frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: white;
}

.window-status {
  position: absolute;
  right: 10px;
  bottom: 10px;
  max-width: min(360px, calc(100% - 20px));
  padding: 8px 10px;
  border: 1px solid rgba(16, 21, 18, 0.14);
  border-radius: 8px;
  color: #14211b;
  background: rgba(247, 249, 247, 0.92);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}

.dock {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 30;
  transform: translateX(-50%);
  gap: 8px;
  max-width: calc(100vw - 32px);
  min-height: 50px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 16, 14, 0.7);
  backdrop-filter: blur(18px);
  overflow-x: auto;
}

.dock-button {
  min-width: 120px;
  max-width: 180px;
  height: 34px;
  padding: 0 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.empty-state {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 860px) {
  .os-shell {
    grid-template-columns: 1fr;
  }

  .app-browser {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(360px, calc(100vw - 24px));
    box-shadow: 20px 0 60px var(--shadow);
  }

  .app-browser.collapsed {
    display: none;
  }

  .desktop-icons {
    top: 76px;
    left: 14px;
    width: 108px;
  }

  .app-window {
    left: 10px !important;
    width: calc(100vw - 20px) !important;
    height: min(620px, calc(100vh - 126px));
  }
}

.phone-os {
  background: #050609;
}

.phone-os .wallpaper {
  background:
    linear-gradient(140deg, rgba(64, 103, 143, 0.72) 0%, rgba(25, 37, 57, 0.94) 34%, rgba(72, 42, 50, 0.9) 66%, rgba(10, 13, 18, 1) 100%),
    repeating-linear-gradient(120deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 18px);
}

.phone-os .os-shell {
  display: block;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

.phone-os .desktop {
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  margin: 0 auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 22%),
    linear-gradient(155deg, rgba(18, 22, 34, 0.45), rgba(14, 18, 24, 0.2));
}

.phone-os .desktop-topbar {
  top: 0;
  left: 0;
  right: 0;
  height: 58px;
  padding: 10px 18px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
}

.phone-os .system-title {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 174px;
  height: 30px;
  justify-content: center;
  padding: 0 16px;
  border-radius: 999px;
  color: #f7f7f4;
  background: rgba(5, 6, 9, 0.92);
  font-size: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

.phone-os .status-dot {
  display: none;
}

.phone-os .clock {
  position: absolute;
  top: 15px;
  left: 22px;
  color: #f7f7f4;
  font-size: 13px;
}

.phone-os .menu-button {
  position: absolute;
  top: 12px;
  right: 18px;
  width: 31px;
  height: 31px;
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
}

.phone-os .desktop-icons {
  top: 82px;
  left: 0;
  right: 0;
  width: auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px 8px;
  padding: 0 18px;
}

.phone-os .desktop-icon {
  min-height: 88px;
  padding: 0 3px;
  border: 0;
  background: transparent;
  align-content: start;
}

.phone-os .desktop-icon-mark {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 38%),
    linear-gradient(135deg, #3fd0a2 0%, #3772ff 48%, #e86f5d 100%);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.28);
  color: #06100d;
  font-size: 24px;
}

.phone-os .desktop-icon span {
  width: 100%;
  color: #fbfbf8;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  font-size: 11px;
  line-height: 1.2;
  white-space: normal;
}

.phone-os .empty-state {
  grid-column: 1 / -1;
  margin-top: 24px;
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.78);
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(14px);
}

.phone-os .dock {
  left: 14px;
  right: 14px;
  bottom: 12px;
  transform: none;
  justify-content: center;
  min-height: 72px;
  padding: 10px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.2);
}

.phone-os .dock-button {
  min-width: 54px;
  max-width: 64px;
  width: 54px;
  height: 54px;
  padding: 4px;
  border: 0;
  border-radius: 15px;
  color: #07110e;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 36%),
    linear-gradient(135deg, #f4d56f, #3fd0a2 56%, #3772ff);
  white-space: normal;
  text-align: center;
  font-size: 9px;
  line-height: 1.05;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
}

.phone-os .window-layer {
  z-index: 70;
}

.phone-os.has-active-phone-app .desktop-topbar,
.phone-os.has-active-phone-app .dock {
  opacity: 0;
  pointer-events: none;
}

.phone-os .app-browser {
  position: absolute;
  inset: auto 10px 10px 10px;
  z-index: 100;
  width: auto;
  max-height: min(78dvh, 680px);
  grid-template-rows: auto auto min-content 1fr;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 28px;
  background: rgba(18, 22, 28, 0.9);
  box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.44);
}

.phone-os .browser-header h1 {
  font-size: 22px;
}

.phone-os .suggestion-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.phone-os .suggestion-card,
.phone-os .app-card,
.phone-os textarea {
  border-radius: 14px;
}

.phone-os .primary-button {
  border-radius: 14px;
  min-height: 46px;
}

.phone-os .app-window {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100dvh !important;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 58px 50px 1fr;
  border: 0;
  border-radius: 0;
  background: #0c1013;
  box-shadow: none;
}

.phone-os .window-titlebar {
  justify-content: center;
  padding: 10px 14px 0;
  border-bottom: 0;
  background: rgba(12, 16, 19, 0.92);
}

.phone-os .window-title {
  max-width: 62%;
  text-align: center;
  font-size: 15px;
}

.phone-os .window-actions {
  position: absolute;
  left: 12px;
  top: 14px;
}

.phone-os .window-action {
  width: 32px;
  height: 32px;
  border-radius: 999px;
}

.phone-os .window-action.minimize,
.phone-os .window-action.maximize {
  display: none;
}

.phone-os .window-action.close {
  color: #f7f7f4;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.16);
}

.phone-os .window-command {
  grid-template-columns: 1fr 64px;
  padding: 7px 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(12, 16, 19, 0.92);
}

.phone-os .window-command input {
  height: 34px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.phone-os .window-command .secondary-button {
  height: 34px;
  min-height: 34px;
  border-radius: 999px;
  background: rgba(63, 208, 162, 0.24);
}

.phone-os .frame-wrap {
  background: #fbfbf8;
}

.phone-os .window-status {
  left: 14px;
  right: 14px;
  bottom: 18px;
  max-width: none;
  text-align: center;
  border-radius: 999px;
}

@media (min-width: 520px) {
  .phone-os .desktop {
    height: calc(100dvh - 24px);
    margin: 12px auto;
    border: 10px solid #050609;
    border-radius: 40px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
  }

  .phone-os .app-window {
    border-radius: 30px;
    overflow: hidden;
  }
}
