/* Studio chrome: shared card width, quiet surfaces, one accent.
   Card-family artwork remains in flash-card-studio-families.css. */
:root {
  /* The card is bound by height, not width: it is 5/7, so every pixel of width
     costs 1.4 of height. The pages around it have no such ceiling, so they get
     their own, wider measure instead of inheriting the card's. */
  /* The card is 5/7 aspect ratio. On desktop/laptop screens, clamp card height
     so the card, status row, step guide dock, and bottom navigation bar all fit comfortably
     in the single viewport without obscuring bottom controls. */
  --studio-content-width: clamp(280px, min(42vw, calc((100dvh - 270px) * 5 / 7)), 440px);
  --studio-page-width: clamp(340px, 92vw, 860px);
  --studio-card-surface: #12151c;
  --studio-card-accent: #65dfb4;
  --studio-card-border: #386655;
  --studio-surface: var(--studio-card-surface);
  --studio-raised: #1a2028;
  --studio-border: #303944;
  --studio-accent: var(--studio-card-accent);
  --studio-accent-line: var(--studio-card-border);
  --studio-selected: #18372e;
  --studio-radius: 12px;
  --studio-font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  --studio-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --studio-bg: #0a0d12;
  --text: #e7edf3;
  --text-bright: #f5f7fa;
  --muted: #a4afbd;
  --panel: var(--studio-surface);
  --panel-2: var(--studio-raised);
  --panel-hover: #222b35;
  --line: var(--studio-border);
  --line-strong: #526171;
  --accent: var(--studio-accent);
  --accent-mint: var(--studio-accent);
  --accent-cyan: var(--studio-accent);
  /* Compatibility aliases for existing controls and the pending interaction PR. */
  --product-gold: var(--studio-accent);
  --product-gold-line: var(--studio-accent-line);
  --product-gold-soft: var(--studio-selected);
  --product-surface: var(--studio-surface);
}
html[data-theme="light"] {
  --studio-bg: #f4f7f5;
  --studio-surface: #ffffff;
  --studio-raised: #edf2ef;
  --studio-border: #ccd8d1;
  --studio-accent: #12684c;
  --studio-accent-line: #87ac9a;
  --studio-selected: #e4f2eb;
  --text: #203129;
  --text-bright: #12271d;
  --muted: #52675c;
  --panel: var(--studio-surface);
  --panel-2: var(--studio-raised);
  --panel-hover: #e1eae4;
  --line: var(--studio-border);
  --line-strong: #87a193;
  --accent-mint: var(--studio-accent);
  --accent-cyan: var(--studio-accent);
}
body, html[data-theme="light"] body {
  background: var(--studio-bg);
  color: var(--text);
  font-family: var(--studio-font);
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}
html {
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}
* {
  -webkit-tap-highlight-color: transparent;
}
/* Prevent unintentional magnifier / callout / text selection on interactive app elements while keeping inputs functional */
body, button, .flash-card, .card-scene, .nav-tab, .m3-bottom-nav, .studio-top-strip, .sovereign-step-pill {
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}
input, textarea, [contenteditable="true"], .quick-edit-input {
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}
/* Phone rule at every width (was a max-width: 768px media query); see the frame note at the end of studio-production-mobile.css. */
input, select, textarea, button {
  font-size: max(16px, 1rem);
}
.studio-shell { background: none; }
.control-panel, .sovereign-panel, .me-settings-card, .agent-cockpit-layout,
.agent-character-hub, .matrix-panel, .matrix-inspector, .agent-engine-card, .standalone-panel {
  border-color: var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
  box-shadow: none;
}
.control-panel .panel-heading { padding: 14px 16px 12px; }
.control-panel .panel-section { padding: 14px 16px; }
.control-panel .panel-heading h2 { font-size: 16px; line-height: 1.35; font-weight: 700; letter-spacing: -.01em; }
.control-panel .panel-heading p { font-size: 12px; line-height: 1.5; color: var(--muted); margin-top: 4px; }
.control-panel .panel-section h3, .panel-section h3 { font-size: 13px; font-weight: 600; line-height: 1.4; margin: 0 0 8px; color: var(--text); }
.control-panel .section-title { flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; line-height: 1.45; letter-spacing: 0; text-transform: none; font-weight: 600; }
.control-panel .section-title-row { flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.control-panel :is(h2, h3, p, strong, small) { overflow-wrap: anywhere; }
[data-flash-card-studio] .control-panel::before,
[data-flash-card-studio] .sovereign-panel::before { content: none; }

/* The visible card and all four information pages share the same measure.
   Its workspace stays wider to hold the existing frame/sticker rails. */
.card-scene .flash-card { width: var(--studio-content-width); min-width: 0; max-width: 100%; }
.card-stage-dock { width: min(var(--studio-content-width), 100%); max-width: var(--studio-content-width); }
.control-panel[data-tab-content] { min-width: 0; margin-top: 0; }
.control-panel :is(.panel-section, .service-unavailable, .skills-grid, .agent-hero-card, .matrix-dialogue-card) {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}
.control-panel :is(.panel-section, .panel-heading) > :last-child { margin-bottom: 0; }

/* Solid selection states; labels remain crisp in every section. */
.topbar-tab, .m3-bottom-nav .nav-tab .nav-pill {
  border-radius: 10px;
  transition: background-color 150ms ease, color 150ms ease;
}
.topbar-tab.active, .m3-bottom-nav .nav-tab.active .nav-pill,
html[data-theme="light"] .topbar-tab.active,
html[data-theme="light"] .m3-bottom-nav .nav-tab.active .nav-pill {
  color: var(--studio-accent);
  background: var(--studio-selected);
  border-color: var(--studio-accent-line);
  box-shadow: none;
}
.brand-human .brand-x, .brand-id { color: var(--studio-accent); text-shadow: none; }
.card-step-guide.prominent { border: 0; background: none; }
.card-flip-controls { border-color: var(--studio-border); background: var(--studio-surface); box-shadow: none; }
.agent-pill, .matrix-control-btn, .agent-hero-badge, .matrix-privacy-chip {
  border-radius: 8px;
  border-color: var(--studio-accent-line);
  color: var(--studio-accent);
  background: var(--studio-selected);
  box-shadow: none;
}
.agent-avatar-orb { color: var(--studio-accent); border-color: var(--studio-accent-line); background: var(--studio-selected); }
.service-unavailable {
  padding: 16px;
  border: 1px solid var(--studio-border);
  border-radius: 10px;
  background: var(--studio-raised);
  color: var(--muted);
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.agent-hero-card, .agent-chat-box, .agent-input-container {
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
  box-shadow: none;
}
.agent-input-container:focus-within { border-color: var(--studio-accent); }
.agent-status-tag { font-family: var(--studio-mono); font-size: 11px; letter-spacing: 0; }
.agent-hero-card::after { content: none; }
.agent-cockpit-center { justify-content: center; }
.agent-pill { white-space: normal; line-height: 1.5; }
.agent-name-text, .me-name, .setting-label-col, .credential-name { color: var(--text); }
.agent-caption-sub, .credential-meta, .me-handle { color: var(--muted); overflow-wrap: anywhere; }

/* Settings stack within the card-sized column, including long translated labels. */
.me-profile-card { padding: 12px 14px; gap: 10px; flex-wrap: wrap; background: var(--studio-raised); border-color: var(--studio-border); box-shadow: none; }
.me-profile-info, .credential-info { min-width: 0; overflow-wrap: anywhere; }
.me-name { font-size: 14px; font-weight: 600; color: var(--text); }
.me-handle { font-size: 11px; color: var(--muted); }
.me-badge { font-size: 9px; padding: 2px 7px; }
.credential-item { padding: 10px 12px; background: var(--studio-raised); border-color: var(--studio-border); }
.credential-name { font-size: 12.5px; font-weight: 500; color: var(--text); }
.credential-meta { font-size: 11px; color: var(--muted); }
.setting-item { flex-direction: column; align-items: stretch; gap: 6px; font-size: 12px; }
.setting-label-col { min-width: 0; font-size: 12px; }
.setting-label-col svg { flex-shrink: 0; }
.sound-toggle-btn { box-sizing: border-box; width: 100%; min-width: 0; min-height: 38px; font-size: 12.5px; color: var(--text); background: var(--studio-raised); border-color: var(--studio-border); }
.sound-toggle-btn { justify-content: center; font-size: 12.5px; white-space: normal; }
.sound-toggle-btn.active { color: var(--studio-accent); background: var(--studio-selected); border-color: var(--studio-accent-line); }

.skills-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.skill-slot-chip {
  box-sizing: border-box;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 14px;
  text-align: left;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
  color: var(--text);
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.skill-slot-chip:active {
  background: var(--studio-selected);
  border-color: var(--studio-accent-line);
}
.skill-slot-chip.equipped {
  border-color: var(--studio-accent-line);
  background: var(--studio-selected);
}
.skill-slot-icon { width: 34px; height: 34px; color: var(--studio-accent); display: grid; place-items: center; flex-shrink: 0; }
.skill-slot-icon svg { width: 28px; height: 28px; }
.skill-slot-info { display: flex; align-items: center; min-width: 0; flex: 1; }
.skill-slot-name { font: 600 13.5px/1.4 var(--studio-font); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skill-slot-type { display: none; }
.skill-availability { display: none; }

/* Matrix is data, not decorative noise. Keep the dense map scrollable inside
   its own frame at small widths; the page itself never grows beyond the card. */
[data-tab-content="twin"] :is(h2, h3, p, span, strong, b) { text-shadow: none; }
.twin-subtab-bar { margin: 12px; padding: 4px; gap: 2px; background: var(--studio-raised); border-color: var(--studio-border); }
.twin-subtab-btn { min-width: 0; min-height: 44px; padding: 8px 5px; gap: 4px; white-space: normal; }
.twin-subtab-btn.active, .matrix-quad-btn.active,
html[data-theme="light"] .twin-subtab-btn.active {
  background: var(--studio-selected);
  color: var(--studio-accent);
  border-color: var(--studio-accent-line);
  box-shadow: none;
}
.matrix-hex-frame, .dimension-inspector, .matrix-stat-card,
.matrix-dialogue-card, .earth-journey-progress, .verification-score-card {
  box-sizing: border-box;
  max-width: 100%;
  background: var(--studio-raised);
  border: 1px solid var(--studio-border);
  border-radius: 10px;
  box-shadow: none;
}
.matrix-hex-frame { padding: 8px; overflow-x: auto; overscroll-behavior-inline: contain; }
.matrix-hex-grid { min-width: 272px; }
.matrix-hex-cell { color: var(--muted); background: var(--studio-surface); }
.matrix-hex-cell.active { color: var(--text); background: var(--studio-raised); }
.matrix-hex-cell.selected { background: var(--studio-selected) !important; color: var(--studio-accent) !important; box-shadow: inset 0 0 0 1px var(--studio-accent-line); }
.matrix-hex-cell.highlighted { box-shadow: inset 0 0 0 1px var(--studio-border); }
.dimension-badge-hex { color: var(--studio-accent); background: var(--studio-selected); border-color: var(--studio-accent-line); }
.matrix-stat-value.green, .dimension-info-title { color: var(--text); }
.dimension-info-meta { color: var(--muted); line-height: 1.5; }
.journey-progress-header { flex-wrap: wrap; gap: 6px; }
.journey-progress-header strong { color: var(--studio-accent); }
.journey-progress-bar { background: var(--studio-accent); box-shadow: none; }
.journey-progress-bar::after { content: none; }
.conscious-chat-header, .conscious-chat-meta { flex-wrap: wrap; gap: 8px; }
.conscious-chat-meta { display: flex; align-items: center; min-width: 0; }
.conscious-chat-meta > div { min-width: 0; }
.conscious-chat-meta small { display: block; color: var(--muted); }
.conscious-chat-status { color: var(--studio-accent); background: var(--studio-selected); border-color: var(--studio-accent-line); }
.chat-bubble { box-sizing: border-box; overflow-wrap: anywhere; }
.chat-bubble.ai { color: var(--text); background: var(--studio-raised); border-color: var(--studio-border); }
.matrix-opt-btn { min-height: 44px; white-space: normal; overflow-wrap: anywhere; color: var(--text); background: var(--studio-raised); border-color: var(--studio-border); }
.formula-row { flex-wrap: wrap; gap: 4px 8px; }
.matrix-feed-input-row { flex-wrap: wrap; }
.matrix-feed-input { width: 100%; min-width: 0; min-height: 44px; font-size: 16px; }
.matrix-feed-btn { min-height: 44px; margin-left: auto; background: var(--studio-selected); color: var(--studio-accent); border-color: var(--studio-accent-line); }

/* Native editors retain synchronous focus, keyboard viewport and dirty-state UI. */
.skill-detail-dialog, .mobile-copy-dialog {
  box-sizing: border-box;
  width: min(420px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid var(--studio-border);
  border-radius: 16px;
  color: var(--text);
  background: var(--studio-surface);
  max-height: calc(100dvh - 32px);
  overflow: auto;
}
.skill-detail-dialog p { line-height: 1.7; }
.skill-detail-dialog button, .mobile-copy-dialog button {
  min-height: 44px; padding: 10px 18px; border: 1px solid var(--studio-accent-line);
  border-radius: 10px; color: var(--studio-accent); background: var(--studio-selected);
}
.mobile-copy-dialog textarea { box-sizing: border-box; width: 100%; margin: 12px 0; font-size: 16px; min-height: 96px; color: inherit; background: var(--studio-raised); }
:is(.skill-detail-dialog, .mobile-copy-dialog, .mobile-editor-host)::backdrop { background: rgb(0 0 0 / .62); }
:is(button, a, input, textarea, select):focus-visible { outline: 2px solid var(--studio-accent); outline-offset: 3px; }
.mobile-editor-host {
  box-sizing: border-box; padding: 0; position: fixed; inset: auto;
  top: calc(var(--keyboard-viewport-top, 0px) + 12px); left: 50%; transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px)); max-width: none;
  max-height: calc(var(--keyboard-viewport-height, 100dvh) - 24px);
  margin: 0; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 14px;
  background: rgba(14, 18, 28, 0.96); color: var(--text); overflow: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}
.mobile-editor-host .quick-edit-dialog { box-sizing: border-box; width: 100%; max-width: none; margin: 0; padding: 18px 20px; border: 0; border-radius: 0; background: transparent; box-shadow: none; animation: none; }
.mobile-editor-host h3 { margin: 0 0 4px; font: 700 16px/1.3 var(--studio-font); color: #f1f5f9; letter-spacing: -.01em; }
.mobile-editor-host .quick-edit-desc { margin: 0 0 12px; font-size: 12px; line-height: 1.45; color: var(--muted); }
.mobile-editor-field { display: grid; gap: 6px; margin: 10px 0; font-size: 12px; color: var(--text); }
.mobile-editor-host .quick-edit-input {
  box-sizing: border-box; width: 100%; min-height: 42px; font: 400 14px/1.5 var(--studio-font);
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 8px; padding: 9px 12px;
  color: var(--text); background: rgba(255, 255, 255, 0.04); resize: vertical; outline: none !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.mobile-editor-host .quick-edit-input:focus { border-color: var(--studio-accent) !important; outline: none !important; box-shadow: 0 0 0 2px rgba(101, 223, 180, 0.18) !important; }
.mobile-editor-host .quick-edit-input::placeholder { color: var(--muted); }
.mobile-editor-host .quick-edit-input-group {
  display: flex;
  align-items: stretch;
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.mobile-editor-host .quick-edit-input-group:focus-within {
  border-color: var(--studio-accent) !important;
  box-shadow: 0 0 0 2px rgba(101, 223, 180, 0.18) !important;
}
.mobile-editor-host .quick-edit-input-group .quick-edit-prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 10px 0 12px;
  background: rgba(255, 255, 255, 0.06);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
  flex-shrink: 0;
}
.mobile-editor-host .quick-edit-input-group .quick-edit-input {
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 9px 10px !important;
  flex: 1;
  min-width: 0;
  min-height: 40px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
}
.mobile-editor-host .quick-edit-feedback { min-height: 0; margin: 4px 0 8px; font-size: 11.5px; line-height: 1.4; color: #f87171; }
.mobile-editor-host .quick-edit-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--studio-surface); padding: 8px 0 max(4px, env(safe-area-inset-bottom)); }
.mobile-editor-host .quick-edit-actions button { min-height: 36px; padding: 6px 16px; border-radius: 8px; font: 600 13px/1.4 var(--studio-font); }
.mobile-editor-host .quick-edit-actions button.quick-edit-btn-cancel,
.mobile-editor-host .quick-edit-actions button[data-quick-edit-cancel] { background: transparent !important; color: #94a3b8 !important; border: 1px solid rgba(255, 255, 255, 0.14) !important; }
.mobile-editor-host .quick-edit-actions button.quick-edit-btn-save { background: var(--studio-accent) !important; color: #021a10 !important; border: none !important; }
.mobile-editor-host .quick-edit-actions button.quick-edit-btn-save:disabled,
.mobile-editor-host button[disabled] { opacity: .45; cursor: not-allowed; background: rgba(255, 255, 255, 0.08) !important; color: #64748b !important; }
.mobile-editor-host button[hidden] { display: none; }
.mobile-editor-host .quick-edit-actions button { box-shadow: none; }

.identity-overlay .editable-tagline-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  max-width: 100%;
  padding: 0;
  margin: 6px 0 0;
  border: 0;
  border-radius: 0;
  background: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11.5px;
  line-height: 1.45;
}
.identity-overlay .is-placeholder { color: #cbd5e1; }
.identity-overlay [data-quick-edit][role="button"]:focus-visible { outline: none; text-decoration: underline; text-decoration-color: var(--studio-card-accent); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.card-front:has(.front-qr-wrapper:not([hidden])) .identity-overlay { bottom: 24px; max-height: calc(100% - 76px); padding-right: 60px; }
.card-acrylic-serial {
  left: 18px !important; bottom: 4px !important; right: auto;
  max-width: calc(100% - 130px);
  padding: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.72) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}
.card-acrylic-serial .acrylic-serial-num { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.card-front:has(.front-qr-wrapper:not([hidden])) .card-acrylic-serial { right: auto; max-width: calc(100% - 110px); }

.sovereign-toast { box-sizing: border-box; position: fixed; z-index: 99999; left: 50%; top: calc(114px + env(safe-area-inset-top, 0px)); transform: translate(-50%, 8px); opacity: 0; visibility: hidden; max-inline-size: calc(100vw - 32px); width: max-content; padding: 6px 12px; border: 1px solid var(--studio-border); border-radius: 12px; background: var(--studio-raised); color: var(--text); font: 500 12px/1.25 var(--studio-font); white-space: normal; overflow-wrap: anywhere; pointer-events: none; transition: opacity 150ms, transform 150ms; }
.sovereign-toast.is-visible { visibility: visible; opacity: 1; transform: translate(-50%, 0); }
.compact-card-status { width: 100%; display: flex; justify-content: center; margin: 0; }
.compact-card-status .render-pill { min-height: 32px; padding: 5px 12px; }
[data-view-mode="public"] :is([data-frame-sidebar], [data-sticker-sidebar], .card-side-palette, [data-creator-quest-dock], [data-growth-claim-banner], [data-trigger-google-claim], [data-trigger-edit-card], [data-replace-media-btn], [data-delete-media-btn]) { display: none !important; }
[data-view-mode="public"] [data-quick-edit] { cursor: default; }
[data-view-mode="public"] .card-hint-active { outline: none !important; animation: none !important; }

@media (hover: hover) and (pointer: fine) {
  .skill-slot-chip:hover { background: var(--studio-raised); border-color: var(--studio-accent-line); transform: none; }
}
/* Phone rule at every width (was a max-width: 780px media query); see the frame note at the end of studio-production-mobile.css. */
:root { --studio-content-width: min(84vw, 408px); }
/* Phone rule at every width (was a max-width: 700px media query); see the frame note at the end of studio-production-mobile.css. */
:root { --studio-content-width: min(calc(min(100vw, var(--studio-frame, 430px)) - 100px), 396px, max(216px, calc((100dvh - 254px) * .7142857))); } /* the frame, not the window: a desktop gets the card a 430px phone gets */
.studio-topbar { min-height: 52px; padding-block: 6px; }
.studio-shell { padding-top: 8px; }
.card-workspace { padding: 0 8px; gap: 4px; min-width: 0; }
.card-scene { min-height: 0 !important; width: 100%; padding: 6px 0; touch-action: pan-y; }
.card-stage-dock { gap: 4px; margin: 2px auto 6px; }
.card-stage-status-row { justify-content: flex-start !important; padding: 0 20px !important; margin: 2px auto 4px !important; }
.card-flip-controls { min-height: 44px; padding: 4px 10px; }
[data-flash-card-studio]:has(.card-edit-btn.is-active) .card-scene .flash-card { width: max(216px, calc(var(--studio-content-width) - 42px)); }
.card-side-pill, [data-toggle-card-flip], .style-icon-btn { min-width: 44px; min-height: 44px; }
.card-side-palette { max-height: 100%; overflow-y: auto; }
.card-step-guide { white-space: normal; line-height: 1.35; font-size: 12px; }
.card-step-guide .step-text { white-space: normal; overflow: visible; text-overflow: clip; word-break: break-word; }
.card-manipulation-hint { margin: 2px 0; font-size: 11px; }
.creator-quest-action-dock, .invitee-endorse-action-dock { margin-block: 4px; }
.share-modal .modal-dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; }
.share-input-group input { min-width: 0; font-size: 16px; }
.agent-cockpit-center { display: flex; justify-content: center; }
.card-workspace, .card-scene, .card-stage-dock { box-sizing: border-box; min-width: 0; max-width: 100%; }
.card-header-bar { left: 20px !important; right: 20px !important; top: 18px; gap: 4px; width: auto; }
.identity-acrylic-badge { min-width: 0; width: fit-content !important; max-width: calc(100% - 44px); flex: 0 1 auto !important; padding-inline: 7px; gap: 4px; }
.card-series-tag { flex-shrink: 0; padding-inline: 7px; }
.card-series-tag .series-label { display: none; }
.photo-placeholder { inset: 19% 9% auto; height: 39%; min-height: 0; width: auto; padding: 10px; gap: 8px; transform: none !important; box-sizing: border-box; max-width: 82%; margin: 0; }
.placeholder-upload-badge { width: 42px; height: 42px; margin: 0; }
.placeholder-primary-text { font-size: 13px; line-height: 1.35; }
.placeholder-sub-text { font-size: 10px; line-height: 1.35; }
.card-id-stage { inset: 15% 6% auto; height: auto; min-height: 0; width: auto; max-width: 88%; padding: 14px 14px; transform: none !important; box-sizing: border-box; margin: 0; }
.card-id-badge { width: 34px; height: 34px; margin-bottom: 6px; }
.card-id-headings { margin-bottom: 8px; }
.card-id-title { font-size: 13.5px; }
.card-id-desc { font-size: 10px; line-height: 1.35; }
.card-id-input-group { padding: 6px 10px; }
.card-id-prefix { font-size: 12px; }
.card-id-input { font-size: 12.5px; }
.card-id-feedback { font-size: 10px; margin: 5px 0 6px; min-height: 14px; }
.card-id-submit-btn { padding: 8px 12px; font-size: 12.5px; }
.identity-overlay { left: 20px; right: 20px; bottom: 24px; width: auto; max-width: none; padding: 12px 60px 0 0; box-sizing: border-box; }
.identity-overlay h1 { font-size: clamp(18px, 5.3vw, 24px); line-height: 1.2; margin: 4px 0; width: 100%; max-width: none; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.identity-overlay p { font-size: 11.5px; line-height: 1.45; margin: 4px 0 0; overflow-wrap: anywhere; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.card-front-score-badge { max-width: 100%; white-space: nowrap; font-size: 8px; }
/* Touch devices keep functional flip/drag controls, without continuous decoration. */
@media (hover: none), (pointer: coarse) {
  .card-scene .flash-card { --tilt-x: 0deg !important; --tilt-y: 0deg !important; filter: none; }
  .card-scene :is(.sparkle-layer, .foil-gloss) { display: none; }
  .card-scene .burst-elem { animation: none !important; }
  .card-scene :is(.identity-acrylic-badge, .card-series-tag) {
    background: rgba(10, 16, 28, 0.85);
    border-color: rgba(255, 255, 255, 0.26);
  }
  .studio-topbar, .m3-bottom-nav { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--studio-bg); }
}
/* Keep the existing short-screen card size; use scrolling for long content. */
@media (max-width: 420px) {
  .flash-card.is-step-1 .identity-overlay,
  .flash-card.is-step-1 .photo-replace-btn { display: none !important; }
}

@media (max-height: 520px) {
  :root { --studio-content-width: min(280px, calc(100vw - 100px)); }
  .card-workspace { overflow: visible; }
}
@media (prefers-reduced-motion: reduce) {
  .sovereign-toast, .skill-slot-chip, .topbar-tab, .nav-pill, .matrix-hex-cell { transition: none; }
}
[data-front-name].is-placeholder { font-size: clamp(18px, 5vw, 24px); color: var(--muted); font-weight: 500; line-height: 1.3; }
.front-qr-wrapper[hidden] { display: none !important; }
.photo-replace-btn[hidden] { display: none !important; }
.side-flip-icon-btn.is-next-step {
  background: #65dfb4 !important;
  border-color: #7ddc8c !important;
  color: #04130d !important;
  box-shadow: 0 0 16px rgba(101, 223, 180, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

/* ── UI Feedback Refinements ── */
/* 1. Hide Desktop Topbar Navigation Bar */
.topbar-nav {
  display: none !important;
}

/* 2. Polish Header Google Sign-in Button with Google Icon & Clean Design */
.google-login-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: var(--studio-font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-bright);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transform: translate(-9px, 3px);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.google-login-header-btn .google-btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.google-login-header-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 16px rgba(66, 133, 244, 0.28);
  transform: translate(-9px, 2px);
}

/* 3. Me Aside Panel Typography & Casing Harmonization */
[data-tab-content="me"] {
  font-family: var(--studio-font);
}
[data-tab-content="me"] .panel-heading h2 {
  font-family: var(--studio-font);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-bright);
  text-transform: none;
}
[data-tab-content="me"] .panel-heading p {
  font-family: var(--studio-font);
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
[data-tab-content="me"] .me-name {
  font-family: var(--studio-font);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-bright);
}
[data-tab-content="me"] .me-handle {
  font-family: var(--studio-mono);
  font-size: 12px;
  color: var(--muted);
}
[data-tab-content="me"] .me-badge {
  font-family: var(--studio-font);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
[data-tab-content="me"] .section-title,
[data-tab-content="me"] .panel-section h3 {
  font-family: var(--studio-font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}
[data-tab-content="me"] .credential-name {
  font-family: var(--studio-font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-bright);
}
[data-tab-content="me"] .credential-meta {
  font-family: var(--studio-font);
  font-size: 11px;
  color: var(--muted);
}
[data-tab-content="me"] .setting-label-col span {
  font-family: var(--studio-font);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
}

/* ── One frame at every width: the phone's ──
   A window wider than a phone used to get a different, larger layout: the
   column grew to 980px (560px from 1024px up), the card to 440px, the tab bar
   gave way to top tabs. Ming, 2026-09-16: a desktop or a tablet shows exactly
   what a 430px phone shows, centred, and nothing else. So the phone rules in
   this file and in flash-card-studio.css are no longer behind max-width media
   queries (their vw-based sizes are all capped in px, so they settle at the
   phone's values), and the three full-width bands — header, column, tab bar —
   are bounded to one measure here. Rules for the smallest phones (360px and
   short viewports) stay as media queries: they are about a small screen, not
   a large one. */
:root { --studio-frame: 430px; }
.studio-shell { width: min(var(--studio-frame), 100%); }
.studio-topbar { padding-inline: max(13px, calc((100% - var(--studio-frame)) / 2)); }
.m3-bottom-nav { padding-inline: max(0px, calc((100% - var(--studio-frame)) / 2)); }

/* ── Wide windows: the column, the way Threads draws it ──
   A browser cannot be kept from being widened, so from 560px up the page is
   what a large mobile-first product shows on a desktop: a flat, darker page
   with the app's 430px column centred in it, a hairline around the column,
   rounded at the top under a fixed header, running to the bottom edge. No
   device bezel — that reads as a mockup. The hairline is one fixed,
   pointer-transparent layer whose outer box-shadow paints the page colour over
   everything outside the column, so the header and the tab bar keep their
   bounded content and lose their full-width bands. Below 560px the column is
   the viewport, as before. */
@media (min-width: 560px) {
  :root { --page-backdrop: #030509; --column-line: rgba(255, 255, 255, 0.12); --column-radius: 22px; --studio-header-h: 56px; }
  html { background: var(--page-backdrop); }
  .studio-topbar {
    /* above the column layer below (500): its outer shadow paints up over the
       header band too, and the header must stay on top of it */
    position: sticky; top: 0; z-index: 600;
    min-height: var(--studio-header-h);
    background: var(--page-backdrop); border-bottom: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
    padding-inline: max(20px, calc((100% - var(--studio-frame)) / 2 + 6px));
  }
  .m3-bottom-nav { bottom: 0; border-top-color: var(--column-line); }
  [data-flash-card-studio]::after {
    content: "";
    position: fixed;
    top: var(--studio-header-h);
    bottom: 0;
    left: 50%;
    width: var(--studio-frame);
    transform: translateX(-50%);
    box-sizing: border-box;
    border: 1px solid var(--column-line);
    border-bottom: 0;
    border-radius: var(--column-radius) var(--column-radius) 0 0;
    pointer-events: none;
    z-index: 500; /* above the tab bar (200), below every modal and toast */
    box-shadow: 0 0 0 100vmax var(--page-backdrop);
  }
}

/* ── Twin › 人類驗證：layers as dense rows (Ming 09-17, H-11) ──
   One label per row was a screen per layer. Each layer is now a headline
   with its methods as small pills on the same row, layers separated by a
   hairline; the social verification panel sits above them. */
.panel-section .evidence-category-block { padding: 8px 0 10px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; }
.panel-section .evidence-category-block:first-of-type { border-top: 0; }
.panel-section .evidence-category-header { margin: 0 0 6px; }
.panel-section .category-title { font-size: 13px; font-weight: 600; }
.panel-section .academic-tag { font-size: 10px; }
.panel-section .verification-icon-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.panel-section .micro-verify-card { flex-direction: row; align-items: center; gap: 6px; min-width: 0; padding: 4px 10px 4px 4px; border-radius: 999px; text-align: start; }
.panel-section .micro-icon-badge { width: 28px; height: 28px; min-width: 28px; }
.panel-section .micro-icon-badge svg { width: 14px; height: 14px; }
.panel-section .micro-name { font-size: 11px; line-height: 1.2; white-space: nowrap; }

/* ── H-16 (Ming 09-17): the full address, and the platform pop-up ── */
.verify-copy-box { flex-wrap: wrap; }
.copy-url-handle { white-space: normal; word-break: break-all; font-weight: 600; }
.copy-url-handle[hidden], .verify-handle-input[hidden] { display: none !important; }
.verify-dialog { position: relative; margin-top: 12px; border: 1px solid var(--line-strong); border-radius: 18px; background: var(--bg-paper-sub, #0D101C); color: var(--text); padding: 14px 14px 16px; box-sizing: border-box; box-shadow: 0 18px 40px rgba(0, 0, 0, .45); }
.verify-dialog::before { content: ""; position: absolute; top: -7px; left: 28px; width: 12px; height: 12px; background: var(--bg-paper-sub, #0D101C); border-left: 1px solid var(--line-strong); border-top: 1px solid var(--line-strong); transform: rotate(45deg); }
.verify-dialog[hidden] { display: none !important; }
.verify-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.verify-dialog-head strong { font-size: 16px; }
.verify-dialog-close { min-width: 40px; min-height: 40px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.verify-dialog .verify-section-block { margin-top: 12px; }
.verify-dialog .execute-social-verify-btn { width: 100%; margin-top: 12px; }
