/* Telefono (ypač iPhone) patogumas: dideli paspaudžiami plotai, be priartinimo įvedant tekstą, apačios langai, saugios zonos */
:root { --row: 28px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, a, label, select, summary, .t-cell, .t-lblock, .t-daytab, .a-lesson, .a-heat { touch-action: manipulation; -webkit-tap-highlight-color: rgba(47, 189, 104, .18); }
.t-grid, .a-grid-inner { -webkit-touch-callout: none; }
.t-gridwrap, .t-tabs, .t-daytabs { -webkit-overflow-scrolling: touch; }
.t-tabs, .t-daytabs { scrollbar-width: none; }
.t-tabs::-webkit-scrollbar, .t-daytabs::-webkit-scrollbar { display: none; }

/* Eilučių aukštis valdomas vienu kintamuoju (kompiuteris 28 px, telefonas 44 px, kaip rekomenduoja Apple) */
.t-grid { grid-auto-rows: var(--row); }
.t-cell { height: var(--row); }
.t-time { height: var(--row); }
.t-cell.run-first, .t-cell.run-last { height: calc(var(--row) - 2px); }
.t-cell.run-first.run-last { height: calc(var(--row) - 4px); }

/* Apačios veiksmų juosta kalendoriuje (pasirodo palietus laiko pradžią) */
#t-selbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; background: #fff; border-top: 2.5px solid var(--ink); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 30px rgba(11, 32, 20, .18); padding: .9rem 1rem calc(.9rem + var(--safe-b)); transform: translateY(110%); transition: transform .28s cubic-bezier(.16, 1, .3, 1); }
#t-selbar.show { transform: translateY(0); }
#t-selbar .sb-title { font-weight: 800; font-size: .95rem; margin-bottom: .6rem; }
#t-selbar .sb-title span { color: var(--brand-deep); }
#t-selbar .sb-chips { display: flex; gap: .5rem; flex-wrap: wrap; }
#t-selbar button { font-family: inherit; font-weight: 800; font-size: 1rem; min-height: 46px; padding: 0 1.1rem; border-radius: 100px; border: 2px solid var(--ink); background: var(--brand); color: var(--ink); cursor: pointer; }
#t-selbar button.sb-ghost { background: #fff; }
#t-selbar button.sb-cancel { background: #fff; color: var(--coral-deep); border-color: var(--coral-deep); margin-left: auto; }

#t-toast { bottom: calc(22px + var(--safe-b)); }

@media (hover: none) {
  .t-cell.empty:hover { background: transparent; }
  .t-lblock:hover, .tutor-ul li:hover { transform: none; }
}

@media (max-width: 700px) {
  :root { --row: 44px; }
  /* 16 px šriftas laukuose: iPhone nebepriartina puslapio įvedant tekstą */
  input, select, textarea, .t-room-row input, .t-flabel input, .t-flabel textarea, .modal-box input, .modal-box select { font-size: 16px !important; }
  .t-cell { font-size: .78rem; padding: 4px 8px; line-height: calc(var(--row) - 10px); }
  .t-time { font-size: .74rem; }
  .t-btn, .t-mode, .t-presets button, .t-weeknav button { min-height: 44px; }
  .t-weeknav { gap: .4rem; }
  .t-weeknav button { padding: .4rem 1rem; font-size: .95rem; }
  .t-mode { flex: 1 1 0; text-align: center; justify-content: center; padding: .5rem .4rem; font-size: .9rem; }
  .t-modes { width: 100%; flex-wrap: nowrap; }
  .t-presets { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: .3rem; scrollbar-width: none; }
  .t-presets::-webkit-scrollbar { display: none; }
  .t-presets button { white-space: nowrap; flex: none; }
  .t-presets > span { flex: none; }
  .t-repeat { min-height: 44px; }
  .t-repeat input { width: 22px; height: 22px; }
  .t-tabs button { min-height: 44px; }
  .t-daytabs { position: sticky; top: var(--tabs-h, 58px); z-index: 18; background: var(--cream); padding: .35rem 0; margin: .2rem 0 .5rem; }
  .t-daytab { min-height: 56px; border-radius: 14px; }
  .t-lblock { padding: 6px 10px; }
  .lb-time { font-size: .8rem; }
  .lb-name { font-size: .95rem; }
  .t-grid { border-radius: 0; }
  /* Kalendorius slenka pats savyje (su inercija), todėl įrankiai viršuje lieka matomi */
  .t-gridwrap { border-radius: 16px; max-height: 64vh; min-height: 320px; overflow-y: auto; overflow-x: hidden; }
  .t-corner, .t-dayhead { position: sticky; top: 0; }
  .t-card { padding: .9rem; }
  .t-hint { font-size: .85rem; }

  /* Pamokos langas atsidaro iš apačios, kaip iPhone programose */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box { width: 100%; max-width: 100%; border-radius: 24px 24px 0 0; border-bottom: none; padding: 1.2rem 1.2rem calc(1.2rem + var(--safe-b)); max-height: 88dvh; max-height: 88vh; overflow-y: auto; -webkit-overflow-scrolling: touch; animation: sheet-up .3s cubic-bezier(.16, 1, .3, 1); }
  .modal-box::before { content: ''; display: block; width: 44px; height: 5px; border-radius: 3px; background: rgba(11, 32, 20, .2); margin: -.2rem auto .9rem; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button { min-height: 48px; font-size: 1rem; }
  .t-repeat-box select { min-height: 44px; }
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@supports (height: 100dvh) { @media (max-width: 700px) { .modal-box { max-height: 88dvh; } .t-gridwrap { max-height: 64dvh; } } }

/* Pranešimas neturi trauktis į siaurą stulpelį telefone */
#t-toast { width: max-content; max-width: calc(100vw - 32px); }
