:root {
  color-scheme: light;
  font: 16px/1.4 "Inter", system-ui, sans-serif;
  color: #182322;
  background: #f5f7f5;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main, #viewer { height: 100vh; height: 100dvh; }
#viewer { display: flex; flex-direction: column; }
#login { display: grid; min-height: 100%; justify-items: center; align-content: center; padding: 24px; }

header, .controls, .account, form {
  display: flex;
  align-items: center;
  gap: 8px;
}

#viewer > header { padding: 12px 16px 0; }
.account { margin-left: auto; }
#address-form { width: min(100%, 600px); margin: auto; padding: 16px; }
.viewing #address-form { width: 100%; margin: 0; padding-block: 10px; }

input, button {
  min-height: 44px;
  border-radius: 9px;
  font: inherit;
}

input {
  flex: 1;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid #b9c9c3;
  background: #fff;
  color: inherit;
}

button {
  padding: 0 14px;
  border: 1px solid #b9c9c3;
  background: #fff;
  color: #24473d;
  cursor: pointer;
}

button:hover { background: #e8efeb; }
button:disabled { cursor: default; opacity: 0.55; }
button[type="submit"]:not(dialog header button), #google {
  border-color: transparent;
  background: #24473d;
  color: #fff;
}

:focus-visible { outline: 2px solid #246a57; outline-offset: 2px; }
[role="status"] { margin: 0; padding: 8px 16px; font-size: 0.875rem; }
#login-error, #access-error { color: #9b2f25; }
#viewer:not(.viewing) #status { text-align: center; margin-top: -25dvh; margin-bottom: 25dvh; }

#screen {
  flex: 1;
  min-height: 0;
  position: relative;
  border-top: 1px solid #dce4e0;
  background: #fff;
  overflow: hidden;
}

#destination { display: block; width: 100%; height: 100%; touch-action: none; }
#destination:not([src]) { visibility: hidden; }
#destination:focus { outline: none; }
#local-frame { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
#local-frame:fullscreen { width: 100%; height: 100%; }
#remote-keyboard { position: absolute; width: 1px; height: 1px; opacity: 0; bottom: 0; left: 0; padding: 0; }
#keyboard { display: none; }
@media (pointer: coarse) { #keyboard { display: block; } }

dialog {
  width: min(440px, calc(100% - 24px));
  max-height: min(560px, 85vh);
  border: 1px solid #dce4e0;
  border-radius: 14px;
  padding: 18px;
  color: inherit;
}

dialog::backdrop { background: #18232266; }
dialog header { justify-content: space-between; margin-bottom: 12px; }
dialog h2 { margin: 0; font-size: 1.1rem; }
dialog ul { list-style: none; padding: 0; margin: 12px 0 0; }
dialog li { display: flex; align-items: center; gap: 8px; padding-block: 8px; border-top: 1px solid #dce4e0; }
dialog li span:first-child { flex: 1; overflow-wrap: anywhere; }
dialog li span:last-child { color: #54675f; }

@media (max-width: 500px) {
  #viewer > header { padding-inline: 8px; flex-wrap: wrap; gap: 6px; }
  #address-form { padding-inline: 8px; }
  .controls, .account { gap: 4px; }
  button { padding-inline: 8px; }
}
