/* ==========================================================================
   CUEVANCE Component Styles - Ultra Compact & Legible Single-Screen UI
   ========================================================================== */

/* Language Switcher */
.lang-switch-group {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-full);
  padding: 1px;
  gap: 1px;
}

.btn-lang-tab {
  padding: 4px 10px;
  min-height: 28px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.btn-lang-tab:hover {
  color: var(--text-primary);
}

.btn-lang-tab.lang-active {
  background: var(--accent-cyan);
  color: var(--accent-on-cyan);
  box-shadow: 0 0 6px var(--accent-cyan-glow);
}

/* Card Sections */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  backdrop-filter: var(--card-backdrop);
  -webkit-backdrop-filter: var(--card-backdrop);
}

/* 2. Preview Section - Compact */
.preview-section-main {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preview-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.preview-badge-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-cyan);
}

.preview-spec-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
}

.preview-quick-actions {
  display: flex;
  gap: 4px;
}

.btn-tool-pill {
  padding: 4px 10px;
  min-height: 28px;
  background: var(--bg-input);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.btn-tool-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--accent-cyan);
}

.btn-tool-pill.btn-tool-active {
  background: var(--accent-cyan-glow);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.svg-viewport-wrapper {
  width: 100%;
  background: var(--canvas-bg);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.aspect-svg-canvas {
  width: 100%;
  height: auto;
  max-height: 220px; /* スマホ1画面で綺麗に収まる高さ */
  display: block;
}

.svg-stage-bg {
  fill: none;
  stroke: var(--bg-card-border);
  stroke-dasharray: 4 4;
}

.svg-ref-frame {
  fill: none;
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 1px;
}

.svg-aspect-rect {
  fill: var(--canvas-rect);
  stroke: var(--canvas-stroke);
  stroke-width: 2px;
  transition: all 0.2s var(--ease-spring);
}

.svg-hud-pill {
  fill: var(--canvas-hud-bg);
  stroke: var(--bg-card-border);
  stroke-width: 1px;
  backdrop-filter: blur(12px);
}

.svg-hud-ratio {
  fill: var(--text-primary);
  font-size: 20px;
  font-weight: 800;
  font-family: var(--font-sans);
}

.svg-hud-res {
  fill: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
}

.svg-dim-label {
  fill: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-sans);
}

.svg-cell-pill {
  fill: rgba(8, 12, 26, 0.9);
  stroke: var(--accent-cyan);
  stroke-width: 1px;
  backdrop-filter: blur(10px);
}

.svg-cell-text {
  fill: var(--accent-cyan);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-sans);
}

.svg-grid-line {
  stroke: var(--canvas-grid);
  stroke-width: 1.5px;
  stroke-dasharray: 4 4;
  pointer-events: none;
}

/* Interactive Grid Cells & Origin Pins */
.svg-grid-cell-item {
  cursor: pointer;
}

.svg-cell-hitbox {
  fill: transparent;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.svg-grid-cell-item:hover .svg-cell-hitbox {
  fill: rgba(56, 189, 248, 0.08);
}

.svg-grid-cell-selected .svg-cell-hitbox {
  fill: rgba(56, 189, 248, 0.18);
  stroke: var(--accent-cyan);
  stroke-width: 2px;
}

.svg-origin-pin {
  pointer-events: none;
  opacity: 0.7;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.svg-grid-cell-item:hover .svg-origin-pin,
.svg-origin-pin.pin-active {
  opacity: 1;
}

.svg-pin-bg {
  fill: rgba(8, 12, 26, 0.92);
  stroke: rgba(255, 255, 255, 0.25);
  stroke-width: 1px;
}

.svg-origin-pin.pin-active .svg-pin-bg {
  fill: var(--accent-cyan);
  stroke: var(--accent-cyan);
}

.svg-pin-text {
  fill: #ffffff;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.svg-origin-pin.pin-active .svg-pin-text {
  fill: var(--accent-on-cyan);
  font-weight: 800;
}

.telemetry-compact-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--bg-input);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
}

.telemetry-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.telemetry-divider {
  width: 1px;
  height: 18px;
  background: var(--bg-card-border);
}

.telemetry-label {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.1;
}

.telemetry-val {
  font-size: 11px;
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.2;
}

/* 3. Preset Selector Section - 1-Line 6 Buttons */
.preset-selector-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preset-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
}

.preset-select-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-cyan);
  white-space: nowrap;
}

.custom-select-box {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.preset-dropdown {
  width: 100%;
  height: 28px;
  background: var(--bg-input);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 700;
  padding: 0 20px 0 6px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.preset-dropdown:focus {
  border-color: var(--accent-cyan);
  outline: none;
}

.select-chevron {
  position: absolute;
  right: 6px;
  font-size: 8px;
  color: var(--text-muted);
  pointer-events: none;
}

/* 1-Line 6-Button Grid (横1行に均等配置) */
.quick-preset-scroll-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  width: 100%;
}

.preset-chip-btn {
  padding: 6px 2px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 800;
  color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease-smooth);
  text-align: center;
  white-space: nowrap;
  line-height: 1.2;
}

.preset-chip-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--accent-cyan);
}

.preset-chip-btn.active-chip {
  background: var(--accent-cyan);
  color: var(--accent-on-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-cyan-glow);
}

/* 4 & 5. Input Groups (Aspect X/Y & Width/Height) */
.aspect-inputs-group, .dimensions-inputs-group {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
}

.input-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.input-card:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px var(--accent-cyan-glow);
  background: var(--bg-input-focus);
}

.input-card-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
}

.label-badge {
  font-size: 8px;
  padding: 1px 4px;
  border-radius: 2px;
  background: var(--accent-cyan-glow);
  color: var(--accent-cyan);
  font-weight: 800;
  line-height: 1.1;
}

.label-badge.badge-dim {
  background: rgba(167, 139, 250, 0.15);
  color: #a78bfa;
}

.input-card-box {
  position: relative;
  display: flex;
  align-items: center;
}

.custom-num-input {
  width: 100%;
  height: 36px;
  background: transparent;
  border: none;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  text-align: right;
  padding-right: 24px;
  outline: none;
  font-family: var(--font-sans);
  line-height: 1;
}

.input-unit {
  position: absolute;
  right: 0;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
}

.card-separator-colon {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-cyan);
  padding: 0 2px;
  user-select: none;
}

.btn-lock-toggle {
  height: 36px;
  padding: 0 6px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: 8px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--duration-fast) var(--ease-smooth);
  min-width: 44px;
}

.btn-lock-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-lock-toggle.is-locked {
  background: var(--accent-cyan-glow);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* 6. Copy Actions */
.copy-actions-section {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 6px;
}

.btn-primary-action {
  height: 36px;
  background: var(--accent-cyan);
  color: var(--accent-on-cyan);
  font-weight: 700;
  font-size: 11px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.btn-primary-action:hover {
  filter: brightness(1.1);
  box-shadow: 0 2px 10px var(--accent-cyan-glow);
}

.btn-secondary-action {
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 11px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.btn-secondary-action:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  backdrop-filter: var(--card-backdrop);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s var(--ease-spring);
}

.toast-show {
  opacity: 1;
  transform: translateY(0);
}

.toast-hide {
  opacity: 0;
  transform: translateY(-6px);
}

.toast-icon {
  color: var(--accent-emerald);
  font-weight: 800;
}

/* ==========================================================================
   Odd Pixel Alert & Explainer Modal Styles
   ========================================================================== */
.odd-pixel-alert-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--accent-warning-bg);
  border: 1px solid var(--accent-warning-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
  animation: pulse-warning 3s ease-in-out infinite;
}

@keyframes pulse-warning {
  0%, 100% { border-color: var(--accent-warning-border); box-shadow: none; }
  50% { border-color: var(--accent-warning); box-shadow: 0 0 6px var(--accent-warning-glow); }
}

.odd-pixel-alert-card:hover, .odd-pixel-alert-card:focus-visible {
  background: rgba(245, 158, 11, 0.20);
  border-color: var(--accent-warning);
  transform: translateY(-1px);
}

.odd-alert-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-icon {
  font-size: 14px;
}

.alert-text {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-alert-warning, #fbbf24);
}

.alert-action-hint {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Modal Dialog */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease-smooth);
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--accent-warning-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  max-width: 540px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: scale(0.95);
  transition: transform 0.2s var(--ease-spring);
}

.modal-backdrop.is-open .modal-card {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--bg-card-border);
  padding-bottom: 10px;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-icon {
  font-size: 18px;
}

.modal-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
}

.btn-modal-close {
  background: var(--bg-input);
  border: 1px solid var(--bg-card-border);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.btn-modal-close:hover {
  color: var(--text-primary);
  border-color: var(--accent-cyan);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-alert-highlight {
  background: var(--accent-warning-bg);
  border-left: 3px solid var(--accent-warning);
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: var(--text-primary);
}

.modal-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-section h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.modal-section p {
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.modal-fix-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.btn-fix-pill {
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px solid var(--accent-emerald);
  color: var(--accent-emerald);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--duration-fast);
}

.btn-fix-pill:hover {
  background: var(--accent-emerald);
  color: var(--accent-on-emerald);
  box-shadow: 0 0 10px var(--accent-emerald-glow);
}

.modal-footer {
  padding-top: 10px;
  border-top: 1px solid var(--bg-card-border);
}

/* Touch Target Ergonomics & iOS Zoom Prevention */
.btn-lang-tab,
.btn-tool-pill,
.preset-chip-btn,
.btn-modal-close {
  position: relative;
}

.btn-lang-tab::after,
.btn-tool-pill::after,
.preset-chip-btn::after,
.btn-modal-close::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 44px;
  min-height: 44px;
  pointer-events: auto;
}

@media (max-width: 768px) {
  select.preset-dropdown {
    font-size: 16px !important; /* Prevents iOS Safari auto-zoom */
  }
  
  .btn-primary-action,
  .btn-secondary-action {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ==========================================================================
   CUEVANCE Web App Footer (Ultra-Compact Mobile-Optimized)
   ========================================================================== */
.app-footer {
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  backdrop-filter: var(--card-backdrop);
  -webkit-backdrop-filter: var(--card-backdrop);
  padding: 4px 10px;
  box-shadow: var(--card-shadow);
  z-index: 10;
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.footer-brand {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-chip-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  background: var(--bg-input);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: 0.02em;
  user-select: none;
  transition: all var(--duration-fast) var(--ease-smooth);
  white-space: nowrap;
}

.footer-chip-link:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
  color: var(--text-primary);
  box-shadow: 0 0 6px var(--accent-cyan-glow);
}

.link-arrow {
  font-size: 9px;
  opacity: 0.8;
}

.footer-sep {
  color: var(--text-muted);
  font-size: 9px;
  opacity: 0.5;
}

.footer-text-btn {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: none;
  padding: 2px 4px;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: all var(--duration-fast) var(--ease-smooth);
  white-space: nowrap;
}

.footer-text-btn:hover {
  color: var(--accent-cyan);
}

.footer-version {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-left: 6px;
  letter-spacing: 0.02em;
}

@media (max-width: 400px) {
  .app-footer {
    padding: 4px 6px;
  }
  
  .footer-brand {
    font-size: 9px;
  }

  .footer-version {
    font-size: 9px;
    margin-left: 3px;
  }
  
  .footer-chip-link,
  .footer-text-btn {
    font-size: 9px;
    padding: 2px 4px;
  }
}


