:root {
  color-scheme: light;
  --navy: #071b3d;
  --blue: #0b5cff;
  --cyan: #31c6e8;
  --ink: #17233a;
  --muted: #5c687c;
  --line: #dce2ea;
  --panel: #ffffff;
  --bg: #eef2f7;
  font-family: Inter, "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(49, 198, 232, .18), transparent 28rem),
    linear-gradient(145deg, #f8fafc 0%, var(--bg) 58%, #e8edf5 100%);
  min-height: 100vh;
}

button, input, select { font: inherit; }

button { cursor: pointer; }

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem clamp(1.25rem, 4vw, 4rem) 1.5rem;
  color: white;
  background: linear-gradient(120deg, #061731, #0c2c5f 70%, #0b5cff);
  border-bottom: 3px solid var(--cyan);
}

.eyebrow {
  margin: 0 0 .35rem;
  color: #8ee9fa;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .18em;
}

h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1; }
.subtitle { margin: .75rem 0 0; color: #d9e7ff; font-size: 1rem; }

.status {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .65rem .9rem;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  font-size: .9rem;
  white-space: nowrap;
}

.header-actions { display: flex; align-items: center; gap: .75rem; }
.install-button {
  min-height: 2.65rem;
  color: white;
  border: 1px solid rgba(255,255,255,.32);
  background: rgba(255,255,255,.12);
}
.install-button:hover { background: rgba(255,255,255,.2); }

.status span { width: .55rem; height: .55rem; border-radius: 50%; background: #61e5a0; box-shadow: 0 0 0 4px rgba(97,229,160,.14); }
.status.loading span { background: #ffd36a; box-shadow: 0 0 0 4px rgba(255,211,106,.14); }

main {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.5rem);
}

.controls, .workspace {
  min-width: 0;
  border: 1px solid rgba(18, 43, 80, .12);
  border-radius: 1rem;
  background: rgba(255,255,255,.94);
  box-shadow: 0 18px 50px rgba(26, 45, 75, .09);
}

.controls { padding: clamp(1rem, 2.5vw, 1.75rem); }
.url-form label, .toolbar label > span { display: block; margin-bottom: .45rem; font-size: .9rem; font-weight: 800; }
.url-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; }

input, select {
  min-height: 3rem;
  border: 1px solid #cbd4e1;
  border-radius: .65rem;
  background: white;
  color: var(--ink);
}

input { width: 100%; padding: 0 1rem; font-size: 1rem; }
select { min-width: 13rem; padding: 0 2.4rem 0 .85rem; appearance: none; background-image: linear-gradient(45deg, transparent 50%, #526078 50%), linear-gradient(135deg, #526078 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus, button:focus-visible { outline: 3px solid rgba(11,92,255,.24); outline-offset: 2px; }

button { min-height: 3rem; border-radius: .65rem; padding: 0 1.15rem; font-weight: 800; border: 0; }
.primary { color: white; background: var(--blue); box-shadow: 0 8px 20px rgba(11,92,255,.25); }
.primary:hover { background: #064fdc; }
.secondary { color: var(--navy); background: #edf2f8; border: 1px solid #d7dfeb; }
.secondary:hover { background: #e3eaf4; }

.toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 1rem; margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.button-group { display: flex; flex-wrap: wrap; gap: .5rem; margin-left: auto; }

.workspace { margin-top: 1.25rem; padding: clamp(1rem, 2.5vw, 1.75rem); }
.preview-meta { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding-bottom: 1rem; }
.preview-meta strong { display: block; font-size: 1rem; }
.preview-meta span, .preview-meta p { color: var(--muted); font-size: .86rem; }
.preview-meta p { margin: 0; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stage {
  display: grid;
  place-items: start center;
  min-height: 42rem;
  padding: 2rem;
  overflow: auto;
  width: 100%;
  min-width: 0;
  border-radius: .8rem;
  background-color: #dce3ec;
  background-image: linear-gradient(rgba(255,255,255,.45) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.45) 1px, transparent 1px);
  background-size: 24px 24px;
}

.phone {
  --screen-width: 390px;
  --screen-height: 844px;
  --scale: 1;
  position: relative;
  width: calc(var(--screen-width) + 24px);
  height: calc(var(--screen-height) + 44px);
  padding: 22px 12px;
  border: 2px solid #344052;
  border-radius: 34px;
  background: #10141c;
  box-shadow: 0 25px 55px rgba(9, 20, 37, .26), inset 0 0 0 1px rgba(255,255,255,.2);
  transform: scale(var(--scale));
  transform-origin: top center;
  transition: width .25s ease, height .25s ease, transform .2s ease;
}

.phone-speaker { position: absolute; z-index: 3; top: 8px; left: 50%; width: 70px; height: 6px; transform: translateX(-50%); border-radius: 99px; background: #323a47; }
.phone-home { position: absolute; z-index: 3; bottom: 7px; left: 50%; width: 85px; height: 5px; transform: translateX(-50%); border-radius: 99px; background: #68717f; }
.screen { position: relative; width: var(--screen-width); height: var(--screen-height); overflow: hidden; border-radius: 16px; background: white; }
iframe { display: none; width: 100%; height: 100%; border: 0; background: white; }
iframe.visible { display: block; }

.empty-state { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; padding: 2rem; text-align: center; color: #617087; background: linear-gradient(145deg, #fff, #f3f6fa); }
.empty-state.hidden { display: none; }
.empty-state h2 { margin: .8rem 0 .45rem; color: var(--navy); font-size: 1.2rem; }
.empty-state p { margin: 0; line-height: 1.7; }
.phone-icon { display: grid; place-items: center; width: 3.5rem; height: 3.5rem; border: 2px solid #b8c5d8; border-radius: 1rem; color: var(--blue); font-size: 2.5rem; }

.notice { display: flex; gap: 1rem; align-items: baseline; margin-top: 1rem; padding: .85rem 1rem; border-left: 3px solid #e4a72a; background: #fff9e9; color: #5e4a1c; }
.notice strong { white-space: nowrap; }
.notice p { margin: 0; font-size: .9rem; line-height: 1.65; }

@media (max-width: 760px) {
  .app-header { align-items: flex-start; padding-top: 1.4rem; }
  .status { display: none; }
  .install-button { min-height: 2.5rem; padding-inline: .8rem; font-size: .8rem; }
  .url-row { grid-template-columns: 1fr; }
  .toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .toolbar label, .toolbar select { width: 100%; min-width: 0; }
  .button-group { grid-column: 1 / -1; min-width: 0; margin: 0; }
  .button-group button { flex: 1 1 6rem; min-width: 0; padding-inline: .55rem; font-size: .88rem; }
  .preview-meta { align-items: flex-start; }
  .preview-meta > * { min-width: 0; }
  .preview-meta p { max-width: 48%; }
  .stage { padding: 1rem; min-height: 35rem; justify-content: center; }
  .notice { display: block; }
  .notice p { margin-top: .35rem; }
}
