/* MMIPTV web app (iPhone / browser) - dark navy + cyan-to-purple gradient */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%;
  background: #040B24; color: #ffffff;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* Header */
#header {
  flex: 0 0 auto; min-height: 54px; padding: 6px 12px; display: flex; align-items: center; gap: 10px;
  background: rgba(6, 9, 30, 0.92); border-bottom: 1px solid rgba(0, 212, 255, 0.35);
  padding-top: calc(6px + env(safe-area-inset-top));
}
#btn-back {
  font-size: 30px; line-height: 1; width: 36px; height: 36px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: #00d4ff; border-radius: 50%; background: rgba(255,255,255,0.07);
}
#logo { font-size: 21px; font-weight: bold; color: #00d4ff; letter-spacing: 1px; white-space: nowrap; }
#logo span { color: #b44dff; }
#header-title { font-size: 15px; color: #dfe8ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#trial-badge {
  font-size: 12px; color: #ffd75e; padding: 3px 10px; white-space: nowrap;
  border: 1px solid rgba(255, 215, 94, 0.6); border-radius: 20px; display: none;
}
#clock { margin-left: auto; font-size: 14px; color: #9fb4e8; }

/* Install banner */
#install-banner {
  flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; font-size: 14px; color: #dfe8ff;
  background: linear-gradient(90deg, rgba(0,184,230,0.25), rgba(147,51,234,0.25));
  border-bottom: 1px solid rgba(0, 212, 255, 0.3);
}
#install-close { cursor: pointer; padding: 4px 8px; color: #9fb4e8; }

/* Screens */
.screen { display: none; flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; position: relative; }
.screen.active { display: block; }

/* Splash */
.splash { text-align: center; margin-top: 22vh; padding: 0 20px; }
.splash-logo { font-size: 52px; font-weight: bold; color: #00d4ff; }
.splash-logo span { color: #b44dff; }
.spinner {
  width: 44px; height: 44px; margin: 34px auto 22px;
  border: 5px solid rgba(0, 212, 255, 0.25); border-top-color: #b44dff;
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { font-size: 16px; color: #9fb4e8; }

/* Focus (keyboard / remote when used in a browser) */
.focusable { outline: none; }
.focused { box-shadow: 0 0 0 3px #00d4ff; z-index: 5; }

/* Buttons */
.btn {
  display: inline-block; margin-top: 18px; padding: 14px 30px; font-size: 17px;
  border-radius: 12px; cursor: pointer; color: #fff; text-align: center;
  background: linear-gradient(90deg, #00b8e6, #9333ea);
}
.error { color: #ff7b7b; font-size: 14px; min-height: 20px; margin-top: 10px; }
.muted { color: #9fb4e8; font-size: 14px; }

/* Login */
.login-box {
  max-width: 480px; margin: 24px auto; padding: 26px 22px; border-radius: 18px;
  background: rgba(16, 22, 58, 0.92); border: 1px solid rgba(0, 212, 255, 0.25);
}
.login-box h1 { font-size: 26px; margin-bottom: 20px; text-align: center; }
.tabs { display: flex; gap: 10px; margin-bottom: 18px; }
.tab {
  flex: 1; text-align: center; padding: 11px; font-size: 15px; border-radius: 10px;
  background: rgba(255,255,255,0.07); color: #9fb4e8; cursor: pointer;
}
.tab.active { background: linear-gradient(90deg, #00b8e6, #9333ea); color: #fff; }
.login-box label { display: block; font-size: 14px; color: #9fb4e8; margin: 14px 0 6px; }
.login-box input {
  width: 100%; padding: 13px 14px; font-size: 16px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.18); background: rgba(0,0,0,0.35); color: #fff;
}
.login-box input:focus { border-color: #00d4ff; }
#btn-login { display: block; text-align: center; }

/* Activation */
.activation-box {
  max-width: 560px; margin: 32px auto; padding: 30px 22px; text-align: center; border-radius: 18px;
  background: rgba(16, 22, 58, 0.92); border: 1px solid rgba(255, 215, 94, 0.4);
}
.activation-box h1 { font-size: 26px; color: #ffd75e; margin-bottom: 16px; }
.activation-box p { font-size: 15px; line-height: 1.6; }
.device-code {
  font-size: 34px; letter-spacing: 3px; font-weight: bold; color: #00d4ff;
  margin: 22px 0 8px; font-family: monospace; word-break: break-all;
}
.activation-url { font-size: 18px; color: #b44dff; margin-bottom: 14px; }

/* Home tiles */
.tiles { display: flex; flex-direction: column; gap: 14px; padding: 18px 16px 0; max-width: 720px; margin: 0 auto; width: 100%; }
.tile {
  display: flex; align-items: center; gap: 16px; min-height: 96px;
  border-radius: 18px; cursor: pointer; padding: 16px 20px;
}
.tile-live   { background: linear-gradient(160deg, #0077ff, #00d4ff); }
.tile-movies { background: linear-gradient(160deg, #9333ea, #b44dff); }
.tile-series { background: linear-gradient(160deg, #e6007e, #ff7a3d); }
.tile-icon { font-size: 40px; }
.tile-name { font-size: 24px; font-weight: bold; }
.tile-sub  { font-size: 14px; opacity: 0.85; }
.tiles-small { flex-direction: row; padding-top: 14px; }
.tile-small {
  flex: 1; min-height: 52px; justify-content: center; padding: 10px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
}
.tile-small .tile-name { font-size: 15px; }

/* Categories */
.category-list { padding: 14px 16px; max-width: 820px; margin: 0 auto; }
.category-row {
  display: block; width: 100%; padding: 15px 16px; margin-bottom: 10px; font-size: 16px;
  background: rgba(255,255,255,0.06); border-radius: 12px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.08);
}
.category-row .count { float: right; color: #9fb4e8; font-size: 13px; }
#grid-more { max-width: 820px; margin: 4px auto 18px; width: calc(100% - 32px); text-align: center; }

/* Grid */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 12px; padding: 14px; max-width: 1100px; margin: 0 auto;
}
.card {
  border-radius: 12px; cursor: pointer;
  background: rgba(255,255,255,0.06); overflow: hidden; position: relative;
}
.card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; background: #11173d; display: block; }
.card .noimg {
  width: 100%; aspect-ratio: 2/3; background: #11173d; display: flex;
  align-items: center; justify-content: center; font-size: 34px; color: #334;
}
.card .card-name {
  padding: 8px 9px; font-size: 12.5px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.empty { text-align: center; font-size: 17px; color: #9fb4e8; margin-top: 80px; }

/* Episodes */
.episode-title { font-size: 20px; padding: 18px 16px 4px; max-width: 820px; margin: 0 auto; }
.episode-row .season { color: #00d4ff; font-size: 13px; margin-right: 10px; }

/* Player */
#screen-player { background: #000; overflow: hidden; }
#screen-player.active { display: flex; flex-direction: column; }
#html5-player { flex: 1 1 auto; width: 100%; min-height: 0; background: #000; }
#player-osd {
  flex: 0 0 auto; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(0,0,0,0.85); opacity: 1; transition: opacity 0.3s;
}
#player-osd.hidden { opacity: 0; pointer-events: none; }
#player-title { font-size: 16px; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#player-controls { display: flex; align-items: center; gap: 14px; }
.pbtn {
  width: 46px; height: 46px; border-radius: 50%; font-size: 19px; cursor: pointer;
  background: rgba(255,255,255,0.14); display: flex; align-items: center; justify-content: center;
}
#player-msg { font-size: 14px; color: #ffd75e; margin-top: 8px; min-height: 18px; }

/* Wider screens (tablets / desktop browsers) */
@media (min-width: 700px) {
  .tiles { flex-direction: row; }
  .tile { flex: 1; flex-direction: column; justify-content: center; text-align: center; min-height: 180px; }
  .tiles-small { flex-direction: row; }
  .tile-small { min-height: 52px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
