* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: #f0f2f6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #1a1a2e;
}

.container {
  background: #fff;
  border-radius: 24px;
  padding: 32px 28px;
  width: 400px;
  max-width: 94vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.07);
}

h1 {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 22px;
}

.qr-display {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}

#qr-container {
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f6f7fb;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

#qr-container.has-qr {
  box-shadow: 0 0 0 1px #e9ecef;
}

#qr-placeholder {
  color: #b0b8c4;
  font-size: 14px;
  text-align: center;
  line-height: 1.5;
  padding: 0 10px;
}

#qr-canvas {
  display: none;
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

.type-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 18px;
}

.type-btn {
  background: #f0f2f6;
  border: none;
  padding: 9px 0;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  color: #495057;
  transition: all 0.12s;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}

.type-btn:hover {
  background: #e4e7ee;
}

.type-btn:active {
  transform: scale(0.96);
}

.type-btn.active {
  background: #1a1a2e;
  color: #fff;
}

.input-area {
  margin-bottom: 14px;
}

#main-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #f8f9fc;
}

#main-input:focus {
  border-color: #1a1a2e;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26,26,46,0.08);
}

/* WiFi fields: hidden by default, shown via .visible class */
.wifi-fields {
  display: none;
  flex-direction: column;
  gap: 6px;
}

.wifi-fields.visible {
  display: flex;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #495057;
  margin-top: 6px;
}

.field-desc {
  font-size: 12px;
  color: #adb5bd;
  line-height: 1.4;
  margin-bottom: 2px;
}

.wifi-fields input[type="text"],
.wifi-fields input[type="password"],
.wifi-fields select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #f8f9fc;
}

.wifi-fields input:focus,
.wifi-fields select:focus {
  border-color: #1a1a2e;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26,26,46,0.08);
}

.wifi-fields select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.wifi-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.wifi-col {
  flex: 1;
  min-width: 0;
}

.wifi-check-col {
  flex: 0 0 auto;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #495057;
  cursor: pointer;
  white-space: nowrap;
  padding: 10px 0;
}

.check-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #1a1a2e;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.action-btn {
  flex: 1;
  padding: 11px;
  background: #f0f2f6;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: #495057;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.action-btn:hover {
  background: #e4e7ee;
}

.action-btn:active {
  transform: scale(0.97);
}

@media (max-width: 420px) {
  .container { padding: 24px 18px; }
  .type-selector { gap: 5px; }
  .type-btn { font-size: 13px; padding: 8px 0; }
  .wifi-row { flex-direction: column; gap: 0; }
}
