:root {
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: #202721;
  background: #f7f7f1;
  --muted: #5e6c63;
  --line: #dde2d7;
  --accent: #e6a336;
  --green: #1c5342;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button, .download {
  border: 1px solid var(--line);
  border-radius: .65rem;
  padding: .68rem 1rem;
  min-height: 2.65rem;
  color: inherit;
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
}
button:hover, .download:hover { border-color: #96ab9e; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid #26775c; outline-offset: 3px; }
button.primary { background: var(--green); color: white; border-color: var(--green); }
button.primary:hover { background: #123d30; }
button.quiet { background: transparent; border-color: #58685c; color: #fff; }
button.danger { border-color: #d3a499; color: #791f16; }
button[aria-pressed="true"] { background: #f9e1a5; }

.masthead {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem max(1rem, calc((100vw - 1100px) / 2));
  color: #fff; background: #172c25;
}
.wordmark { display: flex; align-items: center; gap: .7rem; font-size: 1.2rem; font-weight: 700; }
.mark {
  display: inline-grid; place-items: center; width: 2.05rem; height: 2.05rem;
  border-radius: .65rem; background: var(--accent); color: #2b2418; font-size: .9rem;
}
main { max-width: 1140px; margin: auto; padding: 1.3rem 1.25rem 3rem; }
h1 { margin: 0; line-height: 1.25; font-size: clamp(1.35rem, 4vw, 2rem); }
p { margin: .4rem 0 0; line-height: 1.6; color: var(--muted); }
.card, .device, .records li {
  border: 1px solid var(--line); border-radius: .95rem; background: #fff;
}
.login { max-width: 420px; margin: clamp(1.5rem, 10vh, 6rem) auto 0; padding: clamp(1.25rem, 5vw, 2.2rem); }
.login form { display: grid; gap: .65rem; margin-top: 1.5rem; }
input {
  width: 100%; min-width: 0; min-height: 2.7rem; padding: .58rem .7rem;
  border: 1px solid #aab9ad; border-radius: .65rem; background: #fff;
}
.tabs { display: flex; gap: .35rem; border-bottom: 1px solid var(--line); }
.tabs button { border: none; background: transparent; color: var(--muted); border-radius: 0; }
.tabs button[aria-current] { color: var(--green); border-bottom: 3px solid var(--green); font-weight: 650; }
.section-title, .session-bar { display: flex; gap: 1rem; align-items: center; justify-content: space-between; margin: 1.4rem 0; }
.pairing { margin-bottom: 1rem; padding: 1rem; background: #fdf5df; border-color: #e6d5a8; }
.pairing p { margin-top: 0; }
#pair-code { display: block; margin-top: .5rem; font: 700 1.65rem ui-monospace, monospace; letter-spacing: .12em; user-select: all; }
.devices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 265px), 1fr)); gap: .85rem; }
.device { padding: 1.2rem; overflow-wrap: anywhere; }
.device h2 { font-size: 1.13rem; margin: 0; }
.device-actions, .build-actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.device-actions { margin-top: 1rem; }
.empty { padding: 1.1rem; border: 1px dashed #aab9ad; border-radius: .85rem; }
.warning { color: #8c2e1c; }
.warning:empty { display: none; }
.records { list-style: none; padding: 0; }
.records li { padding: .8rem 1rem; margin: .5rem 0; display: flex; gap: .75rem; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.records strong { display: block; }
.records small { color: var(--muted); overflow-wrap: anywhere; display: block; }
.download { display: inline-block; text-decoration: none; }
.viewer {
  background: #10221d; color: #fff; min-height: 8rem; border-radius: .8rem;
  display: grid; place-items: center; overflow: hidden;
}
.viewer p { color: #d7e4db; margin: 2rem; }
#frame { display: block; width: auto; max-width: 100%; max-height: 72vh; touch-action: none; }
#frame:focus-visible { outline-offset: -4px; outline-color: var(--accent); }
.remote-text { display: flex; align-items: center; gap: .4rem; margin-top: .65rem; }
@media (max-width: 440px) {
  .tabs button { padding-inline: .65rem; }
  .section-title { align-items: flex-start; }
  .remote-text button { padding-inline: .56rem; }
}
