:root {
  --sab: env(safe-area-inset-bottom);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  color: #e8f3ff;
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(90, 120, 255, 0.2), transparent 55%),
    linear-gradient(180deg, #070d1c 0%, #101c38 100%);
  font-family: "PingFang TC", "Microsoft JhengHei", "Noto Sans CJK TC", "WenQuanYi Micro Hei", sans-serif;
  line-height: 1.5;
}

.wrap {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding:
    calc(16px + env(safe-area-inset-top))
    calc(16px + env(safe-area-inset-right))
    calc(28px + env(safe-area-inset-bottom))
    calc(16px + env(safe-area-inset-left));
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

h2 {
  margin: 22px 0 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #3ee6ff;
}

section:first-of-type h2 { margin-top: 16px; }

.summary {
  margin: 0;
  max-width: 70rem;
  color: #b7c9e2;
}

.toolbar,
.fs-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar { margin: 0 0 8px; }

button {
  font: inherit;
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(62, 230, 255, 0.45);
  background: transparent;
  color: #e7f2ff;
  cursor: pointer;
}

button:hover { background: rgba(62, 230, 255, 0.12); }

button:focus-visible {
  outline: 2px solid #3ee6ff;
  outline-offset: 2px;
}

.stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 180px;
  overflow: hidden;
  border: 1px solid rgba(62, 230, 255, 0.22);
  border-radius: 16px;
  background: #070d1c;
}

.stage:fullscreen,
.stage:-webkit-full-screen {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: #070d1c;
}

.fs-tools {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: calc(10px + env(safe-area-inset-right));
  z-index: 5;
  justify-content: flex-end;
}

.fs-tools button {
  padding: 10px 16px;
  background: rgba(10, 18, 36, 0.85);
  color: #ffffff;
}

.fs-tools[hidden] { display: none; }

.stage-msg {
  margin: 0;
  padding: 48px 16px;
  text-align: center;
  color: #9eb4d0;
}

#office {
  display: block;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#office.dragging { cursor: grabbing; }

.muted { color: #9eb4d0; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(62, 230, 255, 0.2);
  border-radius: 12px;
  background: rgba(8, 16, 32, 0.72);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 13px;
  font-weight: 650;
  color: #8eefff;
  white-space: nowrap;
  border-bottom: 1px solid rgba(62, 230, 255, 0.28);
}

td {
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

tr:last-child td { border-bottom: 0; }

td.on { color: #3dff9a; }

td.idle { color: #9eb4d0; }

.note {
  margin: 18px 0 0;
  padding: 14px 16px;
  border: 1px solid rgba(62, 230, 255, 0.35);
  border-radius: 12px;
  background: rgba(62, 230, 255, 0.06);
  color: #d5e7f8;
  line-height: 1.65;
}

.error {
  margin: 10px 0 0;
  color: #ffb4c2;
}

[hidden] { display: none !important; }

@media (max-width: 700px) {
  h1 { font-size: 22px; }
  .summary { font-size: 14px; }
  .wrap {
    padding-left: calc(12px + env(safe-area-inset-left));
    padding-right: calc(12px + env(safe-area-inset-right));
  }
  .stage { border-radius: 12px; }
}

@media (max-width: 520px) {
  .stage {
    height: 62vh;
    min-height: 62vh;
  }
}

@media (display-mode: standalone) {
  .wrap {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  .stage {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
}
