:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1f2532;
  --sub: #6b7380;
  --primary: #3c7dff;
  --border: #e5e7ee;
  --shadow: 0 8px 24px rgba(20, 30, 60, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-y: scroll;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

body::-webkit-scrollbar {
  display: none;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.header {
  text-align: center;
  margin-bottom: 20px;
}

.title {
  font-size: 22px;
  font-weight: 700;
}

.subtitle {
  margin-top: 4px;
  color: var(--sub);
  font-size: 13px;
}

.online-indicator {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.08);
  color: #2563eb;
  font-size: 12px;
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.icon-button {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #e9ecf5;
}

.feature-more-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  background: var(--primary);
  color: #fff;
}

.icon-trash {
  border: none;
  padding: 0;
  background: transparent;
  color: #a0a4b8;
  font-size: 16px;
  cursor: pointer;
}

.icon-trash:hover {
  color: #6b7380;
}

.form-row {
  display: flex;
  gap: 8px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label {
  font-size: 12px;
  color: var(--sub);
}

input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
}

button {
  border: none;
  background: #e9ecf5;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
}

button.primary {
  width: 100%;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.hint {
  margin-top: 8px;
  color: var(--sub);
  font-size: 12px;
}

.notice-link-copy {
  border: none;
  background: transparent;
  color: var(--primary);
  padding: 0;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
  margin-right: 10px;
  white-space: nowrap;
}

.segmented {
  display: flex;
  gap: 8px;
}

.segmented-item {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f3f5fa;
  font-weight: 600;
}

.segmented-item.active {
  background: #e8efff;
  border-color: #c8d7ff;
  color: var(--primary);
}

.select-row select {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.feature-item {
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f6f8fc;
  font-size: 13px;
  text-align: center;
}

.feature-item.active {
  background: #dfe9ff;
  border-color: #b6cbff;
  color: var(--primary);
}

.history {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.history-item {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f7f9fd;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-width: 0;
}

.history-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.history-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.history-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: #fff;
}

.history-icon-placeholder {
  background: #eef1f8;
}

.history-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.history-item.active {
  border-color: #c8d7ff;
  background: #e8efff;
}

.history-item.maintain {
  opacity: 1;
}

.history-item.maintain .game-icon,
.history-item.maintain .game-name,
.history-item.maintain .game-status {
  opacity: 0.5;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.game-item {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f6f8fc;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  cursor: pointer;
}

.game-item img {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: block;
  margin: 0 auto 4px;
}

.game-item.active {
  border-color: #b6cbff;
  background: #dfe9ff;
  color: var(--primary);
}

.game-item.maintain {
  opacity: 0.4;
  cursor: not-allowed;
}

.login-status {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.login-expire {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--sub);
  line-height: 1.1;
}

.login-expire-label {
  font-size: 12px;
}

.login-expire-value {
  font-size: 12px;
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28, 28, 30, 0.9);
  color: #fff;
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(6px);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  width: 80%;
  max-width: 360px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  max-height: 80vh;
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.modal-card::-webkit-scrollbar {
  display: none;
}

.btn-primary-inline {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
}

.icon-play {
  border: none;
  padding: 0;
  background: transparent;
  color: var(--primary);
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-play:hover {
  color: #1e5de0;
}

.history-text-btn {
  border: none;
  background: transparent;
  padding: 2px 4px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.2;
}

.history-text-btn-primary {
  color: var(--primary);
}

.history-text-btn-danger {
  color: #f97373;
}

.history-text-btn:hover {
  background: rgba(148, 163, 184, 0.16);
}

.launch-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, rgba(88, 132, 255, 0.25), transparent 55%),
              radial-gradient(circle at bottom, rgba(76, 210, 255, 0.2), transparent 55%),
              #020617;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1000;
}

.launch-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.launch-inner {
  position: relative;
  width: 100%;
  max-width: 360px;
  padding: 40px 24px 32px;
  border-radius: 24px;
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.16), rgba(15, 23, 42, 0.96));
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.85);
  text-align: center;
  overflow: hidden;
}

.launch-inner::before,
.launch-inner::after {
  content: '';
  position: absolute;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  inset: 14px;
  opacity: 0.4;
  animation: launch-ring 3s ease-in-out infinite;
  pointer-events: none;
}

.launch-inner::after {
  inset: 4px;
  opacity: 0.25;
  animation-delay: 0.6s;
}

.launch-logo-wrap {
  width: 96px;
  height: 96px;
  margin: 0 auto 18px;
  border-radius: 28px;
  padding: 6px;
  background: radial-gradient(circle at top, rgba(248, 250, 252, 0.9), rgba(148, 163, 184, 0.18));
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.launch-logo-wrap::before {
  content: '';
  position: absolute;
  inset: -16px;
  border-radius: 32px;
  border: 1px solid rgba(96, 165, 250, 0.65);
  opacity: 0.75;
  filter: blur(1px);
  animation: launch-pulse 2.2s ease-out infinite;
  pointer-events: none;
}

.launch-logo {
  width: 100%;
  height: 100%;
  border-radius: 22px;
  object-fit: cover;
}

.launch-text-main {
  font-size: 18px;
  font-weight: 600;
  color: #e5edff;
  letter-spacing: 0.18em;
  margin-bottom: 6px;
}

.launch-text-sub {
  font-size: 13px;
  color: #9ca3af;
  margin-bottom: 14px;
}

.launch-game-name {
  font-size: 14px;
  color: #c7d2fe;
}

.launch-stop-btn {
  margin-top: 18px;
  border: none;
  background: rgba(15, 23, 42, 0.85);
  color: #f97373;
  padding: 8px 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.75);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: translateY(4px);
}

.launch-overlay.running .launch-stop-btn {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@keyframes launch-pulse {
  0% {
    transform: scale(0.92);
    opacity: 0.3;
  }
  45% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.08);
    opacity: 0;
  }
}

@keyframes launch-ring {
  0% {
    transform: scale(0.98);
    opacity: 0.2;
  }
  50% {
    transform: scale(1.02);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.01);
    opacity: 0.15;
  }
}

