html {
  width: 360px;
  height: 580px;
  margin: 0;
  overflow: hidden;
}

body {
  width: 360px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: system-ui, sans-serif;
  font-size: 13px;
  color: #18191c;
  box-sizing: border-box;
}

.popup-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}

.popup-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 0 8px;
  box-sizing: border-box;
}

.popup-resize-wrap {
  flex: 0 0 auto;
}

.popup-resize-hint {
  margin: 0;
  padding: 4px 10px 0;
  font-size: 10px;
  color: #9499a0;
  text-align: center;
  line-height: 1.35;
}

.bug-notify-banner {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff6e5;
  border: 1px solid #ffe0a3;
  color: #8a6116;
  font-size: 12px;
  line-height: 1.45;
  cursor: pointer;
}

.bug-notify-banner.hidden {
  display: none !important;
}

.bug-form textarea {
  width: 100%;
  min-height: 120px;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid #e3e5e7;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
}

html.popup-standalone-mode,
html.popup-standalone-mode body {
  min-height: 100vh;
  max-height: none !important;
  height: auto !important;
}

html.popup-standalone-mode .popup-root {
  min-height: 100vh;
}

html.popup-standalone-mode #popup-resize-hint {
  display: none;
}

.popup-resize-handle {
  flex: 0 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ns-resize;
  user-select: none;
  background: linear-gradient(to bottom, #f6f7f8, #eceff1);
  border-top: 1px solid #e3e5e7;
  touch-action: none;
}

.popup-resize-handle:hover {
  background: #e3f6fc;
}

.popup-resize-grip {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: #c9ccd0;
}

.popup-resize-handle:hover .popup-resize-grip {
  background: #00aeec;
}

body.is-resizing-popup {
  cursor: ns-resize;
}

body.is-resizing-popup .popup-scroll {
  pointer-events: none;
}

.banner {
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
}

.banner.warn {
  background: #fff6e5;
  color: #8a6116;
}

.banner.danger {
  background: #ffe8e8;
  color: #c23a3a;
}

header {
  padding: 12px 14px 8px;
}

.popup-extra-actions {
  margin: 12px 0 10px;
}

#logged-in .popup-extra-actions {
  margin-top: 4px;
}

.extra-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.extra-row:last-child {
  margin-bottom: 0;
}

.extra-row-2 .extra-btn {
  flex: 1 1 0;
  min-width: 0;
}

.extra-btn {
  width: auto;
  margin: 0;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid #e3e5e7;
  background: #f6f7f8;
  color: #18191c;
  font-size: 12px;
  cursor: pointer;
  line-height: 1.3;
}

.extra-btn:hover:not(:disabled) {
  border-color: #00aeec;
  background: #e3f6fc;
  color: #00aeec;
}

.extra-btn-wide {
  width: 100%;
}

.extra-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  color: #9499a0;
}

.popup-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
}

.popup-modal.hidden {
  display: none !important;
}

.popup-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.popup-modal-panel {
  position: relative;
  width: 100%;
  max-width: 336px;
  max-height: min(85vh, 720px);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.popup-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e3e5e7;
}

.popup-modal-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.popup-modal-close {
  width: auto;
  margin: 0;
  padding: 0 8px;
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  color: #9499a0;
  cursor: pointer;
}

.popup-modal-body {
  padding: 12px 14px 14px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.55;
  color: #18191c;
}

.popup-modal-body h3 {
  margin: 14px 0 6px;
  font-size: 13px;
}

.popup-modal-body h3:first-child {
  margin-top: 0;
}

.popup-modal-body ol,
.popup-modal-body ul {
  margin: 0 0 10px;
  padding-left: 1.25em;
}

.popup-modal-body p {
  margin: 0 0 8px;
}

.popup-modal-body .author-note-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.popup-modal-body .empty-hint {
  color: #9499a0;
  text-align: center;
  padding: 16px 8px;
}

h1.app-title {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
}

h1.app-title .app-version {
  font-size: 12px;
  font-weight: 600;
  color: #61666d;
}

section {
  padding: 0 14px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.tab {
  flex: 1;
  padding: 6px;
  border: 1px solid #e3e5e7;
  border-radius: 6px;
  background: #f6f7f8;
  cursor: pointer;
}

.tab.active {
  background: #00aeec;
  color: #fff;
  border-color: #00aeec;
}

.form-panel label {
  display: block;
  margin-bottom: 8px;
}

.auth-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin: 4px 0 10px;
}

.checkbox-row {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin: 0 !important;
  font-size: 12px;
  color: #61666d;
  cursor: pointer;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.auth-links {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.6;
}

.auth-links a {
  color: #00aeec;
  text-decoration: none;
  margin-right: 10px;
}

.auth-links a:hover {
  text-decoration: underline;
}

.hint.mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  word-break: break-all;
  margin-top: 6px;
}

input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid #e3e5e7;
  border-radius: 4px;
}

button[type="submit"],
button.primary {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: #00aeec;
  color: #fff;
  cursor: pointer;
}

button.secondary {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  border-radius: 6px;
  background: #fff;
  color: #18191c;
  border: 1px solid #e3e5e7;
  cursor: pointer;
}

#auth-error.ok {
  color: #1a7f4b;
  background: #e4f7ed;
  padding: 8px;
  border-radius: 6px;
}

.error {
  color: #f85a54;
  font-size: 12px;
}

.hint {
  color: #9499a0;
  font-size: 12px;
}

.hidden {
  display: none !important;
}

.user-line {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

#membership-status {
  color: #fb7299;
  font-size: 12px;
}

.tag-panel {
  margin: 12px 0;
  padding: 10px 0;
  border-top: 1px solid #e3e5e7;
  border-bottom: 1px solid #e3e5e7;
}

.tag-panel h2 {
  margin: 0;
  font-size: 14px;
}

.tag-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.link-btn {
  width: auto;
  margin-top: 0;
  border: none;
  background: none;
  color: #00aeec;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}

.up-mid-row {
  margin: 8px 0;
}

.up-mid-inputs {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.up-mid-inputs input {
  flex: 1;
  margin-top: 0;
}

.up-mid-inputs button {
  width: auto;
  margin-top: 0;
  white-space: nowrap;
  padding: 6px 8px;
}

.tag-sections {
  overflow: visible;
}

.tag-group {
  margin-bottom: 10px;
}

.tag-group-title {
  font-size: 12px;
  color: #9499a0;
  margin-bottom: 6px;
}

.tag-group-collapsible .tag-group-collapse-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin: 0 0 6px;
  padding: 6px 8px;
  border: 1px solid #e3e5e7;
  border-radius: 8px;
  background: #f6f7f8;
  color: #61666d;
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.tag-group-collapsible .tag-group-collapse-head:hover {
  border-color: #00aeec;
  background: #e3f6fc;
  color: #00aeec;
}

.tag-group-collapse-title {
  flex: 1 1 auto;
  min-width: 0;
}

.collapse-arrow {
  flex: 0 0 auto;
  display: inline-block;
  font-size: 10px;
  transition: transform 0.15s ease;
}

.collapse-arrow.expanded {
  transform: rotate(90deg);
}

.tag-group-collapse-body[hidden] {
  display: none !important;
}

/* 一级 / 二级双栏 */
.tag-dual-pane {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  min-height: 0;
}

.tag-pane-l1,
.tag-pane-l2 {
  border: 1px solid #e3e5e7;
  border-radius: 8px;
  background: #fff;
  min-height: 0;
}

.tag-pane-l1 {
  flex: 0 0 38%;
  /* 7 行一级选项高度 */
  max-height: calc(7 * 34px);
  overflow-y: auto;
}

.tag-pane-l2 {
  flex: 1 1 0;
  min-width: 0;
  max-height: calc(7 * 34px);
  overflow-y: auto;
  padding: 6px;
  box-sizing: border-box;
}

.tag-l1-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: none;
  border-bottom: 1px solid #f1f2f3;
  border-radius: 0;
  background: #fff;
  color: #18191c;
  text-align: left;
  font-size: 12px;
  line-height: 1.25;
  cursor: pointer;
  box-sizing: border-box;
}

.tag-l1-item:last-child {
  border-bottom: none;
}

.tag-l1-item:hover {
  background: #f6f7f8;
}

.tag-l1-item.active {
  background: #e3f6fc;
  color: #00aeec;
  font-weight: 600;
}

.tag-pane-placeholder {
  margin: 0;
  padding: 12px 8px;
  font-size: 12px;
  color: #9499a0;
  text-align: center;
  line-height: 1.4;
}

.tag-chips-pane {
  gap: 5px;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  width: auto;
  margin-top: 0;
  padding: 5px 10px;
  border: 1px solid #e3e5e7;
  border-radius: 999px;
  background: #f6f7f8;
  color: #18191c;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.3;
}

.tag-chip:hover {
  border-color: #00aeec;
  background: #e3f6fc;
}

.tag-chip.selected,
.tag-l1-item.selected {
  border-color: #00aeec;
  background: #e3f6fc;
  color: #00aeec;
  font-weight: 600;
  box-shadow: 0 0 0 1px #00aeec;
}

.tag-draft-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
  margin: 8px 0 6px;
  padding: 8px;
  background: #f6f7f8;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.35;
  color: #61666d;
}

.tag-draft-bar .draft-slot {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-draft-bar .draft-slot.done {
  color: #00aeec;
  font-weight: 600;
}

.tag-group.is-passerby-skip {
  opacity: 0.45;
  pointer-events: none;
}

.tag-chip.emoji {
  background: #fff5f8;
  border-color: #ffd6e0;
  color: #18191c;
}

.tag-chip.tag-chip-emoji-only {
  min-width: 34px;
  padding: 5px 8px;
  font-size: 18px;
  line-height: 1.1;
  text-align: center;
}

.tag-chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.settings {
  margin-top: 12px;
  border-top: 1px solid #e3e5e7;
  padding-top: 10px;
}
