:root {
  --header-bg: none;
  --header-text: #1a3f73;
  --page-bg: #f3f5f7;
  --select-bg: #d7ebf8;
  --south-bg: #f8d7d7;
  --footer-bg: #ffffff;
  --line: #d5dde3;
  --text: #1c1c1c;
  --header-h: 3rem;
  --footer-h: 3.25rem;
  --side-pad: 4.5vw;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

html {
  font-size: 16px;
}

body {
  color: var(--text);
  background: var(--page-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.app,
.app * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

.app img {
  pointer-events: none;
}

.app {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
}

.app-header {
  flex: 0 0 auto;
  padding: calc(var(--safe-top) + 1rem) var(--side-pad) 0.9rem;
  background: none;
  color: var(--header-text);
}

.app-title {
  margin: 0;
  line-height: 1.3;
}

.app-title-name,
.app-title-sub {
  display: block;
}

.app-title-name {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.app-title-sub {
  margin-top: 0.05rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.app-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.75rem var(--side-pad) 1.25rem;
}

html.floor-list-open .app-main {
  overflow: hidden;
}

.floor-select {
  position: relative;
  z-index: 2;
  width: calc(100% + (var(--side-pad) * 2) - 1.5rem);
  margin-right: calc(-1 * var(--side-pad) + 0.75rem);
  margin-left: calc(-1 * var(--side-pad) + 0.75rem);
  color: #1a3f73;
}

.floor-select-current {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  margin: 0;
  padding: 0.65rem 0.85rem 0.7rem 0.75rem;
  border: 0;
  border-radius: 0;
  background: var(--select-bg);
  color: inherit;
  font: inherit;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}

.floor-select-current:active {
  background: #c9e3f4;
}

.floor-select-pin,
.floor-select-mark,
.floor-select-chevron,
.floor-select-check {
  flex: 0 0 auto;
}

.floor-select-pin,
.floor-select-mark {
  width: 1.7rem;
  height: 1.7rem;
  color: #2f86e0;
}

.floor-select-pin svg,
.floor-select-mark svg,
.floor-select-chevron svg,
.floor-select-check svg {
  display: block;
  width: 100%;
  height: 100%;
}

.floor-select-body {
  flex: 1 1 auto;
  min-width: 0;
}

.floor-select-caption {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.floor-select-value {
  display: block;
  margin-top: 0.05rem;
  overflow: hidden;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.floor-select-chevron {
  width: 1.15rem;
  height: 1.15rem;
  color: #7d90a3;
}

.floor-select.is-open .floor-select-chevron,
html.floor-list-open .floor-select-chevron {
  transform: rotate(180deg);
}

.floor-select-list {
  display: none;
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  left: 0;
  z-index: 3;
  max-height: min(55dvh, calc(100dvh - 12.5rem - var(--safe-top) - var(--safe-bottom)));
  padding: 0.15rem 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  border-radius: 0;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(26, 63, 115, 0.16);
}

.floor-select.is-open .floor-select-list,
html.floor-list-open .floor-select-list {
  display: block;
}

.floor-select-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: calc(100% - 1.5rem);
  margin: 0 0.75rem;
  padding: 0.85rem 0.15rem;
  border: 0;
  border-bottom: 1px solid #e6eef3;
  background: transparent;
  color: #8a96a3;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}

.floor-select-option .floor-select-mark {
  color: #a9b4bf;
}

.floor-select-option:last-child {
  border-bottom: 0;
}

.floor-select-option:active {
  background: #f4f9fc;
}

.floor-select-option.is-selected {
  width: calc(100% - 1rem);
  margin: 0.4rem 0.5rem;
  padding: 0.85rem 0.65rem;
  border-bottom-color: transparent;
  border-radius: 0;
  background: #dcecf9;
  color: #1a3f73;
  font-weight: 800;
}

.floor-select-option.is-selected .floor-select-mark {
  color: #2f86e0;
}

.floor-select-option-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.floor-select-check {
  width: 1.15rem;
  height: 1.15rem;
  color: #2f86e0;
  visibility: hidden;
}

.floor-select-option.is-selected .floor-select-check {
  visibility: visible;
}

.machine-board {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  width: calc(100% + (var(--side-pad) * 2) - 1.5rem);
  margin-top: 0.7rem;
  margin-right: calc(-1 * var(--side-pad) + 0.75rem);
  margin-left: calc(-1 * var(--side-pad) + 0.75rem);
}

.machine-card {
  overflow: hidden;
  padding: 0;
  border-radius: 0;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(26, 63, 115, 0.06);
}

.machine-card[hidden] {
  display: none;
}

.machine-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0;
  padding: 0.5rem 0.4rem;
  background: var(--select-bg);
}

.machine-card.is-south .machine-card-head {
  background: var(--south-bg);
}

.machine-card.is-south .machine-card-title {
  border-left-color: #ef4d4d;
}

.machine-card-title {
  margin: 0;
  padding-left: 0.55rem;
  border-left: 0.28rem solid #2f86e0;
  color: #1a3f73;
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.25;
}

.hospital-dir {
  font-size: 1.15em;
}

.hospital-dir.is-north {
  color: #1686c2;
}

.hospital-dir.is-south {
  color: #ea4f4f;
}

.machine-card-place {
  margin: 0;
  color: #1a3f73;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.machine-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  padding: 0.45rem 0.3rem;
}

.machine-card-body.is-combined-grid {
  gap: 0.28rem;
  grid-template-areas:
    "dry1 dry2"
    "wash1 wash2";
}

.machine-card-body.is-combined-grid .slot-dry-1 {
  grid-area: dry1;
}

.machine-card-body.is-combined-grid .slot-dry-2 {
  grid-area: dry2;
}

.machine-card-body.is-combined-grid .slot-wash-1 {
  grid-area: wash1;
}

.machine-card-body.is-combined-grid .slot-wash-2 {
  grid-area: wash2;
}

.machine-slot-south-combined[hidden] {
  display: none;
}

.machine-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 0.4rem 0.12rem 0.4rem;
  border: 1px solid #c5dff0;
  text-align: center;
}

.machine-slot-label {
  margin: 0 0 0.15rem;
  color: #1a3f73;
  font-size: 1.05rem;
  font-weight: 800;
}

.machine-icon {
  position: relative;
  width: 6.1rem;
  height: 6.1rem;
  margin: 0.05rem 0 0.25rem;
}

.machine-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.machine-alert {
  position: absolute;
  top: 0.15rem;
  right: 0.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: #ef4d4d;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.machine-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 86%;
  max-width: 86%;
  min-width: 0;
  align-self: center;
  margin-top: 0.1rem;
  padding: 0.48rem 0.28rem;
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.machine-status.is-run {
  background: #22a35a;
}

.machine-status.is-stop {
  background: #9aa3ad;
}

.machine-status.is-error {
  background: #ef4d4d;
}

.app-footer {
  flex: 0 0 auto;
  min-height: calc(var(--footer-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--footer-bg);
  border-top: 1px solid var(--line);
}

/* 小さいスマホ（幅 320〜360px 前後） */
@media (max-width: 360px) {
  html {
    font-size: 15px;
  }

  :root {
    --header-h: 2.75rem;
    --footer-h: 3rem;
    --side-pad: 4vw;
  }
}

/* 大きめのスマホ（幅 400px 以上、縦向き） */
@media (min-width: 400px) {
  html {
    font-size: 17px;
  }

  :root {
    --side-pad: 5vw;
  }
}