/* Mu (無) — Settings & Companion WebRTC Sync Styles */

/* 1. Header Title Hold Gesture & Ink-Underline Progress */
.header-title-wrap h1 {
  position: relative;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transition: transform 0.22s cubic-bezier(0.2, 0, 0, 1), color 0.2s ease;
}

.header-title-wrap h1.title-holding {
  transform: scale(0.965);
  color: var(--ink-primary);
}

.header-title-wrap h1::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 0%;
  height: 2.5px;
  background: var(--ink-secondary);
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  transition: width 0.3s ease, opacity 0.25s ease;
}

.header-title-wrap h1.title-holding::after {
  opacity: 0.9;
  animation: inkUnderlineProgress 3s cubic-bezier(0.1, 0.4, 0.2, 1) forwards;
}

@keyframes inkUnderlineProgress {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}

/* 2. Settings Modal Overlay */
.settings-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(24, 21, 19, 0.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  animation: fadeInSettings 0.2s ease;
}

.settings-modal-overlay.active {
  display: flex;
}

@keyframes fadeInSettings {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Paper-styled Settings Card ("Back of the Paper") */
.settings-paper-card {
  max-width: 440px;
  width: 100%;
  max-height: 90vh;
  background: var(--sheet-bg);
  border: 1px solid var(--paper-border);
  border-radius: 14px;
  box-shadow: 
    0 18px 48px rgba(24, 21, 19, 0.35),
    0 2px 10px rgba(45, 30, 15, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
  animation: scaleUpSettings 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUpSettings {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Settings Header */
.settings-header {
  padding: 18px 20px 14px 22px;
  border-bottom: 1px dashed var(--paper-border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: var(--paper-bg);
}

.settings-header-titles h2 {
  font-family: var(--heading-font);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.settings-subtitle {
  font-size: 11.5px;
  color: var(--ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 3px;
  font-weight: 500;
}

.settings-close-btn {
  background: transparent;
  border: 1px solid var(--paper-border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
}

.settings-close-btn:hover {
  background: var(--sheet-pinned);
  color: var(--ink-primary);
  border-color: var(--ink-faded);
}

/* Settings Content Scroll Body */
.settings-body {
  padding: 18px 22px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(85, 60, 35, 0.2) transparent;
}

.settings-body::-webkit-scrollbar {
  width: 4px;
}
.settings-body::-webkit-scrollbar-thumb {
  background: rgba(85, 60, 35, 0.2);
  border-radius: 4px;
}

/* Settings Section */
.settings-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-section-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-section-desc {
  font-size: 12px;
  color: var(--ink-secondary);
  line-height: 1.45;
  margin: 0;
}

.settings-deferred-note {
  font-size: 11px;
  font-style: italic;
  color: var(--ink-faded);
  margin-top: 2px;
}

/* Sync Action Card */
.sync-action-box {
  background: var(--paper-bg);
  border: 1px solid var(--paper-border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sync-primary-btn {
  background: var(--ink-primary);
  color: #FAF4EB;
  border: none;
  border-radius: 8px;
  padding: 11px 16px;
  font-family: var(--font-zen);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: opacity 0.18s ease, transform 0.15s ease;
}

.sync-primary-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.sync-primary-btn:active {
  transform: translateY(0);
}

/* Clear Retention Pills */
.retention-pills {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.retention-pill {
  flex: 1;
  padding: 9px 8px;
  border: 1px solid var(--paper-border);
  background: var(--paper-bg);
  border-radius: 8px;
  font-family: var(--font-zen);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
  cursor: pointer;
  text-align: center;
  transition: all 0.18s ease;
}

.retention-pill.active {
  background: var(--sheet-pinned);
  border-color: var(--ink-primary);
  color: var(--ink-primary);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(45, 30, 15, 0.08);
}

/* Toggle Switch */
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.paper-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--paper-subtle);
  border: 1px solid var(--paper-border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.22s ease, border-color 0.22s ease;
}

.paper-toggle.active {
  background: var(--ink-primary);
  border-color: var(--ink-primary);
}

.paper-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #FAF4EB;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.paper-toggle.active .paper-toggle-knob {
  transform: translateX(20px);
}

/* 3. Sync Pairing Sub-View Inside Settings */
.sync-subview {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.sync-subview.active {
  display: flex;
}

.sync-tabs {
  display: flex;
  border-bottom: 1px solid var(--paper-border);
  gap: 4px;
}

.sync-tab-btn {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font-zen);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
}

.sync-tab-btn.active {
  color: var(--ink-primary);
  border-bottom-color: var(--ink-primary);
  font-weight: 600;
}

.sync-tab-pane {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.sync-tab-pane.active {
  display: flex;
}

/* QR Display Container */
.qr-frame {
  background: #FAF4EB;
  border: 1px solid var(--paper-border);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 4px 12px rgba(45, 30, 15, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
}

.room-pin-display {
  font-family: monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-primary);
  letter-spacing: 0.25em;
  padding: 6px 14px;
  background: var(--paper-bg);
  border: 1px dashed var(--paper-border);
  border-radius: 6px;
}

.sync-status-indicator {
  font-size: 12.5px;
  color: var(--ink-secondary);
  display: flex;
  align-items: center;
  gap: 7px;
  text-align: center;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8A7B6B;
}

.status-dot.pulse {
  background: #C2410C;
  animation: dotPulse 1.4s infinite ease-in-out;
}

@keyframes dotPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Join Companion Input */
.sync-pin-form {
  display: flex;
  width: 100%;
  gap: 8px;
  margin-top: 6px;
}

.sync-pin-input {
  flex: 1;
  background: var(--paper-bg);
  border: 1px solid var(--paper-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: monospace;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  outline: none;
}

.sync-pin-input:focus {
  border-color: var(--ink-primary);
  background: #FAF4EB;
}

.sync-pin-submit {
  background: var(--ink-primary);
  color: #FAF4EB;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-family: var(--font-zen);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.scanner-video-box {
  width: 100%;
  max-width: 280px;
  height: 220px;
  background: #181513;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  display: none;
  align-items: center;
  justify-content: center;
  margin: 6px 0;
}

.scanner-video-box.active {
  display: flex;
}

.scanner-video-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-crosshair {
  position: absolute;
  width: 140px;
  height: 140px;
  border: 2px dashed rgba(250, 244, 235, 0.65);
  border-radius: 8px;
  pointer-events: none;
}

.stop-scan-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(24, 21, 19, 0.7);
  color: #FAF4EB;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

.sync-subview-back {
  background: transparent;
  border: none;
  color: var(--ink-secondary);
  font-family: var(--font-zen);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  align-self: flex-start;
  padding: 4px 0;
}

.sync-subview-back:hover {
  color: var(--ink-primary);
}
