:root {
  color-scheme: light;
  --ink: #172c2d;
  --dim: #546565;
  --accent: #225b49;
  --line: #d4ded7;
  --paper: #fffefa;
  --surface: #f4f6f0;
  font: 16px/1.4 "Aptos", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--surface);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid #5b9582; outline-offset: 3px; }
h1, h2, p { margin: 0; }
.mast { background: var(--ink); color: #f0f3e9; }
.mast-inner, .layout { max-width: 1024px; margin: 0 auto; padding-inline: clamp(20px, 5.5vw, 64px); }
.mast-inner { min-height: 73px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-size: 1.18rem; letter-spacing: -.035em; font-weight: 680; white-space: nowrap; }
.brand-icon { display: grid; grid-template-columns: repeat(2, 9px); grid-template-rows: repeat(2, 9px); gap: 2px; transform: rotate(-3deg); }
.brand-icon i { background: #cde6b8; border-radius: 2px; }
.brand-icon i:nth-child(2) { border-radius: 2px 7px 2px 2px; }
.brand-icon i:nth-child(3) { border-radius: 2px 2px 2px 7px; }
.refresh-group { display: flex; align-items: center; gap: 14px; }
#checked { color: #c3d5cb; font-size: .8rem; font-variant-numeric: tabular-nums; }
.refresh { display: inline-flex; align-items: center; gap: 7px; background: transparent; color: #edf4e7; border: 1px solid #739085; border-radius: 7px; padding: 7px 12px; min-height: 36px; font-size: .86rem; font-weight: 600; }
.refresh:hover { background: #2d4544; }
.mast-action { border: 0; padding: 8px 2px; color: #edf4e7; background: transparent; white-space: nowrap; font-size: .84rem; }
.mast-action:hover { text-decoration: underline; }
#signin-note { margin-bottom: 12px; }
.reload-icon { font-family: Arial, sans-serif; font-size: 1.1em; line-height: 1; }
.layout { display: grid; grid-template-columns: 162px minmax(0, 1fr); gap: clamp(26px, 4vw, 52px); padding-top: clamp(32px, 6.1vh, 58px); padding-bottom: 48px; align-items: start; }
.rooms { min-width: 0; }
.rooms h2 { font-size: .71rem; text-transform: uppercase; letter-spacing: .13em; color: var(--dim); margin: 7px 0 13px 10px; font-weight: 690; }
#room-list { display: flex; flex-direction: column; align-items: stretch; gap: 3px; }
.room-button { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; padding: 9px 10px; font-size: .91rem; font-weight: 550; border-radius: 7px; border: 1px solid transparent; overflow: hidden; background: transparent; }
.room-button .room-text { min-width: 0; overflow-wrap: anywhere; }
.room-button .room-number { font-variant-numeric: tabular-nums; color: var(--dim); font-size: .8rem; }
.room-button[aria-pressed="true"] { background: #dce8d9; color: #23473a; font-weight: 680; }
.room-button:not([aria-pressed="true"]):hover { background: #e7ece4; }
.device-area { min-width: 0; }
.view-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 21px; }
.view-head > div { min-width: 0; }
h1 { font: 500 clamp(2.3rem, 4.6vw, 3.15rem)/1.04 Georgia, "Times New Roman", serif; letter-spacing: -.055em; overflow-wrap: anywhere; }
.count { color: var(--dim); font-size: .88rem; margin-top: 9px; font-variant-numeric: tabular-nums; }
.count:empty { display: none; }
.button { min-height: 40px; border: 1px solid transparent; border-radius: 7px; padding: 8px 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 630; font-size: .89rem; text-decoration: none; line-height: 1.2; }
.solid { color: #f5f9ee; background: var(--ink); }
.solid:hover { background: #2d4443; }
.plus { font-size: 1.14rem; font-weight: normal; line-height: .8; }
.outline { color: var(--ink); background: transparent; border-color: #bdcbbf; }
.outline:hover { background: #edf2e8; }
.device-list { display: grid; gap: 10px; }
.card { display: grid; grid-template-columns: 115px minmax(0, 1fr); border-radius: 14px; background: var(--paper); border: 1px solid #cad6cc; overflow: hidden; min-width: 0; }
.art { display: grid; place-items: center; position: relative; overflow: hidden; min-height: 126px; background: #d8e6d6; isolation: isolate; }
.art::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse at 26% 10%, #eef4df, transparent 65%), linear-gradient(140deg, #e1e9d7, #c2d7c6); }
.lamp { position: relative; width: 59px; height: 77px; }
.lamp i { position: absolute; }
.lamp i:first-child { left: 15px; top: 0; width: 29px; height: 9px; border-radius: 50% / 48%; z-index: 2; background: linear-gradient(#bfd4bb, #a4bba4); box-shadow: inset 0 -2px #849d86; }
.lamp i:nth-child(2) { left: 5px; right: 5px; top: 4px; bottom: 23px; background: linear-gradient(100deg, #f9fbec, #e1e9d8 57%, #c7d7c5); border-radius: 47% 47% 8% 8% / 24% 24% 4% 4%; transform: perspective(70px) rotateX(8deg); }
.lamp i:nth-child(3) { left: 3px; right: 3px; top: 46px; bottom: 1px; border-radius: 5% 5% 15% 15% / 5% 5% 15% 15%; background: repeating-linear-gradient(90deg, #ffffff25 0 1px, transparent 1px 3px), linear-gradient(90deg,#8ea58d,#bfceba 33%,#8da88e); box-shadow: 0 5px 7px -5px #547653; }
.card.link .art::before { background: linear-gradient(145deg, #f5e2c0, #e5ccb0); }
.link .lamp, .hatch .link-art { display: none; }
.link-art { width: 46px; height: 49px; position: relative; }
.link-art i { position: absolute; width: 22px; height: 30px; border: 4px solid #705b48; border-radius: 9px; transform: rotate(42deg); }
.link-art i:first-child { left: 5px; bottom: 2px; }
.link-art i:last-child { left: 19px; top: 1px; }
.card-content { min-width: 0; padding: 16px 19px 15px; display: flex; flex-direction: column; justify-content: center; gap: 15px; }
.card-head, .card-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-head { align-items: flex-start; flex-wrap: nowrap; }
.card-head > div { min-width: 0; }
.room-label { font-size: .73rem; line-height: 1.2; color: var(--dim); margin-bottom: 4px; overflow-wrap: anywhere; }
.device-name { font-size: 1.3rem; line-height: 1.18; font-weight: 665; letter-spacing: -.042em; overflow-wrap: anywhere; }
.edit, .danger-text { border: 0; background: none; padding: 4px 0 4px 6px; font-size: .85rem; font-weight: 600; color: var(--dim); }
.edit:hover, .danger-text:hover { text-decoration: underline; }
.state { display: inline-flex; gap: 7px; align-items: center; color: var(--dim); font-size: .81rem; }
.state i { width: 8px; height: 8px; border: 1px solid #7a8a82; border-radius: 50%; }
.state.ready { color: var(--accent); }
.state.ready i { background: #3c8060; border-color: #3c8060; }
.state.unavailable i { background: #b08d50; border-color: #a68044; }
.open-control { color: var(--ink); background: #e7eee3; border-color: #d0ddce; min-height: 34px; padding: 7px 10px; white-space: nowrap; font-size: .83rem; }
.open-control:hover { background: #d9e6d7; }
.open-control .arrow { font-size: 1.02rem; font-weight: normal; }
.notice { color: var(--dim); font-size: .88rem; line-height: 1.45; overflow-wrap: anywhere; }
.notice:empty { display: none; }
.notice.error, .danger-text { color: #954834; }
#page-notice:not(:empty) { margin-bottom: 13px; }
.empty { padding: 24px; border: 1px dashed #b9cabc; border-radius: 12px; color: var(--dim); }
dialog { width: min(410px, 100vw - 28px); max-height: calc(100dvh - 24px); overflow-y: auto; color: var(--ink); background: var(--paper); border: 1px solid #c3d0c5; border-radius: 16px; padding: 24px; box-shadow: 0 20px 65px #10292335; }
dialog::backdrop { background: #172c2d66; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.dialog-head h2 { font: 500 1.75rem/1.15 Georgia, serif; letter-spacing: -.045em; }
.close { border: 0; background: #eaf0e6; border-radius: 50%; width: 32px; height: 32px; font-size: 1.3rem; }
form label { display: block; font-size: .88rem; font-weight: 620; margin: 14px 0 5px; }
form input { width: 100%; min-height: 43px; border: 1px solid #b9c8bc; border-radius: 7px; padding: 8px 10px; background: #fff; }
.field-note { font-size: .82rem; color: var(--dim); margin-top: 6px; }
.dialog-actions, .right-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dialog-actions { justify-content: space-between; margin-top: 22px; }
.right-actions { margin-left: auto; }
.dialog-actions .danger-text { padding-left: 0; }
.danger { color: white; background: #974734; }
#dialog-notice, #remove-notice { margin-top: 12px; }
@media(max-width: 720px) {
  .mast-inner { min-height: 61px; }
  .layout { display: flex; flex-direction: column; gap: 22px; padding-top: 19px; }
  .rooms, .device-area { width: 100%; }
  .rooms { border-bottom: 1px solid var(--line); padding-bottom: 13px; }
  .rooms h2 { margin: 0 0 6px; font-size: .65rem; }
  #room-list { flex-direction: row; flex-wrap: wrap; gap: 3px; }
  .room-button { padding: 6px 9px; min-height: 34px; max-width: 100%; }
  .view-head { margin-bottom: 17px; }
}
@media(max-width: 480px) {
  .mast-inner, .layout { padding-inline: 15px; }
  .refresh-group { gap: 7px; }
  #checked { display: none; }
  .refresh { min-height: 36px; padding: 5px 8px; }
  .card { grid-template-columns: 64px minmax(0,1fr); }
  .lamp { transform: scale(.78); }
  .link-art { transform: scale(.78); }
  .card-content { padding: 13px 11px; gap: 13px; }
  .card-actions { gap: 6px; }
  .edit { padding: 3px 2px 6px 6px; }
  .device-name { font-size: 1.16rem; }
  .art { min-height: 112px; }
  .button { min-height: 40px; }
  .open-control { min-height: 36px; }
}
@media(max-width: 360px) {
  .mast-inner { gap: 8px; }
  .brand { font-size: 1.02rem; gap: 8px; }
  #checked { display: none; }
  .card { grid-template-columns: 49px minmax(0,1fr); }
  .card-actions { align-items: start; flex-direction: column; }
  dialog { padding: 18px; }
}
