html,
body {
  margin: 0;
  overflow: hidden;
  height: 100%;
  font-family: Arial, sans-serif;
  background: #0f172a;
  color: #fef3c7;
  font-size: clamp(16px,1.2vw, 18px);
}

/* app header */

.app-header {
  height: 56px;
  position: sticky;
  top: 0; z-index: 900;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 0 14px;
  box-sizing: border-box;
  background: #1b2332;
  border-bottom: 1px solid #7f1d1d;
}

.app-header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  min-width: 0;
  pointer-events: none;
}

.app-header-actions {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  grid-column: 1;
}

.app-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex: 0 0 auto;
}

.app-title {
  font-family: "Kaushan Script", cursive;
  font-size: 28px;
  line-height: 1;
  color: #f8e7b0;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.header-layout-btn {
  padding: 7px 12px;
  border: 1px solid #475569;
  border-radius: 8px;
  background: #243041;
  color: #f8fafc;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.header-menu-btn {
  display: none;
}


/* dashboard */


.dashboard-page {
  display: grid;
  position: relative;
  grid-template-rows: 1fr 90px;
  height: calc(100vh - 56px);
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  min-height: 0;
  gap: 10px;
  padding: 10px;
  box-sizing: border-box;
}

.tile-shell {
  min-height: 0;
}

.tile {
  height: 100%;
  display: flex;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  overflow: hidden;
}

.tile.loading {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-header {
  background: #1e293b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 60px;
  padding: 10px 4px;
  border-left: 1px solid #334155;
  flex-shrink: 0;
  gap: 6px;
}

.tile-header-left {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
}

.tile-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: brightness(0.9);
}

.tile-title {
  order: 1;
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  color: #fde68a;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: right;
}

.tile-meta {
  order: 2;
  margin-top: 2px;
  font-size: 11px;
  color: #94a3b8;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
}

.tile-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 5px;
}

.feed-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  padding: 6px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
}

.feed-item:hover {
  background: #273449;
}

.feed-thumb {
  width: 75px;
  height: 56px;
  object-fit: contain;
  border-radius: 6px;
  background: #334155;
}

.feed-title {
  display: -webkit-box;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 4px;
  font-size: 20px;
  line-height: 1.3;
  color: #fef9c3;
}
2
.feed-time {
  font-size: 11px;
  color: #96beed;
}

.feed-item.is-fresh {
  background: rgba(255, 255, 255, 0.02);
}

.feed-item.is-stale {
  opacity: 0.85;
}

.feed-item.is-stale .feed-title {
  color: #f8d8a5;
}

.feed-item.is-stale .feed-time {
  color: #64748b;
}

.empty-state {
  padding: 12px;
  font-size: 13px;
  color: #94a3b8;
}

/* weather */

.weather-shell {
  padding: 0 12px 12px;
}

.weather-bar {
  height: 100%;
  display: grid;
  grid-template-columns: 2.3fr 2.7fr auto;
  align-items: center;
  gap: 20px;
  padding: 14px 18px;
  box-sizing: border-box;
  background: #172033;
  border: 1px solid #334155;
  border-radius: 10px;
}

.weather-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
  font-size: 20px;
}

.weather-location {
  font-weight: 700;
  color: #fde68a;
}

.weather-current {
  font-size: 30px;
  font-weight: 700;
  color: #fef9c3;
}

.weather-feels {
  font-size: 25px;
  font-weight: 700;
  color: rgb(183, 142, 5);
}

.weather-condition,
.weather-precip,
.weather-summary-label,
.weather-meta {
  font-size: 18px;
  color: #fde68a;
}

.weather-summary {
  min-width: 0;
}

.weather-summary-label {
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.weather-summary-text {
  font-size: 15px;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-view-label, .mobile-close-tab {
  display: none;
}



/* slot picker */

.layout-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  place-items: center;
  background: rgba(15, 23, 42, 0.72);
}

.layout-modal-backdrop:not([hidden]) {
  display: grid;
}


.layout-modal {
  width: min(1100px, calc(100vw - 40px));
  max-width: 1100px;
  padding: 18px;
  border: 1px solid #334155;
  border-radius: 12px;
  background: #0f172a;
  color: #f8fafc;
}

.layout-modal-header {
  margin-bottom: 14px;
}

.layout-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #fde68a;
}

.layout-modal-content {
  display: grid;
  grid-template-columns: 280px 120px 1fr;
  gap: 20px;
  align-items: start;
}
.layout-source-list {
  display: grid;
  gap: 10px;
  max-height: 760px;
  overflow-y: auto;
  padding-right: 6px;
}
.layout-tile {
  border: 1px solid #334155;
  border-radius: 10px;
  background: #1e293b;
  cursor: grab;
}
.layout-mini-tile {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.layout-mini-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.layout-mini-name {
  font-size: 17px;
  line-height: 1.2;
  color: #f8fafc;
}

.layout-modal-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  font-size: 16px;
  color: #94a3b8;
}

.layout-grid-panel {
  display: grid;
  gap: 14px;
}

.layout-slot-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.layout-slot {
  display: grid;
  gap: 6px;
}

.layout-slot-label {
  font-size: 13px;
  color: #94a3b8;
}

.layout-slot .layout-tile {
  min-height: 72px;
}

.layout-slot.is-dragover .layout-slot-tile {
  outline: 2px solid #fde68a;
  outline-offset: 0;
}

.layout-modal-actions {
  display: flex;
  gap: 10px;
  font-size: 1.6em;
  justify-content: flex-start;
}

.layout-btn {
  padding: 8px 14px;
  border: 1px solid #475569;
  border-radius: 8px;
  background: #1e293b;
  color: #f8fafc;
  font-size: 1em;
  cursor: pointer;
}

.layout-btn-primary {
  background: #243041;
  color: #fde68a;
}


/* mobile */

@media (max-width: 900px) and (orientation: landscape) {
  body::before {
    content: "Rotate back to portrait";
    display: grid;
    place-items: center;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #0f172a;
    color: #fde68a;
    font-size: 22px;
    font-weight: 700;
  }

  .app-header, .header-view-label,
  .dashboard-page {
    display: none;
  }
}

@media (max-width: 900px) {
  html,
  body {
    overflow: auto;
    height: auto;
    font-size: 14px;
  }

  .header-menu-btn {
    display: block;
    padding: 7px 11px;
    border: 1px solid #475569;
    border-radius: 8px;
    background: #243041;
    color: #f8fafc;
    font-size: 20px;
    line-height: 1;
  }

  .header-layout-btn,
  .layout-modal-backdrop {
    display: none;
  }

  .app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    padding: 0 12px;
  }

  .app-logo {
    width: 30px;
    height: 30px;
  }

  .app-title {
    font-size: 22px;
  }

  .header-view-label {
    display: block;
    color: #93c5fd;
    font-size: 16px;
    font-weight: 700;
    pointer-events: auto;
  }

  .dashboard-page {
    display: block;
    height: auto;
    min-height: 100vh;
    padding-top: 52px;
    box-sizing: border-box;
  }

  .dashboard {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
  }

  .tile {
    display: block;
    height: auto;
    border-radius: 12px;
    overflow: hidden;
  }

  .tile-header {
    padding: 12px 14px;
    border-left: none;
    border-bottom: 1px solid #334155;
    display: grid;
    grid-template-columns: 32px 1fr auto;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    width: auto;
  }

  .tile-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex: 0 0 32px;
  }

  .tile-header-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
  }

  .tile-title {
    writing-mode: initial;
    transform: none;
    text-align: center;
    font-size: 18px;
    line-height: 1.2;
    color: #fde68a;
    white-space: nowrap;
    overflow: hidden;
    flex: 1 1 auto;
  }

  .tile-meta {
    margin-top: 0;
    writing-mode: initial;
    transform: none;
    text-align: left;
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
  }


  .tile-body {
    display: none;
    padding: 10px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tile-shell.mobile-open .tile-body {
    display: block;
  }

  .dashboard.mobile-has-open .tile-shell:not(.mobile-open) {
    display: none;
  }

  .mobile-close-tab {
    display: none;
  }

  .tile-shell.mobile-open .mobile-close-tab {
    display: block;
    width: 44px;
    height: 28px;
    margin: 8px auto 0;
    border: 1px solid #475569;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    background: #243041;
    color: #f8fafc;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
  }

  .tile-action-btn {
    margin-left: auto;
    padding: 6px 10px;
    border-radius: 999px;
    background: #637fa6;
    color: #e2e8f0;
    font-size: 18px;
    font-weight: 700;
    border: 1px solid #475569;
    line-height: 1;
  }

  .tile-action-btn:hover {
    background: #475569;
  }

  .tile-action-btn.add {
    background: #065f46;
    border-color: #047857;
    color: #d1fae5;
  }

  .tile-action-btn.add:hover {
    background: #047857;
  }

  .tile-action-btn.remove {
    background: #7f1d1d;
    border-color: #991b1b;
    color: #fee2e2;
  }

  .tile-action-btn.remove:hover {
    background: #991b1b;
  }

  .feed-item {
    grid-template-columns: 72px 1fr;
    gap: 10px;
    padding: 8px;
  }

  .feed-title {
    font-size: 16px;
  }

  .feed-time {
    font-size: 12px;
  }

  .mobile-menu {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.9);
    z-index: 1000;
  }

  .mobile-menu-content {
    background: #1e293b;
    margin: 60px 12px;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .mobile-menu-item {
    padding: 10px 12px;
    border-radius: 8px;
    color: #f8fafc;
  }

  .mobile-menu-item.active {
    background: #243041;
    color: #fde68a;
  }

  .mobile-menu-divider {
    height: 1px;
    background: #334155;
    margin: 6px 0;
  }

  .weather-shell {
    display: none;
  }
}
