:root {
  color-scheme: light;
  --ink: #111111;
  --muted: #7a7a7a;
  --line: #ededed;
  --paper: #f5f5f5;
  --surface: #ffffff;
  --green: #07c160;
  --green-dark: #06ad56;
  --soft-green: #e9f8ef;
  --blue: #5b8fd9;
  --gold: #c8a14a;
  --shadow: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body.locked {
  overflow: hidden;
}

body.locked .app-shell {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
}

.invite-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(245, 245, 245, 0.94);
  padding: 24px;
}

.invite-screen.hidden {
  display: none;
}

.invite-panel {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 26px;
}

.invite-panel h1 {
  color: var(--ink);
  font-size: 26px;
}

.invite-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.invite-panel form {
  display: grid;
  gap: 10px;
}

.invite-panel input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
}

.invite-error {
  color: #d93025 !important;
  font-weight: 800;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-right: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 24px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--green);
  color: white;
  font-size: 24px;
  font-weight: 800;
}

.eyebrow,
.panel-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar .eyebrow,
.sidebar .panel-label {
  color: var(--muted);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 22px;
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.1;
}

h3 {
  margin-bottom: 0;
  font-size: 20px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #333333;
  padding: 0 12px;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #f0f0f0;
  color: var(--green-dark);
}

.nav-item:focus-visible,
.primary-button:focus-visible,
.ghost-button:focus-visible,
.tool-button:focus-visible,
.gemini-button:focus-visible,
.location-link:focus-visible,
.map-pin:focus-visible {
  outline: 2px solid rgba(7, 193, 96, 0.35);
  outline-offset: 2px;
}

.status-panel {
  display: grid;
  gap: 4px;
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.status-panel span {
  color: var(--muted);
  font-size: 14px;
}

.main {
  display: grid;
  gap: 22px;
  align-content: start;
  padding: 24px;
}

.view {
  display: none;
  gap: 22px;
}

.view.active {
  display: grid;
}

.topbar,
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-actions,
.composer-tools,
.approval-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.composer-tools {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(0, 1.28fr);
  gap: 8px;
}

.composer-ai-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-status {
  flex: 1 1 220px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.gemini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #111111;
  padding: 0 2px;
  font-size: 14px;
  font-weight: 500;
}

.gemini-mark {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  background: transparent;
  color: #111111;
  font-size: 17px;
  line-height: 1;
}

.sample-inline-button {
  min-height: 38px;
}

.primary-button,
.ghost-button,
.tool-button,
.icon-button {
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 750;
}

.tool-button,
.voice-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  padding: 0 8px;
  font-size: 13px;
  white-space: nowrap;
}

#postButton {
  grid-column: 1 / -1;
  width: 100%;
  margin-left: 0;
}

.primary-button {
  background: var(--green);
  color: white;
}

.primary-button:hover {
  background: var(--green-dark);
}

.ghost-button,
.tool-button,
.icon-button {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.icon-button {
  width: 40px;
  padding: 0;
}

.tool-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.photo-icon {
  position: relative;
  width: 16px;
  height: 13px;
  border: 1.8px solid currentColor;
  border-radius: 3px;
}

.photo-icon::before {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.photo-icon::after {
  position: absolute;
  right: 2px;
  bottom: 2px;
  left: 4px;
  height: 5px;
  border-radius: 5px 5px 1px 1px;
  background: currentColor;
  clip-path: polygon(0 100%, 38% 35%, 58% 68%, 78% 20%, 100% 100%);
  content: "";
}

.mic-icon {
  position: relative;
  width: 12px;
  height: 17px;
  border: 1.8px solid currentColor;
  border-radius: 8px;
}

.mic-icon::before {
  position: absolute;
  right: -5px;
  bottom: 2px;
  left: -5px;
  height: 8px;
  border: 1.8px solid currentColor;
  border-top: 0;
  border-radius: 0 0 10px 10px;
  content: "";
}

.mic-icon::after {
  position: absolute;
  bottom: -7px;
  left: 50%;
  width: 8px;
  height: 1.8px;
  background: currentColor;
  box-shadow: 0 -4px 0 -0.2px currentColor;
  content: "";
  transform: translateX(-50%);
}

.voice-button.listening {
  border-color: rgba(7, 193, 96, 0.36);
  background: var(--soft-green);
  color: var(--green-dark);
}

.composer,
.feed-item,
.ai-panel {
  border: 0;
  border-radius: 0;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.composer {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border-radius: 8px;
}

.composer-avatar,
.feed-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-size: 14px;
  font-weight: 850;
}

.composer-body {
  display: grid;
  gap: 12px;
}

textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  padding: 8px 0;
  color: var(--ink);
  outline: none;
}

textarea.ai-loading {
  background-image: linear-gradient(100deg, #ffffff 0%, #f0fbf5 35%, #ffffff 70%);
  background-size: 220% 100%;
  animation: shimmer 1.1s linear infinite;
}

textarea.ai-pop {
  animation: ai-pop 760ms ease-out;
}

@keyframes shimmer {
  from {
    background-position: 180% 0;
  }
  to {
    background-position: -40% 0;
  }
}

@keyframes ai-pop {
  0% {
    box-shadow: 0 0 0 0 rgba(31, 138, 112, 0);
    transform: scale(1);
  }
  35% {
    box-shadow: 0 0 0 5px rgba(31, 138, 112, 0.16);
    transform: scale(1.01);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(31, 138, 112, 0);
    transform: scale(1);
  }
}

.preview-strip,
.feed-photos {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.share-options {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  border: 0;
  margin: 0;
  padding: 0;
}

.share-options legend {
  margin-right: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.share-options label {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
}

.share-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.share-options span {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.share-options input:checked + span {
  border-color: rgba(7, 193, 96, 0.36);
  background: var(--soft-green);
  color: var(--green-dark);
}

.preview-strip img,
.feed-photos img {
  width: 96px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
  gap: 22px;
}

.location-map-section {
  min-height: calc(100vh - 180px);
}

.large-map {
  min-height: min(620px, calc(100vh - 210px));
}

.map-section {
  display: grid;
  gap: 12px;
}

.map-canvas {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 16% 28%, rgba(91, 143, 217, 0.16), transparent 22%),
    radial-gradient(circle at 78% 42%, rgba(7, 193, 96, 0.16), transparent 24%),
    #eef4f1;
}

.map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(30, 37, 43, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 37, 43, 0.08) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
}

.map-pin {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--green);
  color: white;
  box-shadow: 0 8px 18px rgba(17, 17, 17, 0.12);
}

.map-pin span {
  max-width: 44px;
  overflow: hidden;
  text-align: center;
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-pin.us {
  left: 16%;
  top: 52%;
  background: var(--blue);
}

.map-pin.cn {
  right: 20%;
  top: 42%;
  background: var(--green);
}

.map-pin.cn2 {
  right: 30%;
  top: 20%;
  background: var(--gold);
}

.map-pin.focused {
  outline: 4px solid rgba(7, 193, 96, 0.18);
  transform: scale(1.18);
  z-index: 2;
}

.map-note {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: var(--soft-green);
  color: var(--green-dark);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.sync-pill.muted {
  background: #edf1f3;
  color: var(--muted);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 190px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.ai-result {
  display: grid;
  gap: 18px;
}

.hidden {
  display: none;
}

dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

dl div {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 0;
  font-weight: 800;
}

.feed-section {
  display: grid;
  gap: 12px;
}

.feed-list {
  display: grid;
  gap: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff;
}

.feed-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}

.feed-item:last-child {
  border-bottom: 0;
}

.feed-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.feed-time {
  color: var(--muted);
  font-size: 13px;
}

.feed-share {
  display: inline-grid;
  place-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #f5f5f5;
  color: var(--muted);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}

.feed-text {
  margin: 8px 0 12px;
  line-height: 1.55;
}

.location-link {
  display: none;
  width: fit-content;
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  background: var(--soft-green);
  color: var(--green-dark);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 850;
}

.location-link.visible {
  display: inline-flex;
  align-items: center;
}

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

  .sidebar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    border-top: 1px solid var(--line);
    border-right: 0;
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
  }

  .brand {
    display: none;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-item {
    justify-content: center;
    min-height: 46px;
    color: var(--muted);
  }

  .status-panel {
    display: none;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .main {
    padding-bottom: 86px;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  h2 {
    font-size: 26px;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .composer-avatar {
    display: none;
  }

  .composer-tools {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(0, 1.28fr);
  }

  .primary-button,
  .ghost-button,
  .tool-button {
    width: 100%;
  }
}
