/* =========================================================================
   1. BASE RESET & DEFAULT LIGHT THEME (CRISP E-INK)
   ========================================================================= */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  color: #000000;
  font-family: "Courier New", Courier, monospace;
  font-weight: bold;
}

/* Pixelated 4px Notched Corners (Falls back cleanly to square on old WebKit) */
.pixel-cut {
  -webkit-clip-path: polygon(
    0 4px, 4px 4px, 4px 0,
    calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px,
    100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%,
    4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px)
  );
  clip-path: polygon(
    0 4px, 4px 4px, 4px 0,
    calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px,
    100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%,
    4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px)
  );
}

/* =========================================================================
   2. LEGACY TABLE LAYOUT (ALIGNED SLIGHTLY ABOVE CENTER TO FIT SCREEN)
   ========================================================================= */
.app-table {
  display: table;
  width: 100%;
  height: 100%;
  border-collapse: collapse;
}

.app-row-top {
  display: table-row;
  height: 54px;
}

.app-row-main {
  display: table-row;
}

.app-cell-top {
  display: table-cell;
  vertical-align: top;
  padding: 6px 12px 0 12px;
}

.app-cell-main {
  display: table-cell;
  vertical-align: top;
  text-align: center;
  padding: 6px 12px 8px 12px;
}

/* Top Header Bar */
.header-bar {
  display: table;
  width: 100%;
  border-bottom: 3px solid #000000;
  padding-bottom: 6px;
}

.header-left {
  display: table-cell;
  text-align: left;
  vertical-align: middle;
  font-size: 15px;
  letter-spacing: 1px;
}

.header-right {
  display: table-cell;
  text-align: right;
  vertical-align: middle;
}

/* =========================================================================
   3. TOUCH BUTTONS (MINIMUM 48PX TALL, ZERO ANIMATION)
   ========================================================================= */
.btn {
  display: inline-block;
  min-height: 48px;
  line-height: 22px;
  padding: 10px 14px;
  font-family: "Courier New", Courier, monospace;
  font-size: 18px;
  font-weight: bold;
  text-transform: uppercase;
  background-color: #ffffff;
  color: #000000;
  border: 3px solid #000000;
  cursor: pointer;
  margin: 3px;
}

.btn:active {
  background-color: #000000;
  color: #ffffff;
}

.btn-primary {
  background-color: #000000;
  color: #ffffff;
  padding: 10px 20px;
  font-size: 19px;
}

.btn-primary:active {
  background-color: #555555;
  color: #ffffff;
}

.btn-small {
  min-height: 48px;
  padding: 8px 10px;
  font-size: 14px;
  margin: 0 0 0 4px;
}

/* =========================================================================
   4. COMPACT TIMER DISPLAY BOX
   ========================================================================= */
.timer-box {
  border: 4px solid #000000;
  padding: 10px 8px;
  margin: 2px auto 6px auto;
  max-width: 480px;
  background-color: #eeeeee;
}

.status-label {
  font-size: 15px;
  letter-spacing: 1px;
  margin-bottom: 2px;
  color: #222222;
}

.timer-digits {
  font-size: 66px;
  line-height: 1.02;
  letter-spacing: 2px;
  margin: 4px 0;
}

.refresh-hint {
  font-size: 13px;
  color: #555555;
  margin-top: 2px;
}

/* =========================================================================
   5. MICRO TAMAGOTCHI & XP CARD
   ========================================================================= */
.pet-card {
  border: 3px solid #000000;
  padding: 10px;
  margin: 6px auto 0 auto;
  max-width: 480px;
  background-color: #ffffff;
}

.pet-table {
  display: table;
  width: 100%;
}

.pet-sprite-cell {
  display: table-cell;
  width: 78px;
  vertical-align: middle;
  text-align: center;
  border: 2px solid #000000;
  background-color: #eeeeee;
  padding: 4px;
}

.pet-sprite-cell svg {
  width: 62px;
  height: 62px;
  image-rendering: pixelated;
  display: block;
  margin: 0 auto;
}

.pet-info-cell {
  display: table-cell;
  vertical-align: middle;
  text-align: left;
  padding-left: 10px;
}

.pet-title {
  font-size: 17px;
  margin-bottom: 3px;
}

.pet-mood {
  font-size: 13px;
  color: #555555;
  margin-bottom: 6px;
}

/* Mini XP Bar */
.xp-track {
  width: 100%;
  height: 16px;
  border: 2px solid #000000;
  background-color: #eeeeee;
}

.xp-fill {
  height: 100%;
  width: 0%;
  background-color: #000000;
}

.xp-text {
  font-size: 13px;
  margin-top: 4px;
}

/* =========================================================================
   6. FIXED MODAL OVERLAYS (TIME SETTER & HONEST FOCUS CHECK-IN)
   ========================================================================= */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  z-index: 99;
  padding: 10px;
}

.modal-box {
  border: 4px solid #000000;
  max-width: 460px;
  margin: 8px auto;
  padding: 12px;
  text-align: center;
  background-color: #eeeeee;
}

.modal-header {
  font-size: 18px;
  padding-bottom: 6px;
  border-bottom: 3px solid #000000;
  margin-bottom: 10px;
}

.modal-preview {
  font-size: 44px;
  margin: 8px 0 14px 0;
  letter-spacing: 2px;
}

.step-row {
  margin-bottom: 8px;
}

/* Focus Rating Face Rows */
.focus-sub {
  font-size: 13px;
  margin-bottom: 8px;
  color: #222222;
}

.focus-btn {
  display: table;
  width: 100%;
  min-height: 48px;
  margin-bottom: 6px;
  padding: 5px 8px;
  border: 3px solid #000000;
  background-color: #ffffff;
  color: #000000;
  font-family: "Courier New", Courier, monospace;
  font-weight: bold;
  cursor: pointer;
  text-align: left;
}

.focus-btn:active {
  background-color: #000000;
  color: #ffffff;
}

.focus-face-cell {
  display: table-cell;
  width: 40px;
  vertical-align: middle;
  text-align: center;
}

.focus-face-cell svg {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  display: block;
}

.focus-label-cell {
  display: table-cell;
  vertical-align: middle;
  padding-left: 8px;
  font-size: 15px;
}

.focus-xp-cell {
  display: table-cell;
  vertical-align: middle;
  text-align: right;
  font-size: 15px;
}

/* =========================================================================
   7. THEME VARIANTS (DARK, PASTEL PINK, PASTEL BLUE, PASTEL GREEN)
   ========================================================================= */

/* --- DARK THEME --- */
body.theme-dark,
body.theme-dark .modal-overlay {
  background-color: #000000;
  color: #ffffff;
}
body.theme-dark .header-bar,
body.theme-dark .modal-header {
  border-bottom-color: #ffffff;
}
body.theme-dark .timer-box,
body.theme-dark .pet-sprite-cell,
body.theme-dark .xp-track,
body.theme-dark .modal-box {
  background-color: #222222;
  border-color: #ffffff;
}
body.theme-dark .pet-card,
body.theme-dark .btn,
body.theme-dark .focus-btn {
  background-color: #000000;
  color: #ffffff;
  border-color: #ffffff;
}
body.theme-dark .btn:active,
body.theme-dark .focus-btn:active {
  background-color: #ffffff;
  color: #000000;
}
body.theme-dark .btn-primary,
body.theme-dark .xp-fill {
  background-color: #ffffff;
  color: #000000;
}
body.theme-dark .btn-primary:active {
  background-color: #bbbbbb;
  color: #000000;
}
body.theme-dark .status-label,
body.theme-dark .refresh-hint,
body.theme-dark .pet-mood,
body.theme-dark .focus-sub {
  color: #bbbbbb;
}

/* --- PASTEL PINK THEME --- */
body.theme-pink,
body.theme-pink .modal-overlay {
  background-color: #ffeef4;
  color: #3d1626;
}
body.theme-pink .header-bar,
body.theme-pink .modal-header {
  border-bottom-color: #3d1626;
}
body.theme-pink .timer-box,
body.theme-pink .pet-sprite-cell,
body.theme-pink .xp-track,
body.theme-pink .modal-box {
  background-color: #ffd6e6;
  border-color: #3d1626;
}
body.theme-pink .pet-card,
body.theme-pink .btn,
body.theme-pink .focus-btn {
  background-color: #fff7fa;
  color: #3d1626;
  border-color: #3d1626;
}
body.theme-pink .btn:active,
body.theme-pink .focus-btn:active,
body.theme-pink .btn-primary,
body.theme-pink .xp-fill {
  background-color: #c94a7c;
  color: #ffffff;
  border-color: #3d1626;
}
body.theme-pink .status-label,
body.theme-pink .refresh-hint,
body.theme-pink .pet-mood,
body.theme-pink .focus-sub {
  color: #6b2c45;
}

/* --- PASTEL BLUE THEME --- */
body.theme-blue,
body.theme-blue .modal-overlay {
  background-color: #eef6ff;
  color: #132b45;
}
body.theme-blue .header-bar,
body.theme-blue .modal-header {
  border-bottom-color: #132b45;
}
body.theme-blue .timer-box,
body.theme-blue .pet-sprite-cell,
body.theme-blue .xp-track,
body.theme-blue .modal-box {
  background-color: #d6e8ff;
  border-color: #132b45;
}
body.theme-blue .pet-card,
body.theme-blue .btn,
body.theme-blue .focus-btn {
  background-color: #f7fbff;
  color: #132b45;
  border-color: #132b45;
}
body.theme-blue .btn:active,
body.theme-blue .focus-btn:active,
body.theme-blue .btn-primary,
body.theme-blue .xp-fill {
  background-color: #3c78b8;
  color: #ffffff;
  border-color: #132b45;
}
body.theme-blue .status-label,
body.theme-blue .refresh-hint,
body.theme-blue .pet-mood,
body.theme-blue .focus-sub {
  color: #2c4e73;
}

/* --- PASTEL GREEN THEME --- */
body.theme-green,
body.theme-green .modal-overlay {
  background-color: #eef9f1;
  color: #163822;
}
body.theme-green .header-bar,
body.theme-green .modal-header {
  border-bottom-color: #163822;
}
body.theme-green .timer-box,
body.theme-green .pet-sprite-cell,
body.theme-green .xp-track,
body.theme-green .modal-box {
  background-color: #d4f0dc;
  border-color: #163822;
}
body.theme-green .pet-card,
body.theme-green .btn,
body.theme-green .focus-btn {
  background-color: #f7fcf9;
  color: #163822;
  border-color: #163822;
}
body.theme-green .btn:active,
body.theme-green .focus-btn:active,
body.theme-green .btn-primary,
body.theme-green .xp-fill {
  background-color: #3d8c58;
  color: #ffffff;
  border-color: #163822;
}
body.theme-green .status-label,
body.theme-green .refresh-hint,
body.theme-green .pet-mood,
body.theme-green .focus-sub {
  color: #2f5c3f;
}

/* =========================================================================
   8. LANDSCAPE ORIENTATION SUPPORT
   ========================================================================= */
@media screen and (orientation: landscape) {
  .app-cell-main {
    vertical-align: middle;
  }
  .landscape-split {
    display: table;
    width: 100%;
  }
  .landscape-col {
    display: table-cell;
    width: 50%;
    vertical-align: middle;
    padding: 0 8px;
  }
  .timer-digits {
    font-size: 58px;
  }
  .modal-box {
    margin: 2px auto;
    padding: 8px;
  }
  .focus-btn {
    min-height: 48px;
    margin-bottom: 4px;
    padding: 3px 8px;
  }
}

/* Utility classes for strict zero-inline-style CSP */
.is-hidden {
  display: none;
}

.modal-footer {
  margin-top: 12px;
}


