/* Mobile UI V3 — professional game screens on phones (docs/clashrz/ux/MOBILE_UI_V3.md).
   Loaded after mobile-v2.css. Every rule sits in the phone query (<= 720 px): tablet and desktop are unchanged.
   Shared look: raised square tiles, colour per action, bold Arabic labels (Noto Kufi Arabic), 44 px+ targets. */

@media (max-width: 720px) {
  body.cor-shell,
  body.manual {
    --crz-v3-label: 800 14px/1.25 "Noto Kufi Arabic", "Source Sans 3", sans-serif;
    --crz-v3-card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
    --crz-v3-card-border: 1px solid rgba(240, 208, 128, 0.22);
    --crz-v3-raise: 0 3px 0 rgba(0, 0, 0, 0.45), 0 6px 14px rgba(0, 0, 0, 0.3);
  }

  /* V2 fix: an empty legacy error holder is not an error (it drew an empty red bar on the marketplace). */
  body.cor-shell #corInnerPanel div.errorMessage:empty,
  body.cor-shell #corInnerPanel div.error:empty,
  body.cor-shell #corInnerPanel p.error:empty { display: none !important; }

  /* ── Reports and messages: square tab tiles, one card per report / message, the page scrolls as a whole ── */
  body.cor-shell #content:has(.cor-reports-table-wrap),
  body.cor-shell #content:has(.cor-messages-table-wrap),
  body.cor-shell #content:has(.cor-reports-table-wrap) > form,
  body.cor-shell #content:has(.cor-messages-table-wrap) > form,
  body.cor-shell #content .cor-reports-frame,
  body.cor-shell #content .cor-messages-frame,
  body.cor-shell #content .cor-reports-table-wrap,
  body.cor-shell #content .cor-messages-table-wrap {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  body.cor-shell #corInnerPanel #content nav.cor-reports-tabs,
  body.cor-shell #corInnerPanel #content .cor-reports-tabs.contentNavi,
  body.cor-shell #corInnerPanel #content .cor-messages-tabs {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px !important;
  }
  body.cor-shell #content .cor-reports-tabs .tabItem,
  body.cor-shell #content .cor-messages-tabs .tabItem {
    flex-direction: column !important;
    gap: 4px !important;
    min-height: 58px !important;
    padding: 6px 2px !important;
    border-radius: 12px !important;
    background: var(--crz-v3-card-bg) !important;
    border: var(--crz-v3-card-border) !important;
    box-shadow: var(--crz-v3-raise) !important;
  }
  body.cor-shell #content .cor-reports-tabs .container.active .tabItem,
  body.cor-shell #content .cor-messages-tabs .container.active .tabItem,
  body.cor-shell #content .cor-reports-tab--active,
  body.cor-shell #content .cor-messages-tab--active {
    background: linear-gradient(180deg, color-mix(in srgb, var(--crz-screen-act, #5272c8) 85%, #fff 15%), var(--crz-screen-act, #5272c8)) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
  }
  body.cor-shell #content .cor-reports-tabs .container.active .cor-reports-tab__label,
  body.cor-shell #content .cor-messages-tabs .container.active .cor-messages-tab__label { color: #fff !important; }
  body.cor-shell #content .cor-reports-tab__label,
  body.cor-shell #content .cor-messages-tab__label {
    white-space: normal !important;
    text-align: center;
    font: 800 12.5px/1.2 "Noto Kufi Arabic", "Source Sans 3", sans-serif !important;
  }
  body.cor-shell #content .cor-reports-tab__icon,
  body.cor-shell #content .cor-messages-tab__icon { transform: scale(1.35); }

  /* the list header keeps only the sort control (date); the other column titles are in each card */
  body.cor-shell #content .cor-reports-table,
  body.cor-shell #content .cor-messages-table { display: block !important; width: 100% !important; }
  body.cor-shell #content .cor-reports-table thead,
  body.cor-shell #content .cor-messages-table thead,
  body.cor-shell #content .cor-reports-table thead tr,
  body.cor-shell #content .cor-messages-table thead tr { display: flex !important; justify-content: flex-end; }
  body.cor-shell #content .cor-reports-table thead th:not(.dat),
  body.cor-shell #content .cor-messages-table thead th:not(.dat) { display: none !important; }
  body.cor-shell #content .cor-reports-table thead th.dat,
  body.cor-shell #content .cor-messages-table thead th.dat { display: block !important; padding: 4px 0 8px !important; border: 0 !important; background: none !important; }
  body.cor-shell #content .cor-reports-table thead th.dat a.sorting,
  body.cor-shell #content .cor-messages-table thead th.dat a.sorting {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    border: var(--crz-v3-card-border);
    background: var(--crz-v3-card-bg);
    color: #fff4cf !important;
    font: var(--crz-v3-label) !important;
  }
  body.cor-shell #content .cor-reports-table thead th.dat a.sorting::before,
  body.cor-shell #content .cor-messages-table thead th.dat a.sorting::before { content: "⏱"; font-size: 15px; }

  body.cor-shell #content .cor-reports-table tbody,
  body.cor-shell #content .cor-messages-table tbody { display: grid !important; gap: 8px; }
  body.cor-shell #content .cor-reports-row,
  body.cor-shell #content .cor-messages-row {
    display: grid !important;
    grid-template-columns: 34px minmax(0, 1fr) 48px;
    grid-template-areas: "sel sub act" "sel meta act" "sel dat act";
    align-items: center;
    column-gap: 8px;
    padding: 10px 8px;
    border-radius: 14px;
    border: var(--crz-v3-card-border);
    background: var(--crz-v3-card-bg) !important;
    box-shadow: var(--crz-v3-raise);
  }
  body.cor-shell #content .cor-reports-row.unread,
  body.cor-shell #content .cor-messages-row.unread {
    border-color: color-mix(in srgb, var(--crz-screen-act, #5272c8) 80%, #fff 20%);
    background: linear-gradient(180deg, color-mix(in srgb, var(--crz-screen-act, #5272c8) 26%, transparent), rgba(255, 255, 255, 0.03)) !important;
  }
  body.cor-shell #content .cor-reports-row > td,
  body.cor-shell #content .cor-messages-row > td {
    display: block !important;
    width: auto !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    font-size: 14px !important;
  }
  body.cor-shell #content .cor-reports-row > td.sel,
  body.cor-shell #content .cor-messages-row > td.sel { grid-area: sel; align-self: center; }
  body.cor-shell #content .cor-reports-row > td.sub,
  body.cor-shell #content .cor-messages-row > td.subject { grid-area: sub; display: flex !important; align-items: center; gap: 6px; text-align: start !important; }
  body.cor-shell #content .cor-reports-row > td,
  body.cor-shell #content .cor-messages-row > td { text-align: start !important; }
  body.cor-shell #content .cor-reports-subject,
  body.cor-shell #content .cor-messages-subject {
    flex: 1 1 auto;
    min-width: 0;
    width: auto !important;
    max-width: none !important;
    padding: 0 !important;
    text-align: start !important;
  }
  body.cor-shell #content .cor-reports-row > td.cor-reports-type,
  body.cor-shell #content .cor-messages-row > td.send { grid-area: meta; display: flex !important; align-items: center; gap: 6px; margin-top: 4px; }
  body.cor-shell #content .cor-reports-row > td.dat,
  body.cor-shell #content .cor-messages-row > td.dat { grid-area: dat; margin-top: 2px; color: #aab4c3 !important; font-size: 13px !important; }
  body.cor-shell #content .cor-reports-row > td.cor-reports-action,
  body.cor-shell #content .cor-messages-row > td.cor-messages-action { grid-area: act; }
  body.cor-shell #content .cor-reports-subject a,
  body.cor-shell #content .cor-messages-subject a {
    font: 800 15px/1.4 "Noto Kufi Arabic", "Source Sans 3", sans-serif !important;
    color: #fff4cf !important;
    unicode-bidi: plaintext;
    overflow-wrap: anywhere;
  }
  body.cor-shell #content .cor-reports-type__label {
    display: inline !important;
    font: 700 13px/1.35 "Noto Sans Arabic", "Source Sans 3", sans-serif !important;
    color: #c9d1dc !important;
    position: static !important;
    width: auto !important;
    height: auto !important;
    clip: auto !important;
    overflow: visible !important;
  }
  body.cor-shell #content .cor-messages-row > td.send a { font-weight: 700; color: #9fd3ff !important; }
  body.cor-shell #content .cor-reports-action-btn,
  body.cor-shell #content .cor-messages-action-btn {
    display: grid !important;
    place-items: center;
    width: 44px !important;
    height: 44px !important;
    border-radius: 12px !important;
    background: var(--crz-screen-act, #5272c8) !important;
    color: #fff !important;
  }
  body.cor-shell #content .cor-reports-action-btn svg,
  body.cor-shell #content .cor-messages-action-btn svg { width: 20px; height: 20px; }
  body.cor-shell.rtl #content .cor-reports-action-btn svg,
  body.cor-shell.rtl #content .cor-messages-action-btn svg { transform: scaleX(-1); }
  body.cor-shell #content .cor-reports-row input.check,
  body.cor-shell #content .cor-messages-row input.check { width: 24px !important; height: 24px !important; }

  /* the actions (select all, mark read, delete) stay at hand at the bottom while the list scrolls */
  body.cor-shell #content .cor-reports-footer,
  body.cor-shell #content .cor-messages-footer {
    position: sticky !important;
    bottom: 0;
    z-index: 3;
    margin-top: 10px !important;
    padding: 10px 0 6px !important;
    background: linear-gradient(180deg, rgba(15, 18, 24, 0.85), #0f1218 30%) !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px;
  }
  body.cor-shell #content .cor-reports-footer__left,
  body.cor-shell #content .cor-messages-footer__left { flex: 0 0 auto; display: flex !important; align-items: center; }
  body.cor-shell #content .cor-reports-footer__actions,
  body.cor-shell #content .cor-messages-footer__actions {
    flex: 1 1 auto;
    display: flex !important;
    flex-direction: row !important;
    gap: 8px;
    min-width: 0;
  }
  body.cor-shell #content .cor-reports-footer__left label,
  body.cor-shell #content .cor-messages-footer__left label,
  body.cor-shell #content .cor-reports-footer__count,
  body.cor-shell #content .cor-messages-footer__count { display: none !important; }
  body.cor-shell #content .cor-reports-footer__left input.check,
  body.cor-shell #content .cor-messages-footer__left input.check { flex: 0 0 26px; width: 26px !important; height: 26px !important; margin: 0 6px !important; }
  body.cor-shell #content .cor-reports-footer .cor-btn,
  body.cor-shell #content .cor-messages-footer .cor-btn {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 46px !important;
    margin: 0 !important;
    padding: 0 6px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body.cor-shell #content .cor-reports-table thead th.dat a.sorting,
  body.cor-shell #content .cor-messages-table thead th.dat a.sorting { white-space: nowrap; }
}

@media (max-width: 720px) {
  /* the page numbers get their own centred row above the actions */
  body.cor-shell #content .cor-reports-pager,
  body.cor-shell #content .cor-messages-pager,
  body.cor-shell #content:has(.cor-messages-table-wrap) .paginator {
    position: static !important;
    float: none !important;
    display: flex !important;
    justify-content: center;
    width: 100% !important;
    margin: 10px 0 0 !important;
  }
  body.cor-shell #content .cor-reports-footer .cor-btn,
  body.cor-shell #content .cor-messages-footer .cor-btn { font-size: 13px !important; gap: 5px; }
  body.cor-shell #content .cor-reports-footer .cor-btn svg,
  body.cor-shell #content .cor-messages-footer .cor-btn svg { flex: 0 0 16px; width: 16px; height: 16px; }
}

/* ── Hero: status and attribute rows as labelled bars with big − / + ; the attribute points are open; a
   3-column inventory; adventures and auctions as cards. ── */
@media (max-width: 720px) {
  body.cor-shell.cor-screen-hero #content table.attributes,
  body.cor-shell.cor-screen-hero #content table.attributes tbody { display: block !important; width: 100% !important; height: auto !important; }
  body.cor-shell.cor-screen-hero #content table.attributes thead { display: block !important; }
  body.cor-shell.cor-screen-hero #content table.attributes thead th.headline {
    display: block !important;
    padding: 4px 0 8px !important;
    font: 800 17px/1.3 "Noto Kufi Arabic", "Source Sans 3", sans-serif !important;
    color: #fff4cf !important;
  }
  body.cor-shell.cor-screen-hero #content table.attributes thead th:not(.headline) { display: none !important; }
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name value" "bar bar" "set set";
    gap: 6px 10px;
    margin: 0 0 10px;
    padding: 10px 12px;
    border-radius: 14px;
    border: var(--crz-v3-card-border);
    background: var(--crz-v3-card-bg);
  }
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute > td {
    display: block !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
  }
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute > td.attribName {
    grid-area: name;
    font: var(--crz-v3-label) !important;
    font-size: 15px !important;
    color: #fff4cf !important;
    text-align: start !important;
  }
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute > td.powervalue {
    grid-area: value;
    font: 800 17px/1.2 "Source Sans 3", sans-serif !important;
    color: #fff !important;
    direction: ltr;
    unicode-bidi: isolate;
  }
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute > td.powervalue .value { font: inherit !important; color: inherit !important; }
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute > td.progress { grid-area: bar; }
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute .bar-bg {
    position: relative;
    height: 12px !important;
    width: 100% !important;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1) !important;
  }
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute .bar-bg .bar {
    position: absolute;
    top: 0;
    bottom: 0;
    inset-inline-start: 0;
    height: 12px !important;
    border-radius: 999px;
    background: linear-gradient(90deg, #d9a21b, #f0d080) !important;
  }
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute .bar-bg .bar.setted { background: #2f9e55 !important; opacity: 0.85; }
  body.cor-shell.cor-screen-hero #content table.attributes tr.health .bar-bg .bar { background: linear-gradient(90deg, #2f9e55, #7fdc9a) !important; }
  /* − points + : one row; rows without points (health, experience) hide it */
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute:has(a.setPoint) {
    grid-template-areas: "name value" "bar bar" "set set";
  }
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute > td.pointsValueSetter,
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute > td.points { grid-row: 3; }
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute:has(a.setPoint) {
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    grid-template-areas: "name name value" "bar bar bar" ". . .";
  }
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute:has(a.setPoint) > td.pointsValueSetter.sub { grid-column: 1; }
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute:has(a.setPoint) > td.points {
    grid-column: 2;
    align-self: center;
    text-align: center !important;
    font: 800 18px/1 "Source Sans 3", sans-serif !important;
    color: #fff4cf !important;
  }
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute:has(a.setPoint) > td.pointsValueSetter.add { grid-column: 3; }
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute:not(:has(a.setPoint)) > td.pointsValueSetter,
  body.cor-shell.cor-screen-hero #content table.attributes tr.attribute:not(:has(a.setPoint)) > td.points { display: none !important; }
  body.cor-shell.cor-screen-hero #content table.attributes a.setPoint {
    display: grid !important;
    place-items: center;
    width: 48px !important;
    height: 44px !important;
    border-radius: 12px;
    border: 1px solid rgba(240, 208, 128, 0.45);
    background: #222936 !important;
    color: #fff4cf !important;
    font: 800 24px/1 Arial, sans-serif;
    text-decoration: none !important;
  }
  body.cor-shell.cor-screen-hero #content td.add a.setPoint::after,
  body.cor-shell.cor-screen-hero #content td.sub a.setPoint::after { font: 800 26px/1 Arial, sans-serif; color: #fff4cf; }
  body.cor-shell.cor-screen-hero #content td.add a.setPoint::after { content: "+"; }
  body.cor-shell.cor-screen-hero #content td.sub a.setPoint::after { content: "−"; }
  body.cor-shell.cor-screen-hero #content table.attributes tr:not(.attribute) td {
    display: block !important;
    padding: 4px 2px !important;
    font-size: 14px !important;
  }
  body.cor-shell.cor-screen-hero #content table.attributes tr:not(.attribute) { display: block !important; }
  body.cor-shell.cor-screen-hero #content table.attributes .production .value,
  body.cor-shell.cor-screen-hero #content table.attributes .production .current,
  body.cor-shell.cor-screen-hero #content table.attributes .speed { font-size: 14px !important; }

  /* attribute points, resource choice and hide/fight are part of the hero: open, not behind a closed bar */
  body.cor-shell.cor-screen-hero #content .heroPropertiesContent.hide { display: block !important; }
  body.cor-shell.cor-screen-hero #content #attributes .openCloseSwitchBar img.openedClosedSwitch { display: none !important; }
  body.cor-shell.cor-screen-hero #content #attributes .openCloseSwitchBar .title {
    font: 800 17px/1.3 "Noto Kufi Arabic", "Source Sans 3", sans-serif !important;
    color: #fff4cf !important;
  }
  body.cor-shell.cor-screen-hero #content .changeResourcesHeadline {
    font: var(--crz-v3-label) !important;
    color: #fff4cf !important;
    margin: 8px 0 !important;
  }
  body.cor-shell.cor-screen-hero #content .resourcePick { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  body.cor-shell.cor-screen-hero #content .resourcePick .resource { float: none !important; width: auto !important; margin: 0 !important; }
  body.cor-shell.cor-screen-hero #content .resourcePick label {
    display: flex !important;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 4px 8px;
    border-radius: 12px;
    border: var(--crz-v3-card-border);
    background: var(--crz-v3-card-bg);
    font-size: 14px !important;
  }
  body.cor-shell.cor-screen-hero #content .resourcePick label:has(input:checked) { border-color: #2f9e55; background: rgba(47, 158, 85, 0.22); }
  body.cor-shell.cor-screen-hero #content .resourcePick .current { font-size: 13px !important; }
  body.cor-shell.cor-screen-hero #content .attackBehaviour .options label { font-size: 14px !important; line-height: 1.5; }
  body.cor-shell.cor-screen-hero #content .attackBehaviour .options input.radio { width: 22px; height: 22px; vertical-align: middle; }
  body.cor-shell.cor-screen-hero #content button#saveHeroAttributes,
  body.cor-shell.cor-screen-hero #content .heroPropertiesContent button { min-height: 50px !important; width: 100% !important; }

  /* inventory: 3 square slots per row, the bag fits the card; buy / sell buttons are full size */
  body.cor-shell.cor-screen-hero #content #hero_inventory { width: 100% !important; float: none !important; }
  body.cor-shell.cor-screen-hero #content #itemsToSale {
    display: grid !important;
    grid-template-columns: repeat(3, 81px);
    justify-content: center;
    gap: 8px;
    width: 100% !important;
    height: auto !important;
  }
  body.cor-shell.cor-screen-hero #content #itemsToSale > .inventory {
    position: relative !important;
    float: none !important;
    margin: 0 !important;
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px rgba(240, 208, 128, 0.25);
  }
  body.cor-shell.cor-screen-hero #content #itemsToSale > .market,
  body.cor-shell.cor-screen-hero #content #itemsToSale > .clear { grid-column: 1 / -1; }
  body.cor-shell.cor-screen-hero #content #itemsToSale > .market {
    display: flex !important;
    gap: 8px;
    width: 100% !important;
  }
  body.cor-shell.cor-screen-hero #content #itemsToSale > .market button,
  body.cor-shell.cor-screen-hero #content #itemsToSale > .market a {
    flex: 1 1 0;
    min-height: 46px !important;
    font-size: 14px !important;
  }

  /* adventures: one card per adventure with a big "go" button */
  body.cor-shell.cor-screen-hero #content table:has(td.goTo) { display: block !important; width: 100% !important; }
  body.cor-shell.cor-screen-hero #content table:has(td.goTo) thead { display: none !important; }
  body.cor-shell.cor-screen-hero #content table:has(td.goTo) tbody { display: grid !important; gap: 8px; }
  body.cor-shell.cor-screen-hero #content table:has(td.goTo) tr {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "loc loc diff" "coords move left" "go go go";
    gap: 6px 10px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 14px;
    border: var(--crz-v3-card-border);
    background: var(--crz-v3-card-bg);
  }
  body.cor-shell.cor-screen-hero #content table:has(td.goTo) td { display: block !important; padding: 0 !important; border: 0 !important; background: none !important; font-size: 14px !important; }
  body.cor-shell.cor-screen-hero #content table:has(td.goTo) td.location { grid-area: loc; font: var(--crz-v3-label) !important; font-size: 15px !important; color: #fff4cf !important; }
  body.cor-shell.cor-screen-hero #content table:has(td.goTo) td.coords { grid-area: coords; }
  body.cor-shell.cor-screen-hero #content table:has(td.goTo) td.difficulty { grid-area: diff; }
  body.cor-shell.cor-screen-hero #content table:has(td.goTo) td.moveTime { grid-area: move; }
  body.cor-shell.cor-screen-hero #content table:has(td.goTo) td.moveTime::before { content: "🚶 "; }
  body.cor-shell.cor-screen-hero #content table:has(td.goTo) td.timeLeft { grid-area: left; }
  body.cor-shell.cor-screen-hero #content table:has(td.goTo) td.timeLeft::before { content: "⏳ "; }
  body.cor-shell.cor-screen-hero #content table:has(td.goTo) td.goTo { grid-area: go; }
  body.cor-shell.cor-screen-hero #content table:has(td.goTo) td.goTo a {
    float: none !important;
    width: 100% !important;
    box-sizing: border-box;
    padding: 0 12px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border-radius: 12px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--crz-act-hero, #c2459f) 80%, #fff 20%), var(--crz-act-hero, #c2459f)) !important;
    box-shadow: var(--crz-v3-raise);
    color: #fff !important;
    font: var(--crz-v3-label) !important;
    font-size: 16px !important;
    text-decoration: none !important;
  }
  body.cor-shell.cor-screen-hero #content table:has(td.goTo) td.goTo a::before { display: none !important; }

  body.cor-shell.cor-screen-hero #content table:has(td.goTo) td.goTo { width: auto !important; max-width: none !important; }

  /* inventory: buy / sell an item as two real buttons */
  body.cor-shell.cor-screen-hero #content #itemsToSale > .market a.buy,
  body.cor-shell.cor-screen-hero #content #itemsToSale > .market a.sell {
    display: flex !important;
    align-items: center;
    justify-content: center;
    float: none !important;
    height: auto !important;
    padding: 0 10px !important;
    border-radius: 12px;
    border: var(--crz-v3-card-border);
    background: var(--crz-v3-card-bg) !important;
    box-shadow: var(--crz-v3-raise);
    color: #fff4cf !important;
    font: var(--crz-v3-label) !important;
    text-decoration: none !important;
  }
  body.cor-shell.cor-screen-hero #content #itemsToSale > .market a::before { display: none !important; }
}

/* Icon filters (hero auctions by item type, marketplace offers by resource): finger-sized tiles. */
@media (max-width: 720px) {
  body.cor-shell #corInnerPanel button.iconFilter {
    display: inline-grid !important;
    place-items: center;
    width: 44px !important;
    height: 44px !important;
    margin: 3px !important;
    border-radius: 10px !important;
    border: var(--crz-v3-card-border) !important;
    background-color: rgba(255, 255, 255, 0.06) !important;
  }
  body.cor-shell #corInnerPanel button.iconFilter > * { transform: scale(1.35); }
  body.cor-shell #corInnerPanel button.iconFilter.iconFilterActive {
    border-color: #f0d080 !important;
    background-color: rgba(240, 208, 128, 0.22) !important;
  }
}

/* ── Army: academy research and smithy upgrades use the troop-card pattern of the training screens ── */
@media (max-width: 720px) {
  body.cor-shell #corInnerPanel .researches .research {
    display: flow-root !important;
    width: auto !important;
    margin: 0 0 12px !important;
    padding: 10px !important;
    border: 1px solid rgba(201, 54, 58, 0.45) !important;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04) !important;
  }
  body.cor-shell #corInnerPanel .researches .bigUnitSection {
    float: inline-start !important;
    width: 84px !important;
    height: auto !important;
    margin: 0 !important;
    margin-inline-end: 10px !important;
  }
  body.cor-shell #corInnerPanel .researches .bigUnitSection img.unitSection {
    display: block;
    width: 84px !important;
    height: 84px !important;
    border-radius: 10px;
    background-size: cover !important;
    background-position: center !important;
  }
  body.cor-shell #corInnerPanel .researches .bigUnitSection a.zoom { display: none !important; }
  body.cor-shell #corInnerPanel .researches .information {
    float: none !important;
    width: auto !important;
    margin: 0 !important;
    overflow: visible !important;
  }
  body.cor-shell #corInnerPanel .researches .information .title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
  body.cor-shell #corInnerPanel .researches .information .title a {
    font: 800 17px/1.3 "Noto Kufi Arabic", "Source Sans 3", sans-serif !important;
    color: #fff4cf !important;
  }
  body.cor-shell #corInnerPanel .researches .information .title .level {
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(201, 54, 58, 0.7);
    color: #fff !important;
    font: 800 13px/1.4 "Noto Kufi Arabic", "Source Sans 3", sans-serif !important;
  }
  body.cor-shell #corInnerPanel .researches .information > br { display: none; }
  body.cor-shell #corInnerPanel .researches .cta {
    clear: both;
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-top: 10px !important;
    float: none !important;
    position: static !important;
  }
  body.cor-shell #corInnerPanel .researches .cta .inlineIcon.duration { align-self: center; }
  body.cor-shell #corInnerPanel #corInnerPanelBody #content .researches .cta button.green:not(.disabled):not([disabled]) {
    --act: var(--crz-act-army, #c9363a);
    width: 100% !important;
    min-height: 52px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 12px !important;
    background: linear-gradient(180deg, color-mix(in srgb, var(--act) 80%, #fff 20%), var(--act)) !important;
    box-shadow: 0 3px 0 color-mix(in srgb, var(--act) 60%, #000 40%) !important;
  }
  body.cor-shell #corInnerPanel #corInnerPanelBody #content .researches .cta button.green .button-background { display: none !important; }
  body.cor-shell #corInnerPanel #corInnerPanelBody #content .researches .cta button.green .button-container {
    display: flex !important;
    align-items: center;
    justify-content: center;
    height: 52px !important;
  }
  body.cor-shell #corInnerPanel #corInnerPanelBody #content .researches .cta button.green .button-content {
    position: static !important;
    color: #fff !important;
    font: 800 17px/1.2 "Noto Kufi Arabic", "Source Sans 3", sans-serif !important;
  }
  /* a research that cannot start yet keeps its explanation readable */
  body.cor-shell #corInnerPanel .researches .cta .none,
  body.cor-shell #corInnerPanel .researches .contractLink { font-size: 14px !important; line-height: 1.5; }

  /* rally point: own troops at home — unit counts readable under their icons */
  body.cor-shell #corInnerPanel #corInnerPanelBody #content table.troop_details tbody.units td.unit {
    font: 800 13px/1.2 "Source Sans 3", sans-serif !important;
    color: #fff4cf;
  }
  body.cor-shell #corInnerPanel #corInnerPanelBody #content table.troop_details tbody.units td.unit.none { color: #6d7685 !important; font-weight: 600 !important; }
  body.cor-shell #corInnerPanel #corInnerPanelBody #content table.troop_details td.uniticon img.unit { transform: scale(1.15); }
}

/* ── Rally point: labelled filter tiles; the defence card above incoming attacks ── */
@media (max-width: 720px) {
  body.cor-shell #corInnerPanel #corInnerPanelBody #content .filterContainer:has(.crz-labelled) {
    display: grid !important;
    width: 100% !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  body.cor-shell #corInnerPanel #corInnerPanelBody #content button.iconFilter.crz-labelled {
    float: none !important;
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: auto !important;
    height: auto !important;
    min-height: 52px;
    margin: 0 !important;
    padding: 6px 10px !important;
    box-shadow: var(--crz-v3-raise);
  }
  body.cor-shell #corInnerPanel button.iconFilter.crz-labelled > img { transform: scale(1.35); }
  body.cor-shell #corInnerPanel button.iconFilter.crz-labelled > .crz-filter-label {
    transform: none;
    color: #fff4cf;
    font: 800 14px/1.2 "Noto Kufi Arabic", "Source Sans 3", sans-serif;
    text-align: start;
  }
  body.cor-shell #corInnerPanel #corInnerPanelBody #content button.iconFilter.crz-labelled.iconFilterActive {
    background: linear-gradient(180deg, color-mix(in srgb, var(--crz-act-army, #c9363a) 85%, #fff 15%), var(--crz-act-army, #c9363a)) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
  }
  body.cor-shell #corInnerPanel button.iconFilter.crz-labelled.iconFilterActive > .crz-filter-label { color: #fff; }

  body.cor-shell #corInnerPanel .crz-defense {
    margin: 0 0 12px;
    padding: 12px;
    border: 2px solid #e2484c;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(201, 54, 58, 0.22), rgba(255, 255, 255, 0.03));
  }
  body.cor-shell #corInnerPanel .crz-defense__title {
    margin: 0 0 10px !important;
    font: 800 17px/1.3 "Noto Kufi Arabic", "Source Sans 3", sans-serif !important;
    color: #fff !important;
  }
  body.cor-shell #corInnerPanel .crz-defense__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  body.cor-shell #corInnerPanel .crz-defense__btn {
    --act: var(--crz-act-army, #c9363a);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 4px 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: linear-gradient(180deg, color-mix(in srgb, var(--act) 80%, #fff 20%), var(--act));
    box-shadow: 0 3px 0 color-mix(in srgb, var(--act) 55%, #000 45%);
    color: #fff !important;
    font: 800 15px/1.25 "Noto Kufi Arabic", "Source Sans 3", sans-serif;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    text-align: center;
    text-decoration: none !important;
  }
  body.cor-shell #corInnerPanel #content a.crz-defense__btn { color: #fff !important; }
  body.cor-shell #corInnerPanel .crz-defense__btn[data-act="build"] { --act: var(--crz-act-build, #2f9e55); }
  body.cor-shell #corInnerPanel .crz-defense__btn[data-act="hero"] { --act: var(--crz-act-hero, #c2459f); }
}

/* ── Marketplace: resource rows as cards, the main trade actions full width in the market colour ── */
@media (max-width: 720px) {
  body.cor-shell #corInnerPanel table.send_res,
  body.cor-shell #corInnerPanel table.send_res tbody { display: block !important; width: 100% !important; }
  body.cor-shell #corInnerPanel table.send_res tr {
    display: grid !important;
    grid-template-columns: 32px minmax(0, 1fr) minmax(0, 1.3fr);
    grid-template-areas: "ico nam val" "ico max val";
    align-items: center;
    gap: 2px 8px;
    margin: 0 0 8px;
    padding: 8px 10px;
    border-radius: 14px;
    border: var(--crz-v3-card-border);
    background: var(--crz-v3-card-bg);
  }
  body.cor-shell #corInnerPanel table.send_res td { display: block !important; width: auto !important; padding: 0 !important; border: 0 !important; background: none !important; }
  body.cor-shell #corInnerPanel table.send_res td.ico { grid-area: ico; }
  body.cor-shell #corInnerPanel table.send_res td.ico i { transform: scale(1.4); display: inline-block; }
  body.cor-shell #corInnerPanel table.send_res td.nam { grid-area: nam; font: var(--crz-v3-label) !important; color: #fff4cf !important; }
  body.cor-shell #corInnerPanel table.send_res td.max { grid-area: max; font-size: 13px !important; color: #aab4c3; }
  body.cor-shell #corInnerPanel table.send_res td.max a { font-weight: 800; color: #ffbe73 !important; }
  body.cor-shell #corInnerPanel table.send_res td.val { grid-area: val; }
  body.cor-shell #corInnerPanel table.send_res td.val input.text {
    width: 100% !important;
    height: 48px !important;
    box-sizing: border-box;
    font: 800 17px/1 "Source Sans 3", sans-serif !important;
    text-align: center;
    border-radius: 10px !important;
  }
  body.cor-shell #corInnerPanel #corInnerPanelBody #content button.green.prepare,
  body.cor-shell #corInnerPanel #corInnerPanelBody #content .gid17 button.green:not(.disabled):not([disabled]):not(.iconFilter) {
    --act: var(--crz-act-market, #ea8a1a);
    width: 100% !important;
    min-height: 52px !important;
    margin: 8px 0 !important;
    padding: 0 !important;
    border-radius: 12px !important;
    background: linear-gradient(180deg, color-mix(in srgb, var(--act) 80%, #fff 20%), var(--act)) !important;
    box-shadow: 0 3px 0 color-mix(in srgb, var(--act) 55%, #000 45%) !important;
  }
  body.cor-shell #corInnerPanel #corInnerPanelBody #content button.green.prepare .button-background,
  body.cor-shell #corInnerPanel #corInnerPanelBody #content .gid17 button.green .button-background { display: none !important; }
  body.cor-shell #corInnerPanel #corInnerPanelBody #content button.green.prepare .button-container,
  body.cor-shell #corInnerPanel #corInnerPanelBody #content .gid17 button.green .button-container {
    display: flex !important;
    align-items: center;
    justify-content: center;
    height: 52px !important;
  }
  body.cor-shell #corInnerPanel #corInnerPanelBody #content button.green.prepare .button-content,
  body.cor-shell #corInnerPanel #corInnerPanelBody #content .gid17 button.green .button-content {
    position: static !important;
    color: #fff !important;
    font: 800 17px/1.2 "Noto Kufi Arabic", "Source Sans 3", sans-serif !important;
  }
  /* offers list: the column titles fit and the table never runs out of the card */
  body.cor-shell #corInnerPanel .gid17 table { table-layout: fixed; width: 100% !important; }
  body.cor-shell #corInnerPanel .gid17 table th { font-size: 12.5px !important; white-space: normal !important; line-height: 1.3; }
  body.cor-shell #corInnerPanel .gid17 table td { font-size: 14px !important; }
}

/* ── Alliance (not in one yet) and the player profile ── */
@media (max-width: 720px) {
  body.cor-shell #corInnerPanel #content.alliance.crz-empty {
    display: flex !important;
    flex-direction: column;
    gap: 14px;
    padding: 12px 4px !important;
    font: 700 16px/1.6 "Noto Sans Arabic", "Source Sans 3", sans-serif !important;
    color: #e6ebf2 !important;
    text-align: center;
  }
  body.cor-shell #corInnerPanel #content a.crz-cta { color: #fff !important; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45); }
  body.cor-shell #corInnerPanel a.crz-cta {
    --act: var(--crz-act-alliance, #8b55e0);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 4px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: linear-gradient(180deg, color-mix(in srgb, var(--act) 80%, #fff 20%), var(--act));
    box-shadow: 0 3px 0 color-mix(in srgb, var(--act) 55%, #000 45%), 0 6px 14px rgba(0, 0, 0, 0.3);
    color: #fff !important;
    font: 800 17px/1.25 "Noto Kufi Arabic", "Source Sans 3", sans-serif;
    text-decoration: none !important;
  }

  body.cor-shell #corInnerPanel table#details,
  body.cor-shell #corInnerPanel table#details tbody {
    display: block !important;
    float: none !important;
    clear: both;
    width: 100% !important;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    height: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    overflow: visible !important;
  }
  body.cor-shell #corInnerPanel table#details tr {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 6px 4px;
    border-bottom: 1px solid rgba(240, 208, 128, 0.14);
  }
  body.cor-shell #corInnerPanel table#details th,
  body.cor-shell #corInnerPanel table#details td {
    display: block !important;
    width: auto !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
  }
  body.cor-shell #corInnerPanel table#details th { font: 700 14px/1.3 "Noto Sans Arabic", "Source Sans 3", sans-serif !important; color: #aab4c3 !important; }
  body.cor-shell #corInnerPanel table#details td { font: 800 16px/1.3 "Noto Kufi Arabic", "Source Sans 3", sans-serif !important; color: #fff4cf !important; }
  body.cor-shell #corInnerPanel table#details td[colspan] { flex: 1 1 auto; }
  body.cor-shell #corInnerPanel table#details td[colspan] a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border-radius: 12px;
    border: var(--crz-v3-card-border);
    background: var(--crz-v3-card-bg);
    font: var(--crz-v3-label) !important;
  }
  body.cor-shell #corInnerPanel table#details td[colspan] a::before { display: none !important; }
  /* the profile's village list */
  body.cor-shell #corInnerPanel table#villages { table-layout: fixed; width: 100% !important; }
  body.cor-shell #corInnerPanel table#villages th { font-size: 12.5px !important; white-space: normal !important; }
  body.cor-shell #corInnerPanel table#villages td { font-size: 14px !important; overflow-wrap: break-word; }
  body.cor-shell #corInnerPanel table#villages th:first-child,
  body.cor-shell #corInnerPanel table#villages td:first-child { width: 42%; }
  body.cor-shell #corInnerPanel table#villages td:first-child a { font-weight: 800; unicode-bidi: plaintext; }
}

/* ── Unit and building info (manual.php, inside the info dialog's frame): the picture above the stats ── */
@media (max-width: 720px) {
  body.manual .cor-manual-detail .bigUnitSection,
  body.manual.rtl .cor-manual-detail .bigUnitSection {
    float: none !important;
    width: auto !important;
    height: auto !important;
    margin: 0 auto 12px !important;
    text-align: center;
  }
  body.manual .cor-manual-detail .bigUnitSection img.unitSection {
    display: inline-block;
    width: 150px !important;
    height: 150px !important;
    border-radius: 14px;
    background-size: cover !important;
    background-position: center !important;
  }
  body.manual .cor-manual-detail .boxes { clear: both; }
  body.manual .cor-manual-detail table#troop_info { width: 100% !important; table-layout: fixed; }
  body.manual .cor-manual-detail table#troop_info td,
  body.manual .cor-manual-detail table#troop_info th { font-size: 14px !important; padding: 6px 2px !important; overflow-wrap: anywhere; }
  body.manual .cor-manual-detail h1.titleInHeader { font-size: 19px !important; }
}

/* ── V2 fix: with the incoming-attack alert showing, the slide panels (tasks, daily, overview, player) open
   below it, so their title and close button stay visible. ── */
@media (max-width: 1024px) {
  body.cor-shell:has(> :where(#background) > .crz-attack-alert) .cor-slidepanel { top: calc(var(--cor-topbar-h) + 62px) !important; }
}

/* ── Quests: the daily list readable at arm's length ── */
@media (max-width: 720px) {
  body.cor-shell .cor-daily-quests .cor-card__header { font: 800 16px/1.3 "Noto Kufi Arabic", "Source Sans 3", sans-serif !important; }
  body.cor-shell .cor-daily-quests__reset { font-size: 12.5px !important; }
  body.cor-shell .cor-daily-quests__points-label,
  body.cor-shell .cor-daily-quests__points-value { font-size: 14px !important; font-weight: 800 !important; }
  body.cor-shell .cor-daily-quests__milestone { min-height: 48px; }
  body.cor-shell .cor-daily-quests__milestone-pts { font-size: 13px !important; font-weight: 800; }
  body.cor-shell .cor-daily-quests li,
  body.cor-shell .cor-daily-quests__item {
    min-height: 40px;
    font-size: 14px !important;
    line-height: 1.4;
    align-items: center;
  }
  body.cor-shell .cor-daily-quests a,
  body.cor-shell .cor-daily-quests button { min-height: 44px; font-size: 14px !important; }
}

/* ── Construction list: the building's name, picture, costs and Build button first; long descriptions
   are clamped to three lines (the full text stays in the building's info). ── */
@media (max-width: 720px) {
  body.cor-shell #corInnerPanel .buildingWrapper .build_desc {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
  }
  body.cor-shell #corInnerPanel .buildingWrapper .build_desc a.build_logo { float: inline-end !important; }
  body.cor-shell #corInnerPanel .buildingWrapper .build_desc img.build_logo { max-width: 110px; height: auto; }
  body.cor-shell #corInnerPanel .buildingWrapper > h2 {
    font: 800 19px/1.3 "Noto Kufi Arabic", "Source Sans 3", sans-serif !important;
    color: #fff4cf !important;
  }
  body.cor-shell #corInnerPanel .buildingWrapper .contractText { font: var(--crz-v3-label) !important; color: #c9d1dc !important; }
}

@media (max-width: 720px) {
  body.cor-shell .cor-daily-quests__task { display: flex !important; justify-content: space-between; gap: 8px; padding: 6px 0 !important; }
  body.cor-shell .cor-daily-quests__task-name { font: 700 14px/1.4 "Noto Sans Arabic", "Source Sans 3", sans-serif !important; color: #2a2116 !important; }
  body.cor-shell .cor-daily-quests__task-meta {
    flex: 0 0 auto;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(217, 162, 27, 0.22);
    font: 800 13px/1.4 "Source Sans 3", sans-serif !important;
    color: #6b4a08 !important;
    direction: ltr;
    unicode-bidi: isolate;
  }
}

@media (max-width: 720px) {
  /* an open side panel is never covered by the village zoom buttons */
  body.cor-shell:has(> :where(#background) > :where(#bodyWrapper) > :where(.cor-canvas) > :where(.cor-overlay-panels) > .cor-slidepanel.is-open) .crz-zoom-controls { visibility: hidden; }
}

@media (max-width: 720px) {
  /* English: long words in the 4-column tab tiles and the footer actions */
  body.cor-shell.ltr #content .cor-reports-tab__label,
  body.cor-shell.ltr #content .cor-messages-tab__label { font-size: 11px !important; letter-spacing: -0.1px !important; overflow-wrap: anywhere; }
  body.cor-shell #content .cor-reports-footer .cor-btn,
  body.cor-shell #content .cor-messages-footer .cor-btn { text-transform: none !important; letter-spacing: 0 !important; }
}

@media (max-width: 720px) {
  body.cor-shell #corInnerPanel table#villages th { text-transform: none !important; letter-spacing: 0 !important; font-size: 11.5px !important; }
}

@media (max-width: 720px) {
  /* hero auctions: the item list fits the card */
  body.cor-shell.cor-screen-hero #content table:not(.attributes):not(:has(td.goTo)) { table-layout: fixed; width: 100% !important; }
  body.cor-shell.cor-screen-hero #content table:not(.attributes):not(:has(td.goTo)) th {
    font-size: 12px !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    padding: 4px 2px !important;
  }
  body.cor-shell.cor-screen-hero #content table:not(.attributes):not(:has(td.goTo)) td { font-size: 13px !important; overflow-wrap: anywhere; }
  /* construction list: building prerequisites wrap inside the card */
  body.cor-shell #corInnerPanel .buildingCondition,
  body.cor-shell #corInnerPanel .buildingCondition a { white-space: normal !important; overflow-wrap: anywhere; display: inline; }
  body.cor-shell #corInnerPanel .contractLink:has(.buildingCondition) { font-size: 14px !important; line-height: 1.6; }
  /* profile villages: coordinates stay inside */
  body.cor-shell #corInnerPanel table#villages th:first-child,
  body.cor-shell #corInnerPanel table#villages td:first-child { width: 36%; }
  body.cor-shell #corInnerPanel table#villages .coordinates { font-size: 12.5px !important; white-space: nowrap; }
  body.cor-shell #corInnerPanel table#villages td:last-child { padding-inline: 0 !important; }
}

@media (max-width: 380px) {
  /* hero equipment: the 300 px figure with its item slots fits the narrowest phones */
  body.cor-shell.cor-screen-hero #content #bodyOptions { zoom: 0.92; }
}

@media (max-width: 720px) {
  body.cor-shell.cor-screen-hero #content .resourcePick label > i { flex: 0 0 auto !important; min-width: 18px; }
  body.cor-shell.cor-screen-hero #content .resourcePick label > input.radio { flex: 0 0 auto; margin: 0 !important; }
  body.cor-shell.cor-screen-hero #content .resourcePick .current { min-width: 0; overflow-wrap: anywhere; }
}
@media (max-width: 400px) {
  body.cor-shell.cor-screen-hero #content .resourcePick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
