/* FlashMaster — visual language borrowed from Pauline OS (Platinum),
 * with a loving pixel rendition of the gray early-2000s handheld. */

:root {
  --desk: #46648c;
  --desk-dot: rgba(255, 255, 255, .08);
  --win-bg: #dcdcdc;
  --win-fg: #181818;
  --bevel-light: #f8f8f8;
  --bevel-dark: #787878;
  --accent: #5c5cc4;
  --muted: rgba(0, 0, 0, .5);
  --shell: #b8b6ae;        /* device plastic */
  --shell-dark: #8d8b83;
  --shell-light: #d9d7cf;
  --lcd-bg: #9fb388;       /* classic green-gray LCD */
  --lcd-fg: #1d2a17;
  --key-yellow: #e8c832;
  --key-yellow-hi: #f6e07c;
  --key-white: #f0efe9;
  --key-dark: #3a3a3a;
  --good: #1d7a3d;
  --warn: #a04a1e;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 13px;
  color: var(--win-fg);
  background-color: var(--desk);
  background-image: conic-gradient(var(--desk-dot) 25%, transparent 0 50%, var(--desk-dot) 0 75%, transparent 0);
  background-size: 4px 4px;
  -webkit-font-smoothing: none;
}

.pixel { font-family: 'Silkscreen', monospace; }

a { color: var(--accent); }

button { font-family: inherit; font-size: inherit; }

/* ═══ App frame ═══ */

#fm-app {
  max-width: 860px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--win-bg);
  border-left: 2px solid var(--bevel-light);
  border-right: 2px solid var(--bevel-dark);
}

#fm-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--win-bg);
  border-bottom: 2px solid var(--bevel-dark);
  box-shadow: inset 0 1px 0 var(--bevel-light);
  flex-wrap: wrap;
}
.fm-title { font-size: 14px; font-weight: 700; }
.fm-tag { font-size: 8px; color: var(--muted); }
.crumb { font-size: 9px; text-decoration: none; color: var(--muted); }
.crumb:hover { color: var(--accent); }
body.embed .crumb { display: none; }

/* Embedded in a Pauline OS window: the window already provides the desktop
   and chrome, so drop the fake desk background and let the app fill the frame. */
body.embed {
  background-color: var(--win-bg);
  background-image: none;
}
body.embed #fm-app {
  max-width: none;
  border-left: none;
  border-right: none;
}

#fm-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 18px;
  padding: 16px;
  flex-wrap: wrap;
}

/* ═══ The handheld ═══ */

#device {
  width: 340px;
  flex-shrink: 0;
  padding: 14px 16px 12px;
  background: var(--shell);
  border: 2px solid var(--win-fg);
  border-radius: 22px;
  box-shadow:
    inset 2px 2px 0 var(--shell-light),
    inset -2px -2px 0 var(--shell-dark),
    4px 4px 0 rgba(0, 0, 0, .35);
}

#device-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
#device-brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #24418a;
  text-shadow: 1px 1px 0 var(--shell-light);
}
#device-brand span { font-size: 8px; vertical-align: super; }

/* keys */

.fm-key {
  font-family: 'Silkscreen', monospace;
  font-size: 8px;
  line-height: 1.25;
  color: var(--win-fg);
  border: 2px solid var(--win-fg);
  border-radius: 6px;
  cursor: pointer;
  padding: 5px 2px;
  text-align: center;
}
.fm-key:active { transform: translate(1px, 1px); box-shadow: none !important; }

.fm-key.power {
  background: #c0392b;
  color: #fff;
  font-size: 7px;
  border-radius: 8px;
  padding: 4px 8px;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .4), 2px 2px 0 rgba(0, 0, 0, .3);
}

.fm-key.activity {
  background: var(--key-yellow);
  box-shadow: inset 1px 1px 0 var(--key-yellow-hi), inset -1px -1px 0 #b09415, 2px 2px 0 rgba(0, 0, 0, .3);
  min-height: 34px;
}
.fm-key.selector {
  background: var(--key-white);
  box-shadow: inset 1px 1px 0 #ffffff, inset -1px -1px 0 #b9b8b2, 2px 2px 0 rgba(0, 0, 0, .3);
  min-height: 30px;
}
.fm-key.digit {
  background: var(--key-dark);
  color: #f5f5f5;
  font-size: 13px;
  font-weight: 700;
  box-shadow: inset 1px 1px 0 #5c5c5c, inset -1px -1px 0 #181818, 2px 2px 0 rgba(0, 0, 0, .3);
  min-height: 34px;
}

#activity-keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
#selector-keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
#digit-keys {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

/* LCD */

#lcd {
  background: var(--lcd-bg);
  border: 2px solid var(--win-fg);
  border-radius: 6px;
  box-shadow: inset 2px 2px 4px rgba(0, 0, 0, .35);
  padding: 8px 10px;
  margin-bottom: 12px;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--lcd-fg);
}
#lcd-status { font-size: 9px; min-height: 12px; opacity: .85; }
#lcd-main {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 1px;
  min-height: 26px;
  text-align: center;
  white-space: nowrap;
}
#lcd-sub { font-size: 9px; min-height: 12px; text-align: right; opacity: .85; }
#lcd.busy #lcd-sub { font-weight: 700; opacity: 1; }

body.powered-off #lcd { background: #8a9a78; }
body.powered-off .fm-key:not(.power) { opacity: .6; }

#device-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}
#sound-wrap { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
#sound-wrap .pixel { font-size: 8px; }
.foot-note { font-size: 7px; color: var(--muted); }

/* ═══ The manual ═══ */

#manual {
  flex: 1;
  min-width: 260px;
  max-width: 420px;
  background: #ffffff;
  border: 1px solid var(--win-fg);
  box-shadow: inset 1px 1px 0 var(--bevel-light), 3px 3px 0 rgba(0, 0, 0, .3);
}
.manual-head {
  font-size: 10px;
  padding: 6px 10px;
  background: var(--win-bg);
  border-bottom: 1px solid var(--bevel-dark);
}
.manual-body { padding: 4px 14px 12px; font-size: 12px; line-height: 1.55; }
.manual-body h3 { font-size: 10px; margin: 14px 0 4px; }
.manual-body ul { margin: 4px 0; padding-left: 18px; }
.manual-body li { margin-bottom: 4px; }
.manual-fine { font-size: 10px; color: var(--muted); margin-top: 12px; }

@media (max-width: 700px) {
  #fm-main { padding: 10px; }
  #manual { max-width: none; }
}
