/* Public phone calendar and History refinements — 18 Nov 2026.
   Mobile only. Preserve actual Growtopia artwork, controls and score data.
   Loaded after the previous narrow-calendar and History styles. */
@media (max-width:860px),
       (pointer:coarse) and (orientation:landscape) and (max-height:600px) and (max-width:1100px) {

  /* Calendar: keep the two arrow PAIRS beside each other on a single
     navigation row. The date controls get their own row. A small phone
     should never push only the next-year arrow to a third row. */
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .v5-month-control .v5-calendar-jumps {
    display:grid!important;
    grid-template-columns:repeat(14,minmax(0,1fr))!important;
    grid-template-rows:minmax(39px,auto) 39px!important;
    gap:7px 4px!important;
    align-items:center!important;
    justify-items:stretch!important;
    justify-content:stretch!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
    flex-wrap:nowrap!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .v5-calendar-jumps > .v47-calendar-picker {
    box-sizing:border-box!important;
    min-width:0!important;
    max-width:100%!important;
    width:100%!important;
    grid-row:1!important;
  }
  /* Date format can be day/month/year OR month/day/year.
     Both picker orders retain proportional widths. */
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .v5-calendar-jumps > [data-v47-picker="day"] {
    grid-column:1 / span 2!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .v5-calendar-jumps > [data-v47-picker="month"] {
    grid-column:3 / span 5!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .v5-calendar-jumps > [data-v47-picker="year"] {
    grid-column:8 / span 4!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .v5-calendar-jumps > [data-v47-picker="day"] .v47-calendar-picker-toggle,
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .v5-calendar-jumps > [data-v47-picker="month"] .v47-calendar-picker-toggle,
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .v5-calendar-jumps > [data-v47-picker="year"] .v47-calendar-picker-toggle {
    box-sizing:border-box!important;
    min-width:0!important;
    width:100%!important;
    max-width:100%!important;
    height:39px!important;
    min-height:39px!important;
    padding:0 6px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:3px!important;
    font-size:clamp(10px,2.9vw,13px)!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .v5-calendar-jumps > button.cal-today {
    display:inline-flex!important;
    grid-column:12 / span 3!important;
    grid-row:1!important;
    box-sizing:border-box!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    height:39px!important;
    min-height:39px!important;
    padding:0 3px!important;
    margin:0!important;
    align-items:center!important;
    justify-content:center!important;
    font-size:clamp(10px,2.8vw,12px)!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .v5-calendar-jumps > .month-control-buttons {
    display:flex!important;
    flex:0 0 auto!important;
    flex-wrap:nowrap!important;
    justify-content:center!important;
    gap:5px!important;
    min-width:0!important;
    width:max-content!important;
    max-width:100%!important;
    grid-row:2!important;
    margin:0!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .v5-calendar-jumps > .month-control-buttons:first-child {
    grid-column:1 / span 7!important;
    justify-self:end!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .v5-calendar-jumps > .month-control-buttons:last-child {
    grid-column:8 / span 7!important;
    justify-self:start!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .v5-calendar-jumps > .month-control-buttons button {
    flex:0 0 36px!important;
    box-sizing:border-box!important;
    width:36px!important;
    min-width:36px!important;
    max-width:36px!important;
    height:36px!important;
    min-height:36px!important;
    padding:0!important;
    margin:0!important;
  }

  /* The old narrow-calendar behavior deliberately hid names. Restore
     each name as a readable two-line caption, with an ellipsis if even
     that cannot fit. Day-details still contain the complete name. */
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .calendar-week .day-cell {
    box-sizing:border-box!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:flex-start!important;
    position:relative!important;
    width:100%!important;
    min-width:0!important;
    height:100px!important;
    min-height:100px!important;
    max-height:100px!important;
    padding:4px 1px 12px!important;
    gap:2px!important;
    overflow:hidden!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .calendar-week .day-cell .day-top {
    flex:0 0 13px!important;
    width:100%!important;
    min-height:13px!important;
    line-height:1.1!important;
    align-self:stretch!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .calendar-week .day-cell .day-art {
    flex:0 0 31px!important;
    height:31px!important;
    min-height:31px!important;
    max-height:31px!important;
    width:100%!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    margin:0!important;
    overflow:hidden!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .calendar-week .day-cell .day-art img {
    width:min(27px,100%)!important;
    max-width:27px!important;
    height:27px!important;
    max-height:27px!important;
    object-fit:contain!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .calendar-week .day-cell .day-title {
    display:-webkit-box!important;
    -webkit-box-orient:vertical!important;
    -webkit-line-clamp:2!important;
    line-clamp:2!important;
    box-sizing:border-box!important;
    flex:0 0 auto!important;
    align-self:stretch!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    max-height:26px!important;
    margin:0!important;
    padding:0 1px!important;
    overflow:hidden!important;
    white-space:normal!important;
    overflow-wrap:break-word!important;
    word-break:normal!important;
    hyphens:none!important;
    text-align:center!important;
    text-overflow:ellipsis!important;
    font-size:clamp(7.5px,2.25vw,9px)!important;
    line-height:1.2!important;
    font-weight:700!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .calendar-week .day-cell .day-title.v5-multi-dc-titles > span {
    display:block!important;
    overflow:hidden!important;
    white-space:nowrap!important;
    text-overflow:ellipsis!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .calendar-week .day-cell .v86-random-subtitle {
    display:none!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .calendar-week .day-cell .v5-cycle-label,
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .calendar-week .day-cell .possible-flag {
    bottom:1px!important;
    max-width:calc(100% - 2px)!important;
    font-size:clamp(5px,1.5vw,6px)!important;
    white-space:nowrap!important;
  }

  /* History score rows: rank | name | score | reward icons.
     Stop making rewards a forced second row; distribute the unused space
     between player and score instead, keeping long names safely clipped. */
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"][data-current-view="history"]
  #content .v5-history-columns,
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"][data-current-view="history"]
  #content .v5-history-minirow {
    display:grid!important;
    grid-template-columns:32px minmax(0,1fr) minmax(63px,max-content) minmax(66px,auto)!important;
    column-gap:4px!important;
    row-gap:0!important;
    align-items:center!important;
    min-width:0!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"][data-current-view="history"]
  #content .v5-history-minirow {
    min-height:48px!important;
    padding:5px 7px!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"][data-current-view="history"]
  #content .v5-history-minirow > button {
    grid-column:2!important;
    grid-row:1!important;
    min-width:0!important;
    width:100%!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    word-break:normal!important;
    text-align:left!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"][data-current-view="history"]
  #content .v5-history-minirow > b {
    grid-column:3!important;
    grid-row:1!important;
    min-width:0!important;
    margin:0!important;
    font-size:clamp(10px,2.6vw,12px)!important;
    font-variant-numeric:tabular-nums!important;
    white-space:nowrap!important;
    text-align:right!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"][data-current-view="history"]
  #content .v5-history-minirow > .v5-rewards {
    grid-column:4!important;
    grid-row:1!important;
    display:flex!important;
    flex-wrap:nowrap!important;
    min-width:0!important;
    max-width:100%!important;
    min-height:22px!important;
    gap:2px!important;
    justify-content:flex-end!important;
    align-items:center!important;
    overflow:hidden!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"][data-current-view="history"]
  #content .v5-history-minirow > .v5-rewards img {
    width:clamp(15px,4.8vw,20px)!important;
    height:clamp(15px,4.8vw,20px)!important;
    flex:0 1 auto!important;
    min-width:0!important;
    object-fit:contain!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"][data-current-view="history"]
  #content .v5-history-columns > span:last-child {
    display:block!important;
    text-align:right!important;
  }
}
@media(max-width:355px) {
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"][data-current-view="history"]
  #content .v5-history-columns,
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"][data-current-view="history"]
  #content .v5-history-minirow {
    grid-template-columns:29px minmax(0,1fr) minmax(57px,max-content) minmax(54px,auto)!important;
    column-gap:3px!important;
  }
  html[data-gtt-design-mode="workbench"] body[data-theme="glass"]
  #content .calendar-panel .v5-calendar-jumps > .month-control-buttons button{
    flex-basis:32px!important;
    width:32px!important;
    min-width:32px!important;
  }
}
