/* ════════════════════════════════════════
   MOBILE STYLES (max-width: 767px)
════════════════════════════════════════ */
@media (max-width: 767px) {
  #mobile-view { display: block; }
  html, body {
    width: 100%; height: 100vh;
    display: flex; align-items: flex-start; justify-content: center;
    background: #fff;
    font-family: 'NicoClean', monospace;
    overflow: hidden;
    overscroll-behavior: none;
  }

  #device {
    position: relative;
    width: 430px;
    /* height is set inline by mScaleDevice() so layout-height * scale = innerHeight */
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    transform-origin: top center;
  }

  /* ── SVG frame slices ── */
  .frame-top {
    width: 430px;
    height: 105px;
    flex: 0 0 105px;
    display: block;
    pointer-events: none;
    position: relative;
    z-index: 10;
  }
  .frame-mid {
    width: 430px;
    flex: 1 1 0;
    min-height: 0;
    margin-top: -2px;
    margin-bottom: -2px;
    display: block;
    pointer-events: none;
    position: relative;
    z-index: 10;
  }
  .frame-bottom {
    position: relative;
    width: 430px;
    height: 295px;
    flex: 0 0 295px;
  }
  .frame-bottom-art {
    position: absolute;
    inset: 0;
    width: 430px;
    height: 295px;
    pointer-events: none;
    z-index: 10;
  }

  /* ── Page bar ── */
  #page-bar {
    position: absolute;
    left: 25px; top: 45px;
    width: 380px; height: 50px;
    z-index: 11;
    pointer-events: none;
    display: flex;
    align-items: center;
  }
  #page-title {
    position: absolute;
    left: 52px; top: 19px;
    font-size: 15px;
    line-height: 1;
    color: #989898;
    text-transform: uppercase;
    white-space: nowrap;
  }

  /* ── Screen content area (confined within mid slice, 10px inset top/bottom) ── */
  #screen-content {
    position: absolute;
    left: 35px;
    top: 115px;       /* top slice (105) + 10px padding */
    bottom: 305px;    /* btm slice (295) + 10px padding */
    width: 360px;
    background: #fff;
    overflow: hidden;
    z-index: 1;
  }

  /* ── TV static ── */
  #m-static-canvas {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    z-index: 31;
  }

  /* ── Pages ── */
  .m-page {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    right: 0;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    pointer-events: none;
    overscroll-behavior: contain;
    z-index: 3;
  }
  .m-page.active {
    opacity: 1;
    pointer-events: all;
  }

  .scroll-track {
    position: absolute;
    right: 2px; top: 0; bottom: 0;
    width: 4px;
    background: #f0f0f0;
    z-index: 9;
    pointer-events: none;
    border-radius: 2px;
  }
  .scroll-thumb {
    position: absolute;
    right: 0;
    width: 4px;
    background: #bbb;
    border-radius: 2px;
    min-height: 20px;
  }
  .m-page { scrollbar-width: none; scrollbar-color: #bbb #f0f0f0; }
  .m-page::-webkit-scrollbar { display: none; }

  .m-page-inner { padding: 10px 26px 10px 2px; }
  /* Padding is asymmetric: NicoClean's glyph sits in the upper half of its line-box,
     so extra padding-top + reduced padding-bottom shifts the visible text to the centre. */
  .m-tag { display: inline-flex; align-items: center; justify-content: center; padding: 4px 6px 0; background: rgba(0,133,117,0.1); color: #008575; font-size: 12px; line-height: 1; border: 1px solid rgba(0,133,117,0.3); margin-right: 3px; }
  .m-card {
    border: 1.5px solid #e0e0e0;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s;
    height: 438px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .m-card:hover, .m-card.focused { border-color: #008575; border-width: 3px; background: rgba(0,133,117,0.02); }
  .m-card-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 8 / 5;
    flex-shrink: 0;
    background: repeating-linear-gradient(45deg,#e8e8e8 0,#e8e8e8 6px,#f0f0f0 6px,#f0f0f0 12px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #bbb;
    border-bottom: 1.5px solid #e0e0e0;
    position: relative;
  }
  .m-card-thumb.dark { background: #1a1a1a; }
  .m-card-body {
    flex: 1;
    min-height: 0;
    padding: 16px 12px 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .m-card-info-top { display: flex; flex-direction: column; }
  .m-card-title { font-size: 12px; color: #1a1a1a; line-height: 1.3; }
  .m-card-date { font-size: 12px; color: #989898; margin-top: 2px; }
  .m-card-pill {
    position: absolute;
    top: 6px;
    left: 6px;
    display: inline-block;
    text-align: center;
    background: #008575;
    color: #fff;
    font-size: 12px;
    line-height: 1.3;
    letter-spacing: 0.05em;
    padding: 5px 8px 3px;
    border-radius: 4px;
    border: 1px solid #fff;
    pointer-events: none;
  }
  .m-card-desc { font-size: 12px; color: #555; line-height: 1.35; margin-top: 16px; }
  .m-card-tags { display: flex; gap: 4px; flex-wrap: wrap; }
  .m-card-meta { font-size: 12px; color: #989898; }
  .m-row-card { border: 1.5px solid #e0e0e0; margin-bottom: 7px; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 9px 11px; transition: border-color 0.15s; min-height: 90px; }
  .m-row-card:hover, .m-row-card.focused { border-color: #008575; border-width: 3px; background: rgba(0,133,117,0.02); }
  /* NicoClean glyph offset compensation: padding-top > padding-bottom shifts the
     centred text ~2px down so it sits at the visual centre of the badge. */
  .m-row-icon { width: 38px; height: 38px; background: #008575; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; flex-shrink: 0; box-sizing: border-box; padding: 4px 0 0; }
  .m-row-date { font-size: 12px; color: #008575; white-space: nowrap; min-width: 48px; flex-shrink: 0; }
  .m-row-info { flex: 1; min-width: 0; }
  .m-status { display: inline-flex; align-items: center; justify-content: center; font-size: 12px; line-height: 1; padding: 4px 5px 0; flex-shrink: 0; }
  .m-status.live { background: rgba(0,133,117,0.12); color: #008575; border: 1px solid rgba(0,133,117,0.4); }
  .m-status.soon { background: rgba(0,0,0,0.05); color: #888; border: 1px solid #ccc; }
  .m-play { width: 0; height: 0; border-top: 9px solid transparent; border-bottom: 9px solid transparent; border-left: 14px solid #008575; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); }

  /* ── Detail overlay ── */
  #m-detail {
    position: absolute;
    inset: 0;
    background: #fff;
    z-index: 20;
    transform: translateX(100%);
    transition: transform 250ms cubic-bezier(0.4,0,0.2,1);
    display: flex; flex-direction: column;
    overflow: hidden;
  }
  #m-detail.open { transform: translateX(0); }
  #m-detail-back { display: flex; align-items: center; gap: 8px; padding: 12px 14px 30px; cursor: pointer; color: #989898; font-size: 12px; flex-shrink: 0; }
  #m-detail-back:hover { color: #008575; }
  .m-back-arrow { width: 8px; height: 8px; background: currentColor; clip-path: polygon(0% 50%, 100% 0%, 100% 100%); flex-shrink: 0; }
  #m-detail-content { flex: 1; overflow-y: auto; padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
  .m-detail-hero { width: 100%; height: 80px; background: repeating-linear-gradient(45deg,#e8e8e8 0,#e8e8e8 6px,#f0f0f0 6px,#f0f0f0 12px); display: flex; align-items: center; justify-content: center; font-size: 12px; color: #bbb; border: 1.5px solid #e0e0e0; }
  .m-detail-hero.dark { background: #1a1a1a; color: #555; position: relative; }
  /* Remove placeholder border/bg when a real image is rendered inside; let image set height */
  .m-detail-hero:has(img) { border: 0; background: none; height: auto; }
  .m-detail-title { font-size: 17px; color: #1a1a1a; line-height: 1.2; }
  .m-detail-divider { width: 28px; height: 2px; background: #008575; }
  .m-detail-body { font-size: 16px; color: #555; line-height: 1.7; }
  .m-detail-body p { margin-bottom: 8px; min-height: 1em; }
  /* Same base.css reset fix as desktop — use inside position to keep bullets from bleeding left */
  .m-detail-body ul,
  .m-detail-body ol  { padding-left: 1.2em; margin-bottom: 8px; }
  .m-detail-body li  { list-style-position: inside; margin-bottom: 3px; }
  /* Nested lists sit inside their parent <li>; the parent's bottom margin would double up. */
  .m-detail-body li > ul,
  .m-detail-body li > ol { margin-top: 3px; margin-bottom: 0; }
  /* Sub-headings within body content, scaled down from the desktop/standalone sizes —
     the device screen is only ~360px wide and .m-detail-title itself is 17px, so anything
     near the desktop scale (30/23/19) would tower over the page title. */
  .m-detail-body h1,
  .m-detail-body h2,
  .m-detail-body h3,
  .m-detail-body h4,
  .m-detail-body h5,
  .m-detail-body h6 {
    font-family: 'NicoClean', monospace;
    color: #1a1a1a;
    font-weight: 400;
    line-height: 1.25;
  }
  .m-detail-body h1 { font-size: 21px; margin: 24px 0 9px; line-height: 1.2; }
  .m-detail-body h2 { font-size: 19px; margin: 20px 0 8px; }
  .m-detail-body h3 { font-size: 17px; margin: 16px 0 6px; }
  .m-detail-body h4 { font-size: 16px; margin: 14px 0 5px; }
  .m-detail-body h5 { font-size: 15px; margin: 12px 0 4px; }
  .m-detail-body h6 { font-size: 14px; margin: 12px 0 4px; color: #989898; letter-spacing: 0.4px; text-transform: uppercase; }
  /* base.css resets all margin/padding, so blockquote and code have no UA styling left.
     Scaled down from the desktop treatment to suit the ~360px screen. */
  .m-detail-body blockquote {
    margin: 14px 0;
    padding: 4px 0 4px 12px;
    border-left: 2px solid #008575;
    color: #989898;
    font-style: italic;
    font-size: 15px;
  }
  .m-detail-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
    background: #ececec;
    padding: 1px 5px;
    border-radius: 4px;
    /* Long tokens must wrap rather than force the 360px screen to scroll sideways. */
    overflow-wrap: anywhere;
  }
  /* Underline and strike must not be mistaken for links (teal + underlined). */
  .m-detail-body u {
    text-decoration: underline;
    text-decoration-color: #e0e0e0;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
  }
  .m-detail-body s { text-decoration: line-through; color: #989898; }
  /* Captioned images. The figure carries the vertical rhythm so it doesn't stack with
     the image's own margin (which the serializer omits inside a figure). */
  .m-detail-body figure { margin: 12px 0; }
  .m-detail-body figure img { margin: 0; }
  .m-detail-body figcaption {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.45;
    color: #989898;
    text-align: center;
  }
  /* Code blocks. On a ~360px screen this is the case that matters most: the <pre>
     must scroll inside its own box, never let the device screen scroll sideways. */
  .m-detail-body .code-block {
    margin: 14px 0;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    background: #fafafa;
  }
  .m-detail-body .code-filename {
    padding: 7px 10px 5px;
    font-size: 11px;
    color: #989898;
    background: #f1f1f1;
    border-bottom: 1px solid #e0e0e0;
  }
  .m-detail-body .code-block pre {
    margin: 0;
    padding: 10px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Undo both the inline-code chip AND its overflow-wrap:anywhere — inside a block,
     code must keep its own line breaks and scroll instead of wrapping mid-token. */
  .m-detail-body pre code {
    display: block;
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre;
    overflow-wrap: normal;
    word-break: normal;
    color: #1a1a1a;
  }
  /* Tables — almost always wider than the screen, so the wrapper is what scrolls. */
  .m-detail-body .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 14px 0;
  }
  .m-detail-body table { border-collapse: collapse; font-size: 13px; }
  .m-detail-body th,
  .m-detail-body td {
    border: 1px solid #e0e0e0;
    padding: 6px 9px;
    text-align: left;
    vertical-align: top;
    line-height: 1.45;
    white-space: nowrap;
  }
  .m-detail-body th {
    font-family: 'NicoClean', monospace;
    font-weight: normal;
    color: #1a1a1a;
    background: #f7f7f7;
  }

  /* ---- Phase 5: colour decorators, highlight, divider, callouts ----------------
     Mirrors css/article.css at mobile scale. Same measured ratios — the surface is
     #fff here too, so the colour values carry over unchanged. */
  .m-detail-body .c-accent { color: #00614f; }   /* 7.44:1 AAA */
  .m-detail-body .c-muted  { color: #6b6b6b; }   /* 5.33:1 AA — see article.css note */
  .m-detail-body .c-alert  { color: #a5281b; }   /* 7.19:1 AAA */

  .m-detail-body .highlight {
    background: #eaf6f3;
    padding: 0.1em 0.2em;
    border-radius: 2px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
  }

  .m-detail-body hr {
    border: 0;
    border-top: 1px solid #e0e0e0;
    margin: 18px auto;
    width: 100%;
  }

  .m-detail-body .callout {
    margin: 14px 0;
    padding: 10px 12px;
    border-left: 3px solid;
    border-radius: 0 3px 3px 0;
    color: #1a1a1a;          /* lifts every tone to ~15.7:1 AAA */
    font-size: 15px;
    line-height: 1.6;
  }
  .m-detail-body .callout > :last-child { margin-bottom: 0; }
  .m-detail-body .callout p { margin-bottom: 8px; }
  .m-detail-body .callout ul,
  .m-detail-body .callout ol { margin-bottom: 8px; padding-left: 1.2em; }

  .m-detail-body .callout-info    { background: #eaf6f3; border-left-color: #00614f; }
  .m-detail-body .callout-tip     { background: #ecf5ed; border-left-color: #2e6b32; }
  .m-detail-body .callout-warning { background: #fdf4e5; border-left-color: #8a5a00; }

  /* ---- Phase 6: Tableau card + file download ---------------------------------
     Mirrors css/article.css at mobile scale. Both are anchors, so they must clear
     the `.m-detail-body a` inline-link styling (NicoBold teal, underline, and the
     padding/negative-margin used for the hover highlight). */
  .m-detail-body .tableau-card {
    display: block;
    padding: 0;
    margin: 14px 0;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    text-decoration: none;
    font-family: inherit;
    color: inherit;
    background: #fff;
  }
  .m-detail-body .tableau-card figure { margin: 0; }
  .m-detail-body .tableau-card img {
    width: 100%;
    height: auto;
    display: block;
    background: #f7f7f7;
  }
  .m-detail-body .tableau-card figcaption {
    /* Stacked, not space-between: at 360px the title and the CTA cannot share a row
       without the CTA wrapping mid-phrase. */
    display: block;
    padding: 9px 11px;
    border-top: 1px solid #e0e0e0;
    text-align: left;
    font-size: 14px;
  }
  .m-detail-body .tableau-title { display: block; color: #1a1a1a; }
  .m-detail-body .tableau-cta   { display: block; margin-top: 3px; color: #00614f; font-size: 13px; }

  .m-detail-body .file-download {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    margin: 12px 0;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    text-decoration: none;
    font-family: inherit;
    color: #1a1a1a;
    background: #fafafa;
  }
  .m-detail-body .file-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .m-detail-body .file-meta {
    flex-shrink: 0;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: #00614f;
    border: 1px solid #cfe3de;
    border-radius: 3px;
    padding: 2px 5px;
  }
  /* Bold → NicoBold black; links → NicoBold teal with teal underline + hover highlight
     (matches the standalone reading pages). */
  .m-detail-body strong,
  .m-detail-body b {
    font-family: 'NicoBold', 'NicoClean', monospace;
    font-weight: normal;
    color: #000;
  }
  .m-detail-body a {
    font-family: 'NicoBold', 'NicoClean', monospace;
    font-weight: normal;
    color: #008575;
    text-decoration: underline;
    text-decoration-color: #008575;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    padding: 4px 3px 1px;
    margin: 0 -3px;
    border-radius: 4px;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    transition: background 150ms ease, color 150ms ease;
  }
  .m-detail-body a:hover { background: #008575; color: #fff; text-decoration: none; }
  .m-detail-body a strong,
  .m-detail-body a b { color: inherit; }
  /* Headings are almost always authored fully bold in Sanity — don't let the bold
     rule's font-family/color override the heading's. */
  .m-detail-body h1 strong, .m-detail-body h1 b,
  .m-detail-body h2 strong, .m-detail-body h2 b,
  .m-detail-body h3 strong, .m-detail-body h3 b,
  .m-detail-body h4 strong, .m-detail-body h4 b,
  .m-detail-body h5 strong, .m-detail-body h5 b,
  .m-detail-body h6 strong, .m-detail-body h6 b {
    font-family: inherit;
    color: inherit;
  }
  /* Link out to the wider standalone reading page — top-right, on the back row,
     width fits its text. Shown/hidden + href set by mOpenDetail(). */
  #m-detail-readlink {
    display: none;            /* mOpenDetail toggles to inline-block */
    position: absolute;
    top: 10px;
    right: 14px;
    z-index: 1;
    width: max-content;
    font-size: 11px;
    color: #008575;
    text-decoration: none;
    border: 1px solid #008575;
    border-radius: 6px;
    padding: 6px 10px 3px;
  }
  #m-detail-readlink:active { background: #008575; color: #fff; }
  .m-placeholder { width: 100%; height: 70px; background: repeating-linear-gradient(45deg,#e8e8e8 0,#e8e8e8 6px,#f0f0f0 6px,#f0f0f0 12px); border: 1.5px solid #e0e0e0; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #bbb; }

  /* ── Page menu overlay ── */
  #m-menu {
    position: absolute;
    inset: 0;
    background: rgba(40,43,58,0.96);
    z-index: 25;
    display: flex; flex-direction: column;
    padding: 20px 18px;
    gap: 6px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
  }
  #m-menu.open { opacity: 1; pointer-events: all; }
  .m-menu-item { padding: 13px 14px; border: 1.5px solid rgba(255,255,255,0.15); color: #989898; font-size: 17px; cursor: pointer; transition: background 0.1s, color 0.1s; }
  .m-menu-item:hover, .m-menu-item.active { background: rgba(0,133,117,0.2); color: #fff; border-color: #008575; }
  #m-menu-close { position: absolute; top: 14px; right: 18px; color: #989898; font-size: 20px; cursor: pointer; }
  #m-menu-close:hover { color: #fff; }

  /* ── About Me (mobile) ── */
  .m-about {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 14px 24px 30px 4px;
  }
  /* Hero */
  .m-about-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .m-about-avatar {
    width: 63%;
    max-width: 164px;
    height: auto;
    align-self: center;
    margin-bottom: 14px;
    background: transparent;
  }
  .m-about-name {
    font-size: 32px;
    line-height: 1;
    color: #1a1a1a;
    letter-spacing: -0.01em;
    text-align: center;
  }
  .m-about-job-title {
    font-size: 12px;
    color: #008575;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-top: 6px;
    text-align: center;
  }
  .m-about-divider {
    width: 32px;
    height: 2px;
    background: #008575;
    margin-top: 10px;
  }
  .page-heading {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: fit-content;
    max-width: 100%;
  }
  .page-heading .m-about-divider {
    width: auto;
    align-self: stretch;
  }
  .m-about-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8e8e8;
    color: #555;
    font-size: 12px;
    line-height: 1.3;
    letter-spacing: 0.05em;
    /* NicoClean glyph offset compensation */
    padding: 10px 12px 6px;
    border-radius: 999px;
    text-align: center;
    margin-top: -6px;
    margin-bottom: -6px;
  }
  /* Intro paragraphs */
  .m-about-intro-text {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  .m-about-intro-para {
    font-size: 13px;
    line-height: 1.6;
    color: #555;
    margin: 0;
  }
  /* Social row */
  .m-about-social-row {
    display: flex;
    gap: 8px;
  }
  .m-about-social-btn {
    flex: 1;
    aspect-ratio: 1 / 1;
    min-height: 50px;
    border: 1.5px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #777;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    cursor: pointer;
  }
  .m-about-social-btn svg { width: 40px; height: 40px; } /* 50px button − 5px each side */
  .m-about-social-btn:hover, .m-about-social-btn:active {
    border-color: #008575;
    color: #008575;
    background: rgba(0,133,117,0.04);
  }
  /* Section headers (title above teal underline) */
  .m-about-section-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
  }
  /* Extra spacing between "screens" — equivalent of 2 line breaks */
  .m-about-social-row + .m-about-section-header,
  .m-about-skills-list + .m-about-section-header,
  .m-about-certs-grid + .m-about-section-header {
    margin-top: 36px;
  }
  .m-about-section-title {
    font-size: 12px;
    color: #989898;
    text-transform: uppercase;
    letter-spacing: 0.12em;
  }
  .m-about-section-line {
    width: 28px;
    height: 2px;
    background: #008575;
  }
  /* Donut */
  .m-about-donut-wrap {
    display: flex;
    justify-content: center;
    padding: 6px 0;
  }
  .m-about-donut {
    width: 100%;
    max-width: 320px;
    height: auto;
    overflow: visible;
  }
  .m-about-donut-slice { cursor: help; }
  .m-about-donut-label {
    font-family: 'NicoClean', monospace;
    font-size: 12px;
    fill: #1a1a1a;
    pointer-events: none;
  }
  .m-about-donut-label-yrs {
    font-size: 12px;
    fill: #989898;
  }
  /* Skills list */
  .m-about-skills-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .m-about-skill-row {
    display: flex;
    align-items: center;
    /* 10px between axis label → circles AND between circles → year label */
    gap: 10px;
  }
  .m-about-skill-name {
    color: #1a1a1a;
    width: 88px;
    flex-shrink: 0;
    /* Block-level flex container — inner <span> holds the text so it can be
       reliably centred (and supports text-overflow if it ever needs to clip) */
    display: flex;
    align-items: center;
    height: 14px;
  }
  .m-about-skill-name > span {
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    /* NicoClean's painted glyph sits in the upper half of its line-box —
       nudge down so the visible centre aligns with the pip centre. */
    transform: translateY(2px);
  }
  .m-about-skill-bars {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    flex-shrink: 1;
  }
  .m-about-skill-pip {
    width: 14px;
    height: 14px;
    display: inline-block;
    flex-shrink: 0;
    background: #008575;
    border-radius: 50%;
  }
  .m-about-skill-level {
    color: #555;
    /* Right-side gap is provided by the row's 10px gap above */
    margin-left: 0;
    display: flex;
    align-items: center;
    height: 14px;
  }
  .m-about-skill-level > span {
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    /* Same NicoClean metrics compensation */
    transform: translateY(2px);
  }
  /* Certifications grid (2 across).
     Deliberately not the .m-about-social-row pattern — that gives each child
     flex:1, sized for four small icons, and would squeeze badge art. */
  .m-about-certs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .m-about-cert {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 11px;
    border: 1.5px solid #e0e0e0;
    text-decoration: none;
  }
  .m-about-cert:hover, .m-about-cert:active {
    border-color: #008575;
    background: rgba(0,133,117,0.04);
  }
  .m-about-cert img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1; /* badges are square — reserve the box before decode */
    display: block;
    object-fit: contain;
  }
  /* Two-line label block: the card's own gap:10px sits above it, so the caption
     and the "Since" line get their own tighter gap here. */
  .m-about-cert-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }
  /* #1a1a1a (the primary text near-black), not the #989898 used for meta labels
     elsewhere — the name leads the card and the lighter "Since" line sits under it. */
  .m-about-cert-caption {
    font-size: 12px;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    line-height: 1;
    text-align: center;
  }
  /* Mixed case + smaller, so it reads as secondary to the uppercase caption
     without dropping to an unreadable grey. */
  .m-about-cert-since {
    font-size: 11px;
    color: #989898;
    letter-spacing: 0.06em;
    line-height: 1;
    text-align: center;
  }
  /* Same NicoClean metrics compensation */
  .m-about-cert-caption > span,
  .m-about-cert-since > span { display: inline-block; transform: translateY(2px); }

  /* Works list (single column) */
  .m-about-works-list {
    display: flex;
    flex-direction: column;
    gap: 22px;
  }
  .m-about-works-list .m-about-work {
    border: 1.5px solid #e0e0e0;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s;
  }
  .m-about-works-list .m-about-work:hover,
  .m-about-works-list .m-about-work.focused {
    border-color: #008575;
    border-width: 3px;
  }
  .m-about-work-thumb {
    width: 100%;
    height: 154px;
    background: repeating-linear-gradient(45deg,#e8e8e8 0,#e8e8e8 8px,#f0f0f0 8px,#f0f0f0 16px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #aaa;
    border-bottom: 1.5px solid #e0e0e0;
  }
  .m-about-work-info {
    padding: 20px 12px 8px; /* top 20px = gap between image and title */
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .m-about-work-title {
    font-size: 13px;
    color: #1a1a1a;
    line-height: 1.3;
  }
  .m-about-work-date {
    font-size: 12px;
    color: #989898;
  }
  .m-about-work-desc {
    font-size: 12px;
    color: #555;
    line-height: 1.45;
    margin-top: 20px;
  }
  .m-about-work-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 20px;
  }

  /* Navigation hint banner */
  .m-about-nav-hint {
    margin-top: 32px;
    padding: 14px 16px;
    background: #008575;
    color: #fff;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    border-radius: 4px;
  }

  /* ── D-pad (anchored inside .frame-bottom) ── */
  #dpad {
    position: absolute;
    left: 25px; top: 43px;
    width: 160px; height: 160px;
    z-index: 11;
  }
  #dpad-up, #dpad-down, #dpad-left, #dpad-right {
    position: absolute;
    width: 54px; height: 54px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    z-index: 7;
  }
  #dpad-up    { left: 53px; top: 18px; }
  #dpad-down  { left: 53px; top: 88px; }
  #dpad-left  { left: 18px;  top: 53px; }
  #dpad-right { left: 88px; top: 53px; }

  /* ── Action buttons (anchored inside .frame-bottom) ── */
  #action-buttons {
    position: absolute;
    left: 232px; top: 72px;
    width: 165px; height: 136px;
    z-index: 11;
  }
  #btn-cancel, #btn-confirm {
    position: absolute;
    width: 70px; height: 70px;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    display: block;
  }
  #btn-cancel  { left: 24px; top: 42px; }
  #btn-confirm { left: 92px; top: 4px; }

  /* ── Home / Contact buttons ── */
  /* Home / Contact SVG buttons */
  #home-btn-wrap, #contact-btn-wrap {
    position: absolute;
    width: 70px; height: 32px;
    z-index: 11;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    display: block;
  }
  #home-btn-wrap    { left: 140px; top: 205px; }
  #contact-btn-wrap { left: 215px; top: 199px; }

  /* ── Trainings form ── */
  #m-page-trainings { display: flex; flex-direction: column; overflow: hidden; }
  #m-page-trainings .m-page-inner { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
  .m-trainings-intro { font-size: 12px; color: #555; line-height: 1.45; margin: 0 4px 20px 4px; }
  .m-contact-form { display: flex; flex-direction: column; gap: 12px; padding: 0 4px; flex: 1; min-height: 0; }
  .m-contact-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .m-contact-row .m-contact-field { min-width: 0; }
  .m-contact-row input { width: 100%; box-sizing: border-box; min-width: 0; }
  .contact-hp { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }
  .m-contact-field { display: flex; flex-direction: column; gap: 2px; position: relative; }
  .m-contact-field:has(textarea) { flex: 1; min-height: 0; }
  .m-contact-field > span { font-size: 11px; color: #989898; letter-spacing: 0.08em; text-transform: uppercase; }
  .m-contact-field input,
  .m-contact-field textarea {
    font-family: 'NicoClean', monospace; font-size: 13px; color: #1a1a1a;
    padding: 6px 10px; border: 1.5px solid #e0e0e0; background: #fff;
    outline: none; transition: border-color 0.15s; -webkit-appearance: none;
  }
  .m-contact-field textarea { resize: none; line-height: 1.5; flex: 1; min-height: 0; }
  .m-contact-field input:focus,
  .m-contact-field textarea:focus { border-color: #008575; }
  .m-contact-foot { display: flex; flex-direction: column; gap: 6px; align-items: stretch; margin-top: 4px; }
  .m-contact-status { font-size: 11px; color: #c44; min-height: 12px; }
  .m-contact-status.ok { color: #008575; }
  .m-contact-submit {
    font-family: 'NicoClean', monospace; font-size: 13px; letter-spacing: 0.08em;
    padding: 9px; background: #008575; color: #fff; border: 0; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .m-contact-submit:active { background: #006b5d; }
  .m-contact-submit:disabled { background: #aaa; }

  /* Toast — confirmation that auto-dismisses after 2s */
  .m-contact-toast {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    background: #008575; color: #fff;
    font-family: 'NicoClean', monospace; font-size: 13px; letter-spacing: 0.06em;
    padding: 12px 20px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    z-index: 100;
    opacity: 0;
    transition: opacity 250ms ease, transform 250ms ease;
    pointer-events: none;
    white-space: nowrap;
  }
  .m-contact-toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
