/* style.css (最新版・画像保存バグ修正) */

/* ========================= */
/* グローバル変数 */
/* ========================= */
:root {
  --base-bg-color: #4A90A2;
  --app-section-color: #fff;
  --font-mincho: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "MS PMincho", serif;
  --font-sans-serif: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --penname-red-color: #d9534f;
  --font-potta-one: "Potta One", cursive;
  --app-max-width: 600px;
}

/* ========================= */
/* index.html */
/* ========================= */
.splash-page-body {
  font-family: var(--font-mincho);
  background-color: var(--base-bg-color);
  /* Background image moved to pseudo-element for better mobile compatibility */
  margin: 0;
  padding: 0;
  min-height: 100vh;
  position: relative;
}



.splash-container {
  background-color: var(--base-bg-color);
  width: 100%;
  max-width: var(--app-max-width);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100svh;
  padding: 10px 10px;
  /* Reduced side padding */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  /* Changed from space-between to prevent jitter */

  color: white;
  position: relative;
  /* Added for menu positioning */
}



.tanzaku {
  width: 80px;
  height: auto;
  margin-top: 5%;
  background: #fff;
  border: 1px solid #888;
  clip-path: polygon(0% 2%, 50% 0%, 100% 2%, 100% 98%, 50% 100%, 0% 98%);
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 25px;
}

.tanzaku-text {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 1.2em;
  letter-spacing: 0.5em;
  color: #333;
}

.catch-copy {
  display: flex;
  flex-direction: row-reverse;
  gap: 10px;
  font-size: 1.2em;
  letter-spacing: 0.3em;
  line-height: 2em;
  flex-grow: 1;
  justify-content: center;
  align-items: flex-start;
  margin-top: 30px;
  margin-bottom: 10px;
}

.haiku-counter {
  text-align: center;
  color: white;
  margin-bottom: 40px;
  font-family: var(--font-mincho);
  opacity: 0.9;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
}

.counter-label {
  font-size: 0.9em;
}

.counter-number {
  font-size: 1.8em;
  font-weight: bold;
  margin: 0 5px;
}

.counter-unit {
  font-size: 0.9em;
}

.fade-in {
  animation: fadeIn 1.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 0.9;
    transform: translateY(0);
  }
}

/* Lazy Loading - Disabled image-specific fade in favor of block fade */
/* Styles removed to prevent conflict with block visibility */

.vertical-text {
  writing-mode: vertical-rl;
  text-orientation: upright;
}

.footer-nav {
  text-decoration: none;
  color: white;
  text-align: center;
  font-size: 14px;
  font-family: var(--font-sans-serif);
  display: block;
}

.arrow-icon {
  font-size: 30px;
  font-weight: 200;
  margin-top: 10px;
}

.splash-footer-group {
  width: 100%;
  text-align: center;
  margin-top: auto;
  /* Push to bottom */
  margin-bottom: 20px;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

.splash-copyright {
  text-align: center;
  color: white;
  font-size: 12px;
  margin-top: 15px;
  opacity: 0.8;
  font-family: var(--font-sans-serif);
}

.fm-download {
  margin-top: 20px;
  text-align: center;
  font-family: var(--font-sans-serif);
}

.fm-download a {
  color: white;
  text-decoration: underline;
  font-size: 14px;
  display: inline-block;
  margin-bottom: 5px;
}

.fm-download-note {
  font-size: 11px;
  color: white;
  opacity: 0.8;
}

/* ===================================== */
/* app.html */
/* ===================================== */
.app-page-body {
  font-family: var(--font-sans-serif);
  background-color: var(--base-bg-color);
  /* Background image moved to pseudo-element for better mobile compatibility */
  color: white;
  margin: 0;
  line-height: 1.6;
  min-height: 100vh;
  box-sizing: border-box;
  overflow-y: auto;
  position: relative;
  /* min-width removed for mobile responsiveness */
}

.app-header {
  height: 60px;
  /* Fixed height placeholder */
  width: 100%;
}

.app-header-fixed {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background-color: var(--base-bg-color);

  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: center;
}

.header-content {
  width: 100%;
  max-width: var(--app-max-width);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 15px;
  box-sizing: border-box;
  position: relative;
  /* For menu positioning */
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
  min-width: 0;
  /* Allow shrinking */
}

.app-title {
  text-decoration: none;
  color: white;
}

.app-title h1 {
  margin: 0;
  font-size: 1rem;
  white-space: nowrap;
  font-family: var(--font-mincho);
  font-weight: normal;
}

.header-controls {
  margin-top: 0;
  /* Reset margin */
  flex: 1;
  min-width: 0;
}

.sort-buttons {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  overflow-x: auto;
  /* Allow scrolling on very small screens */
  scrollbar-width: none;
  /* Hide scrollbar */
}

.sort-buttons::-webkit-scrollbar {
  display: none;
}

/* .sort-btn removed, replaced by .sort-select */
.sort-select {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: white;
  padding: 6px 25px 6px 12px;
  /* Right padding for arrow */
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85em;
  transition: all 0.2s;
  white-space: nowrap;

  /* Custom Arrow */
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 10px top 50%;
  background-size: 8px auto;
}

.sort-select:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.sort-select option {
  color: #333;
  background: white;
}

.filter-label {
  font-size: 0.8em;
  white-space: nowrap;
  margin-left: 5px;
}

.header-right {
  margin-left: 10px;
}

.hamburger-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hamburger-menu {
  display: none;
  position: absolute;
  top: 60px;
  right: 0;
  width: 200px;
  background-color: white;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  border-radius: 0 0 0 10px;
  overflow: hidden;
  z-index: 1001;
}

.hamburger-menu.active {
  display: block;
}

.menu-nav {
  display: flex;
  flex-direction: column;
}

.menu-item {
  background: none;
  border: none;
  width: 100%;
  padding: 15px 20px;
  text-align: left;
  font-size: 1rem;
  color: #333;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background-color 0.2s;
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-item:hover {
  background-color: #f5f5f5;
  color: var(--base-bg-color);
}

.menu-item.active {
  background-color: #eef6f8;
  color: var(--base-bg-color);
  font-weight: bold;
}

.menu-icon {
  font-size: 1.2em;
}

.menu-profile {
  padding: 20px;
  background-color: #f9f9f9;
  border-bottom: 1px solid #eee;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.menu-profile-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.menu-profile-icon-placeholder {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: #fff;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.menu-pen-name-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
}

.menu-pen-name-label {
  font-size: 0.7em;
  color: #666;
  font-weight: normal;
}

.menu-pen-name {
  font-family: var(--font-potta-one);
  font-size: 1.1em;
  color: #333;
}

.menu-account-name {
  font-size: 0.8em;
  opacity: 0.7;
  text-align: center;
  color: #333;
}

.menu-login-btn {
  background-color: var(--base-bg-color);
  color: white;
  border: 1px solid white;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.9em;
  cursor: pointer;
  margin-top: 5px;
  transition: all 0.2s;
}

.menu-login-btn:hover {
  background-color: white;
  color: var(--base-bg-color);
}

.menu-logout {
  color: #d9534f;
  /* Red color for logout */
  border-top: 1px solid #eee;
  margin-top: auto;
  /* Push to bottom if container has height */
}

.menu-logout:hover {
  background-color: #ffeaea;
  color: #c9302c;
}

/* Adjust app container padding */
.app-container {
  padding-bottom: 20px;
  /* Reduced bottom padding since footer is gone */
  padding-top: 20px;
  max-width: var(--app-max-width);
  margin: 0 auto;
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
}

/* Ensure active tab takes available space so footer is pushed down - DISABLED to fix sticking */
.tab-content.active {
  flex: auto;
}

.app-copyright {
  text-align: center;
  color: #888;
  font-size: 10px;
  opacity: 0.6;
  font-family: var(--font-sans-serif);
  margin: 0 auto;
  max-width: var(--app-max-width);
  margin-top: 40px;
  margin-bottom: 20px;
}

/* タブ & ナビ */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* 一覧タブ UI */
.list-header-tabs {
  display: flex;
  background-color: var(--app-section-color, #fff);
  border-radius: 10px 10px 0 0;
  margin: 0 auto;
  width: 100%;
  max-width: var(--app-max-width);
}

.list-header-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  background: #f0f0f0;
  /* 背景色 */
  border: none;
  color: #888;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.2s;
  margin: 0 2px;
  border-radius: 8px 8px 0 0;
}

.list-header-tab:first-child {
  margin-left: 0;
}

.list-header-tab:last-child {
  margin-right: 0;
}

.list-header-tab.active {
  background-color: var(--base-bg-color, #4A90A2);
  color: white;
  font-weight: bold;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

.list-filter {
  padding: 10px 0;
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-filter label {
  color: white;
  display: flex;
  align-items: center;
  font-size: 0.9em;
}

.list-filter select {
  padding: 6px 8px;
  border-radius: 5px;
  border: 1px solid #ccc;
  background-color: #fff;
  color: #333;
  font-size: 0.9em;
}

.haiku-list-container {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

/* 俳句カード本体 */
.haiku-card {
  background: #fff;
  /* Animation moved to end of file for specificity */
  /* White background */
  margin-bottom: 20px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  position: relative;
  border-radius: 10px;
  /* Larger rounded corners */
  padding: 10px;
  /* Thick teal border */
  border: 4px solid var(--base-bg-color);
  gap: 12px;
  /* Gap between left and right */
  box-sizing: border-box;
  width: 100%;
}

.haiku-card.viewer-card {
  grid-template-columns: minmax(0, 1.37fr) minmax(0, 0.63fr);
  /* 95% of previous 1.44fr to prevent date cut off */
}

.haiku-list-container .haiku-card:not(:first-child) {
  border-radius: 10px;
}

.haiku-card-left {
  background: transparent;
  /* Transparent since parent is white */
  width: 100%;
  padding: 8px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  /* Align top */
  font-size: 0.85em;
  min-height: 0;
  min-width: 0;
  /* Removed overflow: hidden to ensure buttons are clickable */
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

.haiku-card-controls {
  border-left: 1px solid #f0f0f0;
}

.owner-controls {
  justify-content: flex-start;
}

.viewer-controls {
  justify-content: flex-end;
  gap: 6px;
}

.viewer-meta {
  margin-top: auto;
  justify-content: flex-start;
  margin-bottom: 0;
}

/* 俳句テキストの枠線付きボックス */
.haiku-text-bordered {
  padding: 10px;
  margin-bottom: 3px;
  border-radius: 4px;
  border: #ccc solid 1px;
  /* Slight round */
  min-height: 100px;
  /* Ensure some height */
  display: flex;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  margin-top: 0;
  /* Align with top */
}

.haiku-card-text {
  font-family: var(--font-mincho);
  font-size: clamp(14px, 4vw, 1.25em);
  /* Responsive font size */
  line-height: 1.5;
  color: #333;
  font-weight: normal;
  width: 100%;
  word-break: break-all;
}

.haiku-card-text[contenteditable="true"] {
  cursor: text;
  outline: none;
}

.haiku-card-text[contenteditable="true"]:focus {
  background-color: #fff;
  box-shadow: 0 0 0 2px var(--base-bg-color);
}

.haiku-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
  color: #eee;
  font-size: clamp(8px, 2.8vw, 0.75em);
  /* Responsive font size */
  width: 100%;
}

.haiku-card-thumbnail {
  display: none;
}

.haiku-card-info-icon {
  display: none;
}

.haiku-card-save-button {
  padding: 3px 6px;
  /* Slightly tighter padding */
  font-size: clamp(8px, 2.8vw, 0.8em);
  /* Responsive font size */
  background-color: #ccc;
  color: white;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.2s;
  white-space: nowrap;
  /* Prevent wrapping */
}

.haiku-card-save-button:disabled {
  background-color: #ccc;
  cursor: default;
}

.haiku-card-save-button:not(:disabled) {
  background-color: #999;
}

.haiku-card-save-button:not(:disabled):hover {
  background-color: #888;
}

.haiku-card-date {
  font-family: var(--font-sans-serif);
  color: #999;
  padding-left: 5px;
  /* Reduced padding */
  white-space: nowrap;
  /* Prevent date wrapping awkwardly */
}

/* 自己評価エリア */
.haiku-card-rating-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  /* Tighter gap */
  margin-bottom: 2px;
  padding-left: 0;
  /* Reduced padding */
  font-size: clamp(12px, 2.8vw, 0.95em);
  /* Responsive font size */
  color: #999;
}

.rating-stars {
  color: #ddd;
  font-size: clamp(16px, 4vw, 24px);
  /* Responsive star size */
  display: flex;
  gap: 2px;
  /* Ensure flex for consistent alignment */
}

.rating-star.filled {
  color: #ddd;
}

/* いいねエリア */
.haiku-card-like-row {
  display: flex;
  padding-left: 5px;
  /* Reduced padding */
  align-items: center;
  gap: 5px;
  margin-top: 0;
  position: relative;
  z-index: 50;
  pointer-events: auto;
}

.owner-like-row,
.viewer-like-row {
  margin-top: 0;
  padding-left: 0;
}

.owner-rating-label {
  min-width: 2.5em;
  font-weight: 600;
}

.owner-rating-value {
  font-family: var(--font-sans-serif);
  color: #666;
  font-weight: 700;
  font-size: 1.05em;
  padding-left: 0;
  margin-bottom: 8px;
}

.owner-actions-row {
  margin-top: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.like-readonly {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px;
  font-size: clamp(14px, 4vw, 1.2em);
  color: #888;
}

.like-readonly .like-count {
  color: #888;
}

.like-button {
  background: none;
  border: none;
  padding: 8px;
  /* Removed negative margin */
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  /* Tighter gap */
  font-size: clamp(14px, 4vw, 1.2em);
  /* Responsive font size */
  color: #ff4d4d;
  position: relative;
  z-index: 999 !important;
  pointer-events: auto !important;
  min-width: 36px;
  /* Ensure click target size */
  min-height: 36px;
}

.heart-icon {
  font-size: 1em;
}

.like-count {
  font-family: var(--font-sans-serif);
  color: #ff4d4d;
  font-weight: bold;
}

/* カード右カラム */
.haiku-card-right {
  width: 100%;
  position: relative;
  background: #fff;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  border-radius: 8px;
  /* Inner rounded corners */
  container-type: inline-size;
}

.haiku-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 俳句オーバーレイ */
.haiku-card-overlay-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(255, 255, 255, 0.45);
  /* Semi-transparent white */
  width: 80%;
  height: 80%;
  box-sizing: border-box;
  border-radius: 10px;
  /* Rounded rectangle */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 10px;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.haiku-content {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--font-mincho);
  font-size: clamp(16px, 10cqw, 42px);
  font-weight: 900;
  line-height: 1.6;
  color: #333;
  word-break: keep-all;
  text-align: left;
  margin: auto;
  text-shadow:
    3px 3px 5px rgba(255, 255, 255, 1),
    -3px -3px 5px rgba(255, 255, 255, 1),
    3px -3px 5px rgba(255, 255, 255, 1),
    -3px 3px 5px rgba(255, 255, 255, 1),
    0px 3px 5px rgba(255, 255, 255, 1),
    0px -3px 5px rgba(255, 255, 255, 1),
    3px 0px 5px rgba(255, 255, 255, 1),
    -3px 0px 5px rgba(255, 255, 255, 1),
    0px 0px 10px rgba(255, 255, 255, 0.8),
    0px 0px 20px rgba(255, 255, 255, 0.5);
}

.haiku-penname {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--font-potta-one);
  font-size: 1.0em;
  color: white;
  background-color: #d9534f;
  padding: 8px 4px;
  border-radius: 4px;
  line-height: 1.2;
  position: absolute;
  bottom: 10px;
  left: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  z-index: 5;
}

.haiku-hashtag {
  display: none;
}

.haiku-card-delete-button {
  position: static;
  /* Inline */
  background-color: #ff0000 !important;
  /* Force Red */
  color: white;
  border: none;
  border-radius: 4px;
  /* Square with slight round */
  width: 20px;
  height: 20px;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}

.haiku-card-delete-button:hover {
  background: #cc0000;
}

.haiku-card-rating {
  margin-top: 8px;
  font-size: 0.9em;
  color: #555;
  display: flex;
  align-items: center;
  padding-left: 10px;
  padding-right: 10px;
}

.rating-stars {
  display: inline-flex;
  margin-left: 10px;
}

.rating-star {
  font-size: 1em;
  /* Reduced star size from 2.5em */
  color: rgba(204, 204, 204, 0.3);
  cursor: pointer;
  transition: color 0.1s;
}

.rating-star.hovered {
  color: #f39c12;
}

.rating-star.filled {
  color: #f39c12;
}

/* SPA View Styles */
.view-content {
  display: none;
  width: 100%;
  min-height: 100%;
}

.view-content.active {
  display: block;
}

/* Body Styles */
body {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  color: #333;
  transition: background 0.3s;
}

/* Splash Page Specific Body */
body.splash-page-body {
  background-color: var(--base-bg-color);
  /* Solid Teal */
  display: block;
  overflow: auto;
}

/* App Page Specific Body */
body.app-page-body {
  background-color: var(--base-bg-color);
  /* Solid Teal */
  display: block;
  overflow: auto;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.modal.active {
  display: flex;
  pointer-events: auto;
  opacity: 1;
}

.modal-content {
  background-color: #fefefe;
  margin: auto;
  padding: 25px 30px;
  border-radius: 10px;
  max-width: 380px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  text-align: center;
  color: #333;
  transform: translateY(-20px);
  transition: transform 0.3s ease-in-out;
}

.modal.active .modal-content {
  transform: translateY(0);
}

.modal-content h2 {
  font-size: 20px;
  margin-top: 0;
  margin-bottom: 15px;
  color: #222;
}

.modal-content p {
  font-size: 16px;
  margin-bottom: 25px;
  line-height: 1.5;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.modal-button {
  padding: 10px 25px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  min-width: 100px;
}

.modal-button.cancel {
  background-color: #ccc;
  color: #333;
}

.modal-button.cancel:hover {
  background-color: #bbb;
  transform: translateY(-1px);
}

.modal-button.ok {
  background-color: var(--base-bg-color, #4A90A2);
  color: white;
}

.modal-button.ok:hover {
  background-color: #3c7a8a;
  transform: translateY(-1px);
}

/* ================================== */
/* app.html (俳句画像拡大モーダル) */
/* ================================== */
.modal-fullscreen {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  /* 背景を少し濃い黒の半透明に */
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  backdrop-filter: blur(5px);
  /* 背景をぼかす (モダンブラウザ用) */
}

.modal-fullscreen.active {
  display: flex;
  pointer-events: auto;
  opacity: 1;
}

.modal-fullscreen-content {
  background-color: var(--base-bg-color);
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: left;
  gap: 15px;
  transition: transform 0.3s ease-in-out;
}

.modal-fullscreen.active .modal-fullscreen-content {
  transform: translateY(0);
}

/* ★変更: position:relative を維持しつつ display:block を基本に */
.modal-image-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  /* ★重要: 黒背景を削除（保存時に青くならないように） */
  background: transparent;
  container-type: inline-size;
}

#modalHaikuImage {
  width: 100%;
  height: auto;
  /* 高さは自動 */
  border-radius: 8px;
  object-fit: cover;
  display: block;
  aspect-ratio: 1 / 1;
}

/* ★変更: モーダル内のオーバーレイも transform を避ける */
.modal-haiku-overlay-text {
  position: absolute;
  /* 上下左右中央配置 (transformなし) */
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;

  background-color: rgba(255, 255, 255, 0.45);
  width: 70%;
  /* 一覧より少し小さめに見えるので75%くらい */
  height: 70%;

  box-sizing: border-box;
  border-radius: 4px;
  text-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 1vw;
  overflow: hidden;
  pointer-events: none;
}

.modal-haiku-content {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--font-mincho);
  font-weight: 900;
  font-size: clamp(16px, 10cqw, 42px);
  line-height: 1.6;
  color: #333;
  word-break: keep-all;
  text-align: left;
  overflow: hidden;
  max-height: 100%;
  margin: auto;
  text-shadow:
    3px 3px 5px rgba(255, 255, 255, 1),
    -3px -3px 5px rgba(255, 255, 255, 1),
    3px -3px 5px rgba(255, 255, 255, 1),
    -3px 3px 5px rgba(255, 255, 255, 1),
    0px 3px 5px rgba(255, 255, 255, 1),
    0px -3px 5px rgba(255, 255, 255, 1),
    3px 0px 5px rgba(255, 255, 255, 1),
    -3px 0px 5px rgba(255, 255, 255, 1),
    0px 0px 10px rgba(255, 255, 255, 0.8),
    0px 0px 20px rgba(255, 255, 255, 0.5);
}

.modal-haiku-penname-wrapper {
  position: absolute;
  bottom: 5%;
  left: 5%;
}

.modal-haiku-penname {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--font-potta-one);
  font-size: clamp(0.7em, 3vw, 1.2em);
  color: white;
  background-color: var(--penname-red-color);
  padding: 1vw 0.5vw;
  border-radius: 2px;
  line-height: 1.3;
}

.modal-haiku-hashtag {
  font-family: var(--font-sans-serif);
  font-size: clamp(0.6em, 2.5vw, 1em);
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  position: absolute;
  bottom: 2%;
  right: 2%;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  opacity: 0.9;
  pointer-events: none;
}

.modal-fullscreen-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  width: 100%;
}

.modal-button-icon {
  background: none;
  border: none;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.9em;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background-color 0.2s;
  flex: 1;
}

.modal-button-icon:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.modal-button-icon svg {
  width: 24px;
  height: 24px;
  margin-bottom: 5px;
}

#modalXButton {
  color: #f0f0f0;
}

#modalXButton svg {
  fill: #f0f0f0;
}

#modalXButton:hover {
  background-color: rgba(200, 200, 200, 0.2);
}

#modalSaveButton {
  color: #28a745;
}

#modalSaveButton svg {
  fill: #28a745;
}

#modalSaveButton:hover {
  background-color: rgba(40, 167, 69, 0.2);
}

#modalCloseButton {
  color: #6c757d;
}

#modalCloseButton svg {
  fill: #6c757d;
}

#modalCloseButton:hover {
  background-color: rgba(108, 117, 125, 0.2);
}

/* Splash Page Menu */
.splash-header-right {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 1000;
}

.splash-menu {
  top: 50px;
  right: 0;
  border-radius: 10px;
}

/* Settings Screen Redesign */
.settings-description {
  text-align: center;
  margin-bottom: 20px;
  font-size: 0.9em;
  opacity: 0.8;
}

.settings-container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 30px;
  margin-top: 20px;
}

.settings-preview {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f0f0f0;
  padding: 20px;
  border-radius: 8px;
  min-height: 200px;
  min-width: 100px;
}

.haiku-penname-preview {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--font-potta-one);
  font-size: 1.2em;
  color: white;
  background-color: #d9534f;
  /* Red tag style */
  padding: 10px 6px;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.1em;
}

.settings-input-area {
  display: flex;
  flex-direction: column;
  gap: 15px;
  flex: 1;
  max-width: 300px;
}

.settings-save-btn {
  background-color: var(--base-bg-color);
  color: white;
  border: 1px solid white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.settings-save-btn:hover {
  background-color: white;
  color: var(--base-bg-color);
}

.settings-save-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Composite Image Generator Styles */
.composite-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  /* Center without transform for better html2canvas support */
  background-color: rgba(255, 255, 255, 0.45);
  /* Slightly more opaque to ensure text readability */
  width: 80%;
  height: 80%;
  border-radius: 40px;
  /* Larger radius for larger image */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  /* Stronger shadow */
}

#composite-generator {
  width: 1024px;
  height: 1024px;
  position: relative;
  overflow: hidden;
}

#composite-bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.composite-text {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--font-mincho);
  font-size: clamp(40px, 6.5cqw, 80px); /* Adjust dynamically to container width (1024px) */
  line-height: 1.6;
  color: #333;
  text-shadow:
    6px 6px 8px rgba(255, 255, 255, 1),
    -6px -6px 8px rgba(255, 255, 255, 1),
    6px -6px 8px rgba(255, 255, 255, 1),
    -6px 6px 8px rgba(255, 255, 255, 1),
    0px 6px 8px rgba(255, 255, 255, 1),
    0px -6px 8px rgba(255, 255, 255, 1),
    6px 0px 8px rgba(255, 255, 255, 1),
    -6px 0px 8px rgba(255, 255, 255, 1),
    0px 0px 15px rgba(255, 255, 255, 0.8),
    0px 0px 30px rgba(255, 255, 255, 0.5);
  word-break: keep-all;
  white-space: pre-wrap;
  text-align: left;
  margin: auto;
  max-height: 100%;
  overflow: hidden;
  font-weight: 900;
}

.composite-pen-name {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--font-potta-one);
  font-size: 42px; /* Fixed robust size for 1024 container */
  color: white;
  background-color: var(--penname-red-color, #d9534f);
  padding: 0.5em 0.25em; /* Match ratio of preview .5 / .25 */
  border-radius: 12px;
  position: absolute;
  /* Scale preview 10px offset into 1024x1024 layout */
  bottom: 40px; 
  left: 40px;
  letter-spacing: 0.1em;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
  line-height: 1.2;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 20px;
  background-color: transparent;
  border-top: none;
  margin-top: 30px;
  width: 100%;
  box-sizing: border-box;
}

.footer-link {
  color: #666;
  text-decoration: none;
  font-size: 0.9em;
}

/* Detail View */
.detail-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  /* Reduced from 20px for mobile */
  gap: 20px;
  width: 100%;
  box-sizing: border-box;
  /* Ensure padding doesn't overflow width */
}

.detail-image {
  width: 100%;
  max-width: 600px;
  height: auto;
  /* Ensure aspect ratio is preserved */
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  object-fit: contain;
  /* Prevent cropping if height was constrained, though auto handles it */
  display: block;
  margin: 0 auto;
}

.detail-menu {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  max-width: 400px;
}

.detail-btn {
  padding: 12px;
  border-radius: 30px;
  border: none;
  font-size: 1em;
  cursor: pointer;
  text-align: center;
  font-weight: bold;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  width: 100%;
  box-sizing: border-box;
}

.detail-btn.primary {
  background-color: var(--base-bg-color);
  color: white;
}

.detail-btn.secondary {
  background-color: #f0f0f0;
  color: #333;
}

.detail-btn.x-share {
  background-color: #000;
  color: white;
}

.detail-btn:hover {
  opacity: 0.9;
}

/* ========================= */
/* Refactored Generation Screen */
/* ========================= */

.input-group {
  margin-bottom: 25px;
  /* More space between groups */
  width: 100%;
}

.input-group label {
  display: block;
  margin-bottom: 10px;
  font-weight: bold;
  color: #333;
}

/* Make selects stack on mobile or be full width */
.input-group select {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 10px;
}

.label-margin-left {
  margin-left: 0 !important;
  /* Override inline style or class if any */
  margin-top: 15px;
  display: block;
}

.btn-large {
  padding: 12px 24px;
  font-size: 1.1em;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  box-sizing: border-box;
  border: none;
  font-weight: bold;
}

.primary-btn {
  background-color: var(--base-bg-color);
  color: white;
  border: 2px solid white;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.primary-btn:hover {
  background-color: #3a7a8c;
  transform: translateY(-2px);
}

.save-btn {
  background-color: #d9534f;
  color: white;
  margin-top: 20px;
}

.save-btn:hover {
  background-color: #c9302c;
}

.select-large {
  padding: 10px;
  font-size: 1em;
  border-radius: 5px;
  border: 1px solid #ccc;
}

.result-container {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 20px;
  background: #f9f9f9;
  padding: 15px;
  border-radius: 10px;
}

.result-left,
.result-right {
  flex: 1;
  min-width: 240px;
  /* Stack on mobile earlier but fit in small screens */
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

.result-left h3,
.result-right h3 {
  margin-top: 0;
  font-size: 1.1em;
  color: #333;
  border-bottom: 2px solid #eee;
  padding-bottom: 5px;
  margin-bottom: 10px;
}

#haikuText {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-mincho);
  font-size: 1.4em;
  line-height: 1.5;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
  min-height: 120px;
}

.haiku-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #ddd;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  container-type: inline-size;
}

.haiku-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  background-color: rgba(255, 255, 255, 0.45);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: 10px;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.preview-text {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--font-mincho);
  font-weight: 900;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: keep-all;
  text-align: left;
  margin: auto;
  font-size: clamp(16px, 10cqw, 42px);
  color: #333;
  text-shadow:
    3px 3px 5px rgba(255, 255, 255, 1),
    -3px -3px 5px rgba(255, 255, 255, 1),
    3px -3px 5px rgba(255, 255, 255, 1),
    -3px 3px 5px rgba(255, 255, 255, 1),
    0px 3px 5px rgba(255, 255, 255, 1),
    0px -3px 5px rgba(255, 255, 255, 1),
    3px 0px 5px rgba(255, 255, 255, 1),
    -3px 0px 5px rgba(255, 255, 255, 1),
    0px 0px 10px rgba(255, 255, 255, 0.8),
    0px 0px 20px rgba(255, 255, 255, 0.5);
}

.preview-pen-name {
  position: absolute;
  bottom: 10px;
  left: 10px;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--font-potta-one);
  font-size: clamp(12px, 5.5cqw, 20px);
  color: white;
  background-color: var(--penname-red-color);
  padding: 0.5em 0.25em;
  border-radius: 4px;
  line-height: 1.2;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* ===================================== */
/* filemaker_guide.html */
/* ===================================== */
.guide-page-body {
  font-family: var(--font-sans-serif);
  background-color: var(--base-bg-color);
  color: #333;
  margin: 0;
  padding: 0;
  line-height: 1.6;
  min-height: 100vh;
}

.guide-container {
  max-width: var(--app-max-width);
  margin: 0 auto;
  padding: 40px 20px;
  box-sizing: border-box;
}

.guide-header {
  text-align: center;
  margin-bottom: 30px;
  color: white;
}

.guide-header h1 {
  font-family: var(--font-mincho);
  color: white;
  margin-bottom: 10px;
  font-size: 1.8em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.guide-header p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95em;
}

.guide-content {
  background: white;
  border-radius: 16px;
  padding: 30px 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.guide-step {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 25px;
  position: relative;
}

.guide-step:last-child {
  margin-bottom: 0;
}

.step-badge {
  background: var(--base-bg-color);
  color: white;
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: bold;
  margin-bottom: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.guide-step h3 {
  margin: 0 0 10px 0;
  font-size: 1.1em;
  color: #333;
  font-weight: bold;
}

.guide-step p {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 15px;
  line-height: 1.7;
}

.guide-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 14px;
  text-align: center;
  text-decoration: none;
  border-radius: 30px;
  font-weight: bold;
  box-sizing: border-box;
  transition: all 0.2s;
  font-size: 0.95em;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.guide-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}

.guide-btn.primary-btn {
  background-color: var(--base-bg-color);
  color: white;
  border: 2px solid var(--base-bg-color);
}

.guide-btn.primary-btn:hover {
  background-color: #3a7585;
  border-color: #3a7585;
}

.guide-btn.secondary-btn {
  background-color: #333;
  color: white;
  border: 2px solid #333;
}

.guide-btn.secondary-btn:hover {
  background-color: #555;
  border-color: #555;
}

.note {
  font-size: 0.8em;
  color: #999;
  margin-top: 8px;
  margin-bottom: 0;
  text-align: center;
}

.guide-footer {
  text-align: center;
  margin-top: 40px;
  padding-bottom: 20px;
}

.back-link {
  color: white;
  text-decoration: none;
  font-size: 0.9em;
  display: inline-block;
  padding: 10px 20px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.back-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/* CSS Updates */

/* Add horizontal padding to app container */
.app-container {
  padding-left: 10px;
  padding-right: 10px;
}

/* Image Preview Area Styles */
.image-preview-area {
  display: flex;
  gap: 20px;
  margin-bottom: 25px;
  background-color: #f9f9f9;
  padding: 15px;
  border-radius: 10px;
  align-items: flex-start;
}

.preview-image-box {
  flex: 0 0 120px;
  /* Fixed width for thumbnail */
  width: 120px;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  background-color: #eee;
  border: 1px solid #ddd;
}

.preview-image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-meta-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  font-size: 0.9em;
  color: #555;
  height: 120px;
  /* Match image height */
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Season Radio Buttons */
.season-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 5px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-weight: normal;
  /* Reset bold from label */
}

.radio-label input[type="radio"] {
  accent-color: var(--base-bg-color);
  width: 1.2em;
  height: 1.2em;
}

/* Responsive adjustments for preview area */
@media (max-width: 400px) {
  .image-preview-area {
    flex-direction: column;
    align-items: center;
  }

  .preview-image-box {
    width: 100%;
    height: 200px;
  }

  .preview-meta-box {
    width: 100%;
    height: auto;
    margin-top: 10px;
  }
}

/* Footer Logic - appended via automation */
.common-footer {
  width: 100%;
  text-align: center;
  padding: 20px 0;
  margin-top: auto;
  color: white !important;
  /* Force white text */
  position: relative;
  z-index: 10;
}

.splash-footer-custom {
  margin-top: 20px;
  padding-bottom: 40px;
  /* Ensure safe area spacing */
}

.footer-content {
  display: flex !important;
  /* Force flex */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  /* Allow wrapping on small screens */
}

.footer-sns-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.footer-social-link {
  color: white !important;
  opacity: 0.9;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  text-decoration: none;
}

.footer-social-link:hover {
  opacity: 1.0;
}

.footer-copyright {
  font-size: 0.8em;
  opacity: 0.8;
  font-family: var(--font-sans-serif);
}

/* FileMaker Guide Modal Integration */
.fm-download-area {
  margin-top: 20px;
  text-align: center;
  margin-bottom: 10px;
  position: relative;
  z-index: 10;
}

.fm-guide-link {
  background: none;
  border: none;
  color: white !important;
  text-decoration: underline;
  font-size: 14px;
  cursor: pointer;
  padding: 10px;
  /* Larger hit area */
  font-family: var(--font-sans-serif);
}

.fm-guide-link:hover {
  opacity: 0.9;
}

/* Ensure modal is on top */
.modal {
  z-index: 99999 !important;
  /* Very high z-index */
}

.guide-modal-content {
  max-width: 600px;
  max-height: 80vh;
  margin: 5% auto;
  /* Centered */
  display: flex;
  flex-direction: column;
  background-color: white;
  color: #333;
  padding: 20px;
  border-radius: 10px;
  position: relative;
  width: 90%;
  /* Responsive width */
}

.guide-content-scroll {
  overflow-y: auto;
  flex: 1;
  padding-right: 5px;
  -webkit-overflow-scrolling: touch;
  /* Smooth scrolling on iOS */
}

.guide-header {
  text-align: center;
  margin-bottom: 20px;
}

.guide-header h2 {
  color: #333;
  margin-bottom: 10px;
  font-family: var(--font-mincho);
  font-size: 1.4em;
}

.guide-header p {
  color: #666;
  text-align: center;
  font-size: 0.9em;
  line-height: 1.5;
}

/* Standardized Content Card */
.content-card {
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  color: #333;
  line-height: 1.6;
  margin-bottom: 20px;
}

/* Visibility Toggle Button */
/* Visibility Toggle Button (Reverted Style, Static Position) */
.visibility-toggle-btn {
  /* position: absolute; - Removed for static placement */
  /* bottom: 8px; - Removed */
  /* right: 8px; - Removed */
  /* z-index: 20; - Removed */

  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;

  background-color: rgba(255, 255, 255, 0.85);
  color: #444;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 0.75em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.visibility-toggle-btn:hover {
  background-color: rgba(255, 255, 255, 1);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.visibility-toggle-btn.private {
  background-color: rgba(60, 60, 60, 0.85);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.visibility-toggle-btn.private:hover {
  background-color: rgba(40, 40, 40, 0.95);
}

.list-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 0.75em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.owner-actions-row .visibility-toggle-btn,
.owner-actions-row .list-action-btn {
  flex: 1;
}

.delete-action-btn {
  background-color: rgba(255, 255, 255, 0.85);
  color: #444;
}

.delete-action-btn:hover {
  background-color: rgba(255, 255, 255, 1);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

/* haiku-card-right-col Wrapper */
.haiku-card-right-col {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  position: relative;
  z-index: 5;
}

.haiku-card-right-col .haiku-card-right {
  /* Maintain original aspect ratio matching */
  width: 100%;
}

#penNameInput {
  font-size: 0.9em;
  padding: 10px;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 5px;
}



/* Animation Styles - Block Based Lazy Loading */
/* Default state (visible) */
#haikuList .haiku-card {
  opacity: 1;
  /* transform: translateY(0); - Removed to test clickability */
  /* transition: opacity 1.0s ease-out, transform 1.0s ease-out; - Removed */
}

/* Initial hidden state */
#haikuList .haiku-card.lazy-hidden {
  opacity: 0;
  transform: translateY(50px);
}

/* Custom Theme Toggle Radio Group */
.theme-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 5px;
}

/* Dark Theme Overrides */
/* Backgrounds */
.theme-dark .preview-overlay,
.theme-dark .haiku-card-overlay-text,
.theme-dark .modal-haiku-overlay-text,
.theme-dark .composite-overlay {
  background-color: rgba(0, 0, 0, 0.45) !important;
}

/* Text Colors */
.theme-dark .preview-text,
.theme-dark .haiku-content,
.theme-dark .modal-haiku-content,
.theme-dark .composite-text {
  color: #ffffff !important;
  text-shadow:
    3px 3px 5px rgba(0, 0, 0, 1),
    -3px -3px 5px rgba(0, 0, 0, 1),
    3px -3px 5px rgba(0, 0, 0, 1),
    -3px 3px 5px rgba(0, 0, 0, 1),
    0px 3px 5px rgba(0, 0, 0, 1),
    0px -3px 5px rgba(0, 0, 0, 1),
    3px 0px 5px rgba(0, 0, 0, 1),
    -3px 0px 5px rgba(0, 0, 0, 1),
    0px 0px 10px rgba(0, 0, 0, 0.8),
    0px 0px 20px rgba(0, 0, 0, 0.5) !important;
}

/* Language Switcher Styles */
.lang-switcher {
  text-align: center;
  margin-bottom: 15px;
  font-size: 0.9em;
  color: #666;
  font-family: var(--font-sans-serif);
  z-index: 100;
  /* Ensure high z-index */
  position: relative;
}

.splash-lang-switcher {
  width: auto;
  /* Changed from 100% to auto for absolute positioning */
  position: absolute;
  top: 10px;
  /* Align with hamburger menu */
  left: 10px;
  /* Opposite side of hamburger menu */
  z-index: 100;
  margin: 0;
}

/* Adjust splash layout to accommodate lang switcher */
.haiku-counter.fade-in {
  position: static;
  margin-bottom: 40px;
}

.lang-link {
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
  padding: 10px;
}

.lang-link:hover {
  opacity: 0.8;
}

.lang-link.active {
  font-weight: bold;
  opacity: 1;
}

/* Splash specific: Yellow for active, White for inactive. Bold always to prevent jump. */
.splash-lang-switcher .lang-link {
  color: #fff;
  opacity: 1;
  /* Reset opacity inheritance */
  font-weight: bold;
  /* Always bold to prevent jumping */
}

.splash-lang-switcher .lang-link.active {
  color: #FFD700;
  opacity: 1;
}

.menu-lang-switcher {
  margin-top: 5px;
  margin-bottom: 15px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}