:root {
  --bg:        #0c0c0e;
  --panel:     #17171a;
  --panel-2:   #202024;
  --border:    #2c2c31;
  --text:      #f4f4f6;
  --text-dim:  #a2a2ab;
  --text-faint:#6e6e77;
  --accent:    #d09e52;
  --on-accent: #2f2410;
  --danger:    #c06a3e;
  --sage:      #b9b98f;
  --radius: 14px;
  --bottom-chrome-h: 86px;
}

html {
  box-sizing: border-box;
  -ms-text-size-adjust: 100%;
}

*, *:before, *:after {
  box-sizing: inherit;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 15px;
}

button, input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid #2c2c31;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
  transition: transform 160ms cubic-bezier(0.32, 0.72, 0, 1);
}

button:active {
  transform: scale(0.97);
}

button:disabled,
input:disabled {
  cursor: default;
}

.hidden {
  display: none;
}

.app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  /* longhand only: EdgeHTML 15 drops shorthand declarations containing var() */
  padding-left: 12px;
  padding-right: 12px;
  padding-bottom: 96px;
}

.topbar {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-pack: justify;
  justify-content: space-between;
  -ms-flex-align: center;
  align-items: center;
  padding: 14px 0 12px;
  border-bottom: 1px solid #2c2c31;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
  font-weight: 600;
}

.awake {
  min-height: 34px;
  margin-left: 10px;
  margin-right: auto;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}

.awake.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.awake.hidden {
  display: none;
}

.status {
  min-width: 176px;
  text-align: right;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.35;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 5px;
  border-radius: 50%;
  vertical-align: -1px;
}

.dot-sage {
  background: var(--sage);
}

.dot-danger {
  background: var(--danger);
}

.dot-accent {
  background: var(--accent);
}

.updated {
  display: block;
  margin-top: 2px;
  color: var(--text-faint);
}

.screens {
  padding-top: 12px;
}

.screen {
  width: 100%;
}

.loading,
.empty {
  margin-top: 28px;
  color: var(--text-dim);
  text-align: center;
}

.auth-gate {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background: var(--bg);
  padding: 32px 16px;
}

.auth-panel {
  width: 100%;
  max-width: 360px;
  margin: 80px auto 0;
}

.auth-panel h1 {
  margin: 0 0 14px;
  font-size: 22px;
  font-weight: 600;
}

.auth-panel input {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-bottom: 10px;
  border: 1px solid #2c2c31;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 10px;
}

.auth-panel button {
  width: 100%;
  min-height: 48px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

.home-clock {
  margin-top: 10px;
}

.clock-time {
  font-size: 72px;
  line-height: 0.95;
  font-weight: 200;
}

.clock-meta {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 15px;
}

.home-card {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #2c2c31;
  border-radius: var(--radius);
  background: var(--panel);
}

.home-card h2 {
  margin: 0 0 10px;
  font-size: 17px;
  line-height: 1.2;
  font-weight: 600;
}

.weather-main {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-align: center;
  align-items: center;
}

.weather-glyph {
  width: 58px;
  font-size: 42px;
  line-height: 1;
}

.weather-temp {
  font-size: 42px;
  line-height: 1;
  font-weight: 600;
}

.weather-label {
  margin-top: 8px;
  font-size: 17px;
}

.home-dim,
.weather-details,
.transit-detail {
  color: var(--text-dim);
}

.weather-details {
  margin-top: 8px;
}

.transit-row {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-align: center;
  align-items: center;
  min-height: 48px;
  padding: 8px 0;
  border-top: 1px solid #2c2c31;
}

.transit-row:first-child {
  border-top: 0;
}

.transit-row.cancelled {
  color: var(--text-faint);
  text-decoration: line-through;
}

.transit-min {
  width: 58px;
  margin-right: 8px;
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  font-weight: 600;
}

.transit-min.soon {
  color: var(--accent);
}

.transit-route {
  -ms-flex: 1 1 auto;
  flex: 1 1 auto;
  min-width: 0;
  margin-right: 8px;
}

.transit-direction {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.delay-chip {
  min-width: 34px;
  padding: 4px 6px;
  border-radius: 8px;
  background: var(--panel-2);
  text-align: center;
  font-size: 12px;
}

.delay-late {
  color: var(--danger);
}

.delay-early {
  color: var(--sage);
}

.rooms {
  padding-top: 2px;
}

.room {
  margin-top: 18px;
}

.room-head {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-pack: justify;
  justify-content: space-between;
  -ms-flex-align: center;
  align-items: center;
  margin-bottom: 8px;
}

.room-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
  font-weight: 600;
}

.room-actions {
  display: -ms-flexbox;
  display: flex;
  margin-left: 8px;
}

.room-actions button {
  margin-left: 6px;
  padding-left: 10px;
  padding-right: 10px;
}

.tile {
  position: relative;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #2c2c31;
  border-radius: var(--radius);
  background: var(--panel);
}

.tile.offline {
  opacity: 0.56;
}

.tile.pending .controls {
  opacity: 0.72;
}

.tile.pending:after {
  content: "";
  position: absolute;
  top: 14px;
  right: 82px;
  width: 12px;
  height: 12px;
  border: 2px solid #6e6e77;
  border-top-color: var(--text);
  border-radius: 50%;
}

.tile-top {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-pack: justify;
  justify-content: space-between;
  -ms-flex-align: center;
  align-items: center;
  min-height: 44px;
}

.label {
  min-width: 0;
  margin-right: 10px;
  font-size: 17px;
  font-weight: 600;
  word-wrap: break-word;
}

.power {
  min-width: 64px;
  min-height: 48px;
  font-weight: 700;
}

.power.on {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.power.off {
  background: var(--panel-2);
  color: var(--text-dim);
}

.badge {
  display: none;
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 12px;
}

.offline .badge {
  display: block;
}

.controls {
  margin-top: 10px;
}

.offline .controls {
  pointer-events: none;
}

.brightness {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-align: center;
  align-items: center;
  margin-bottom: 12px;
}

.brightness input {
  width: 100%;
  min-width: 0;
}

.brightness-value {
  width: 48px;
  margin-left: 10px;
  text-align: right;
  color: var(--text-dim);
}

.choices {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: -4px;
}

.swatch,
.white {
  min-width: 40px;
  min-height: 40px;
  margin: 4px;
  border-radius: 8px;
}

.swatch {
  width: 40px;
  padding: 0;
  color: transparent;
}

.white {
  padding-left: 8px;
  padding-right: 8px;
  background: #f1eee5;
  color: #202024;
  font-size: 14px;
}

.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #d09e52;
}

.error {
  min-height: 18px;
  margin-top: 8px;
  color: var(--danger);
  font-size: 12px;
}

.tabs {
  position: fixed;
  z-index: 10;
  left: 12px;
  right: 12px;
  bottom: 12px;
  max-width: 456px;
  margin: 0 auto;
  display: -ms-flexbox;
  display: flex;
  border: 1px solid #3a3a41;
  border-radius: 999px;
  background: #202024;
  padding: 6px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.5);
}

.tab {
  -ms-flex: 1 1 0;
  flex: 1 1 0;
  min-height: 48px;
  margin-left: 4px;
  border-color: transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-weight: 600;
}

.tab:first-child {
  margin-left: 0;
}

.tab-icon {
  display: inline-block;
  margin-right: 6px;
}

.tab.active {
  background: var(--accent);
  color: var(--on-accent);
}

@media (orientation: landscape) {
  .app {
    max-width: 820px;
  }

  .screen {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -ms-flex-align: start;
    align-items: flex-start;
  }

  .screen.hidden {
    display: none;
  }

  .home-clock {
    width: 100%;
    text-align: center;
  }

  .clock-time {
    font-size: 52px;
  }

  .home-card {
    width: 48.8%;
  }

  .room {
    width: 48.8%;
    margin-top: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  button {
    transition: none;
  }
}
