:root {
  font-family:
    "BIZ UDPGothic",
    "Hiragino Sans",
    "Yu Gothic UI",
    sans-serif;
  color: #172334;
  background: #f4f7fb;
  line-height: 1.5;
  font-weight: 400;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

#app {
  min-height: 100vh;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 22px;
  padding: 52px 20px;
  background:
    radial-gradient(circle at 15% 10%, rgba(14, 116, 144, 0.14), transparent 32%),
    #eef5fb;
}

.auth-header {
  width: min(760px, 100%);
  margin-top: 40px;
  text-align: center;
}

.auth-header h1 {
  margin: 6px 0 12px;
  font-size: clamp(2rem, 3.6vw, 3.2rem);
}

.auth-header p:last-child {
  margin: 0;
  color: #506377;
}

.auth-card,
.card {
  border: 1px solid rgba(23, 35, 52, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 54px rgba(44, 64, 86, 0.11);
}

.auth-card {
  width: min(520px, 100%);
  padding: 28px;
}

.auth-card-body {
  display: grid;
  gap: 16px;
}

.auth-card h2,
.card h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: #60748b;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.muted,
.helper-text {
  color: #60748b;
}

.muted {
  margin: 0;
}

.helper-text {
  margin: 0;
  font-size: 0.88rem;
}

.google-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  border: 1px solid rgba(23, 35, 52, 0.12);
  border-radius: 999px;
  background: #fff;
  color: #24364a;
  padding: 12px 16px;
  font-weight: 700;
}

.google-login-button-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.google-mark {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(23, 35, 52, 0.12);
  border-radius: 50%;
  color: #1d4ed8;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 18px;
  border-right: 1px solid rgba(23, 35, 52, 0.08);
  background: #f9fbfd;
  padding: 24px 18px;
  max-height: 100vh;
  overflow: hidden;
}

.sidebar-header,
.topbar,
.section-header,
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 0;
  font-size: 1.85rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.storage-chip,
.user-chip,
.update-chip {
  border: 1px solid rgba(23, 35, 52, 0.08);
  border-radius: 8px;
  background: #fff;
}

.storage-chip {
  display: grid;
  gap: 4px;
  min-width: 170px;
  padding: 10px 12px;
}

.storage-chip span {
  color: #60748b;
  font-size: 0.8rem;
  font-weight: 700;
}

.storage-chip strong {
  color: #24364a;
  line-height: 1;
}

.storage-chip.danger {
  border-color: rgba(217, 119, 6, 0.24);
  background: #fff7ed;
}

.storage-chip.danger strong,
.storage-chip.danger span {
  color: #9a3412;
}

.user-chip {
  display: grid;
  gap: 2px;
  min-width: 210px;
  padding: 10px 14px;
  text-align: right;
}

.user-chip span {
  color: #60748b;
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.update-chip {
  color: #0f5e75;
  padding: 9px 12px;
  font-weight: 700;
}

.main-panel {
  min-width: 0;
  padding: 28px;
}

.step-list {
  display: grid;
  align-content: start;
  align-self: start;
  gap: 8px;
}

.run-history {
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(23, 35, 52, 0.08);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.run-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.run-history-header .eyebrow {
  margin: 0;
}

.history-refresh {
  border: 1px solid rgba(23, 35, 52, 0.1);
  border-radius: 999px;
  background: #f8fbfd;
  color: #506377;
  padding: 4px 9px;
  font-size: 0.78rem;
}

.run-history-list {
  display: grid;
  gap: 8px;
  max-height: 48vh;
  overflow: auto;
  padding-right: 4px;
}

.run-history-item {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid rgba(23, 35, 52, 0.08);
  border-radius: 8px;
  background: #f8fbfd;
  color: #172334;
  padding: 10px;
  text-align: left;
}

.run-history-item.active {
  border-color: rgba(14, 116, 144, 0.28);
  background: #e8f7fb;
}

.run-history-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-history-item small,
.run-history-item time {
  color: #60748b;
  font-size: 0.78rem;
}

.run-status {
  justify-self: start;
  border-radius: 999px;
  background: #e8eef5;
  color: #506377;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
}

.run-status.running,
.run-status.queued {
  background: #e8f7fb;
  color: #0f5e75;
}

.run-status.success {
  background: #ecfdf5;
  color: #047857;
}

.run-status.failed {
  background: #fff1f2;
  color: #9f1239;
}

.step-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #445466;
  min-height: 48px;
  padding: 10px;
  text-align: left;
}

.step-button span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e8eef5;
  color: #506377;
  font-size: 0.86rem;
  font-weight: 700;
}

.step-button.active {
  border-color: rgba(14, 116, 144, 0.18);
  background: #e8f7fb;
  color: #0f5e75;
}

.step-button.active span {
  background: #0f5e75;
  color: #fff;
}

.storage-panel {
  align-self: end;
  display: grid;
  gap: 12px;
  border: 1px solid rgba(23, 35, 52, 0.08);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.storage-row {
  display: grid;
  gap: 7px;
}

.storage-row div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #506377;
  font-size: 0.9rem;
}

.storage-row.danger div:first-child {
  color: #9a3412;
}

.storage-bar {
  height: 8px;
  border-radius: 999px;
  background: #dfe8f2;
  overflow: hidden;
}

.storage-bar.compact {
  height: 6px;
}

.storage-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #0f766e;
}

.storage-row.danger .storage-bar span {
  background: #d97706;
}

.content-stack {
  display: grid;
  gap: 18px;
}

.content-grid {
  display: grid;
  gap: 18px;
}

.two-column {
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  align-items: start;
}

.running-grid {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  align-items: start;
}

.card {
  padding: 24px;
}

.hero-card {
  display: grid;
  gap: 20px;
}

.compact-card {
  min-height: 320px;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 220px;
  border: 1px dashed rgba(14, 116, 144, 0.35);
  border-radius: 8px;
  background: #f5fbff;
  padding: 24px;
  text-align: center;
}

.dropzone input {
  display: none;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #dff3ff;
  color: #0a5771;
  font-size: 1.8rem;
  font-weight: 700;
}

.error-message {
  border: 1px solid rgba(185, 28, 28, 0.18);
  border-radius: 8px;
  background: #fff5f5;
  color: #991b1b;
  margin: 0;
  padding: 12px 14px;
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button {
  border-radius: 999px;
  padding: 10px 16px;
  white-space: nowrap;
}

.primary-button {
  border: 1px solid rgba(14, 116, 144, 0.22);
  background: #0f5e75;
  color: #fff;
}

.ghost-button {
  border: 1px solid rgba(23, 35, 52, 0.11);
  background: #fff;
  color: #506377;
}

.danger-button {
  border: 1px solid rgba(185, 28, 28, 0.22);
  background: #fff1f2;
  color: #9f1239;
}

.icon-button {
  border: 1px solid rgba(23, 35, 52, 0.12);
  background: #fff;
  color: #506377;
  min-width: 48px;
}

.design-summary,
.target-list {
  display: grid;
  gap: 12px;
  margin: 20px 0;
}

.design-summary {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.design-summary div,
.target-list div,
.security-note {
  border: 1px solid rgba(23, 35, 52, 0.08);
  border-radius: 8px;
  background: #f6f9fc;
  padding: 14px 16px;
}

.design-summary dt,
.target-list dt {
  color: #60748b;
  font-size: 0.88rem;
}

.design-summary dd,
.target-list dd {
  margin: 6px 0 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(23, 35, 52, 0.08);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid rgba(23, 35, 52, 0.08);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: #e8eef5;
  color: #24364a;
  font-weight: 700;
  white-space: nowrap;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.form-grid {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.form-field {
  display: grid;
  gap: 8px;
}

.form-field > span:first-child {
  color: #445466;
  font-weight: 700;
}

.form-field input {
  width: 100%;
  border: 1px solid rgba(23, 35, 52, 0.12);
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
}

.password-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.security-note {
  display: grid;
  gap: 4px;
  margin: 18px 0;
  color: #506377;
}

.security-note strong {
  color: #24364a;
}

.status-band {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  border: 1px solid rgba(14, 116, 144, 0.16);
  border-radius: 8px;
  background: #effafe;
  color: #0f5e75;
  padding: 14px 16px;
}

.status-band.success {
  border-color: rgba(15, 118, 110, 0.18);
  background: #eefcf8;
  color: #0f766e;
}

.pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #0f5e75;
  box-shadow: 0 0 0 rgba(15, 94, 117, 0.45);
  animation: pulse 1.4s infinite;
}

.log-console {
  display: grid;
  gap: 8px;
  max-height: 460px;
  overflow: auto;
  border-radius: 8px;
  background: #101820;
  padding: 14px;
}

.log-line {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px;
  color: #d8e5f0;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.9rem;
}

.log-line span {
  color: #8fb1cc;
}

.log-line p {
  margin: 0;
}

.log-line.warn p {
  color: #ffd38a;
}

.screenshot-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(23, 35, 52, 0.1);
  border-radius: 8px;
  background: #eef3f8;
  aspect-ratio: 16 / 10;
}

.screenshot-frame.large {
  margin-top: 16px;
}

.screenshot-frame.clickable {
  cursor: zoom-in;
}

.screenshot-frame.clickable:focus-visible,
.screenshot-frame.clickable:hover {
  border-color: rgba(14, 116, 144, 0.42);
  box-shadow: 0 10px 24px rgba(14, 116, 144, 0.12);
  outline: none;
}

.fake-browser {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  border-bottom: 1px solid rgba(23, 35, 52, 0.08);
  background: #fff;
  padding: 0 10px;
}

.fake-browser span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
}

.fake-browser strong {
  margin-left: 8px;
  color: #60748b;
  font-size: 0.78rem;
}

.fake-rakuraku-screen {
  display: grid;
  grid-template-columns: 24% 1fr;
  height: calc(100% - 30px);
}

.real-screenshot {
  display: block;
  width: 100%;
  height: calc(100% - 30px);
  object-fit: cover;
  object-position: top left;
}

.fake-sidebar {
  background:
    linear-gradient(#dbe7f5 18px, transparent 18px) 14px 18px / 70% 38px repeat-y,
    #e8eef5;
}

.fake-content {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 18px;
}

.fake-content div {
  height: 22px;
  border-radius: 6px;
  background: #fff;
}

.fake-content div:first-child {
  width: 48%;
  height: 30px;
  background: #bfd8ee;
}

.screenshot-placeholder {
  display: grid;
  place-items: center;
  height: calc(100% - 30px);
  color: #60748b;
  font-weight: 700;
}

.final-badge,
.screenshot-meta em {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #e8f7fb;
  color: #0f5e75;
  font-style: normal;
  font-weight: 700;
}

.final-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.screenshot-card {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(23, 35, 52, 0.08);
  border-radius: 8px;
  background: #f8fbfd;
  padding: 12px;
}

.screenshot-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.screenshot-meta span {
  color: #60748b;
  font-size: 0.88rem;
}

.screenshot-meta em {
  padding: 3px 8px;
  font-size: 0.78rem;
}

.screenshot-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.68);
  padding: 28px;
}

.screenshot-modal-content {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, 94vw);
  max-height: 92vh;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.32);
}

.screenshot-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(23, 35, 52, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #172334;
  font-size: 1.35rem;
  line-height: 1;
}

.screenshot-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(23, 35, 52, 0.08);
  padding: 16px 62px 16px 18px;
}

.screenshot-modal-header span {
  color: #60748b;
  font-size: 0.9rem;
}

.screenshot-modal-body {
  min-height: 0;
  overflow: auto;
  background: #eef3f8;
}

.screenshot-modal-body img {
  display: block;
  width: 100%;
  height: auto;
}

.modal-fake-screen {
  height: min(70vh, 720px);
}

.empty-box {
  border: 1px dashed rgba(23, 35, 52, 0.14);
  border-radius: 8px;
  background: #f8fbfd;
  color: #60748b;
  padding: 24px;
  text-align: center;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 12px rgba(15, 94, 117, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(15, 94, 117, 0);
  }
}

@media (max-width: 980px) {
  .app-shell,
  .two-column,
  .running-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(23, 35, 52, 0.08);
  }

  .topbar,
  .section-header,
  .action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .design-summary {
    grid-template-columns: 1fr;
  }

  .user-chip {
    text-align: left;
  }
}
