/* =====================================================
   診療ツールポータル  style.css
   - スマホホーム画面風：背景＋アプリアイコングリッド
   - 医療系ティール〜ブルー配色
   ===================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans",
               "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  color: #1f2933;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  background: linear-gradient(160deg, #26c6da 0%, #0288d1 45%, #1565c0 100%);
  background-attachment: fixed;
}

/* ---------- ホーム画面 ---------- */
.home-view {
  min-height: 100vh;
  padding: max(env(safe-area-inset-top), 24px) 16px max(env(safe-area-inset-bottom), 24px);
  display: flex;
  flex-direction: column;
}

.home-header {
  text-align: center;
  margin-bottom: 28px;
  color: #fff;
}

.home-title {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.home-subtitle {
  margin: 0;
  font-size: 13px;
  opacity: 0.85;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px 8px;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

@media (min-width: 640px) {
  .app-grid {
    grid-template-columns: repeat(5, 1fr);
    max-width: 640px;
    gap: 28px 12px;
  }
}

@media (min-width: 960px) {
  .app-grid {
    grid-template-columns: repeat(6, 1fr);
    max-width: 800px;
  }
}

.app-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.app-icon-img {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.12s ease;
}

.app-icon:active .app-icon-img {
  transform: scale(0.92);
}

.app-icon-name {
  margin-top: 8px;
  font-size: 12px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  text-align: center;
  line-height: 1.25;
  word-break: break-word;
  max-width: 84px;
}

/* ---------- ツール表示画面 ---------- */
.tool-view {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #f5f7fa;
}

.tool-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  padding-top: max(env(safe-area-inset-top), 8px);
  background: #fff;
  border-bottom: 1px solid #e4e8ef;
  box-shadow: 0 1px 3px rgba(16, 42, 67, 0.05);
  flex-shrink: 0;
}

.back-btn {
  background: none;
  border: none;
  color: #0b5394;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: inherit;
  transition: background 0.15s;
}

.back-btn:hover, .back-btn:active {
  background: #eef3f9;
}

.tool-title {
  flex: 1;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #0b5394;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.open-new-tab {
  font-size: 18px;
  color: #0b5394;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 6px;
  transition: background 0.15s;
}

.open-new-tab:hover {
  background: #eef3f9;
}

.iframe-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #fff;
}

.iframe-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  display: block;
}
